QUIZ ON : PROGRAMMING AND PROBLEM SOLVING THROUGH PYTHON - INTRODUCTION TO PYTHON

INTRODUCTION TO PYTHON

00:00:00

Which of the following is an invalid statement?

Option A. abc = 1,000,000
Option B. a b c = 1000 2000 3000
Option C. a,b,c = 1000, 2000, 3000
Option D. a_b_c = 1,000,000
True Answer B

Explanation :
Spaces are not allowed in variable names.

Which of the following is an invalid statement?

Question No# : 01 out of 20



What will be the output of the following Python code?

print('abcdefcdgh'.partition('cd'))

Option A. (‘ab’, ‘cd’, ‘ef’, ‘cd’, ‘gh’)
Option B. (‘ab’, ‘cd’, ‘efcdgh’)
Option C. (‘abcdef’, ‘cd’, ‘gh’)
Option D. error
True Answer B

Explanation :
The string is partitioned at the point where the separator first appears.

What will be the output of the following Python code?

print('abcdefcdgh'.partition('cd'))

Question No# : 02 out of 20



You can create program in Python , interactive Mode

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer B

Explanation :

You can create program in Python , interactive Mode

Question No# : 03 out of 20

0128 is a legal literal value in Python

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer B

Explanation :

0128 is a legal literal value in Python

Question No# : 04 out of 20

which function do you use to read a string?

Option A. input(“Enter a string”)
Option B. eval(input(“Enter a string”))
Option C. enter(“Enter a string”)
Option D. eval(enter(“Enter a string”))
True Answer A

Explanation :
input function is used to read a string in PYTHON

which function do you use to read a string?

Question No# : 05 out of 20



What will be the output of the following Python code snippet?

print(''''''.isspace())

Option A. True
Option B. False
Option C. None
Option D. Error
True Answer B

Explanation :
None.

What will be the output of the following Python code snippet?

print(''''''.isspace())

Question No# : 06 out of 20



Which of these in not a core data type?

Option A. Lists
Option B. Dictionary
Option C. Tuples
Option D. Class
True Answer D

Explanation :
Class is a user defined data type.

Which of these in not a core data type?

Question No# : 07 out of 20



To print a line a text without ending it with a newline, ____ argument is used with print()

Option A. sep
Option B. newline
Option C. end
Option D. next
True Answer C

Explanation :

To print a line a text without ending it with a newline, ____ argument is used with print()

Question No# : 08 out of 20

To convert the read value through input() into integer type, ______ () is used

Option A. floating
Option B. float
Option C. int
Option D. integer
True Answer C

Explanation :

To convert the read value through input() into integer type, ______ () is used

Question No# : 09 out of 20

The data type whose representation is unknown are called

Option A. Built in datatype
Option B. Derived datatype
Option C. Concrete datatype
Option D. Abstract datatype
True Answer D

Explanation :
A concrete data type is a data type whose representation is known and in abstract data type the representation of a data type is unknown

The data type whose representation is unknown are called

Question No# : 10 out of 20

What will be the output of the following Python code snippet?

print('my_string'.isidentifier())

Option A. True
Option B. False
Option C. None
Option D. Error
True Answer A

Explanation :
It is a valid identifier.

What will be the output of the following Python code snippet?

print('my_string'.isidentifier())

Question No# : 11 out of 20



To print the value of a variable, Python uses

Option A. Print Statement
Option B. Print Function()
Option C. print Statement
Option D. print() Function
True Answer D

Explanation :

To print the value of a variable, Python uses

Question No# : 12 out of 20

Escape sequences are treated as ____

Option A. Strings
Option B. Characters
Option C. Integers
Option D. None of These
True Answer B

Explanation :

Escape sequences are treated as ____

Question No# : 13 out of 20

Which of the following is an invalid variable?

Option A. my_string_1
Option B. 1st_string
Option C. foo
Option D. _myvar
True Answer B

Explanation :
Variable names should not start with a number.

Which of the following is an invalid variable?

Question No# : 14 out of 20



Which of the following is not a legal integer type value in Python

Option A. Decimal
Option B. Octal
Option C. Hexadecimal
Option D. Roman
True Answer D

Explanation :

Which of the following is not a legal integer type value in Python

Question No# : 15 out of 20

The identifiers in Python can be begin with an underscore.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

The identifiers in Python can be begin with an underscore.

Question No# : 16 out of 20

The default separator character of print() is ___

Option A. tab
Option B. space
Option C. newline
Option D. dot
True Answer B

Explanation :

The default separator character of print() is ___

Question No# : 17 out of 20

The output of the two codes shown below is the same.

i. bin((2**16)-1)

ii. '{}'.format(bin((2**16)-1))

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :
The output of both of the codes shown above is ‘0b1111111111111111’. Hence the statement is true.

The output of the two codes shown below is the same.

i. bin((2**16)-1)

ii. '{}'.format(bin((2**16)-1))

Question No# : 18 out of 20



Python is the fastest language.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer B

Explanation :

Python is the fastest language.

Question No# : 19 out of 20

What will be the output of the following Python code snippet?

print('ab cd-ef'.title())

Option A. Ab cd-ef
Option B. Ab Cd-ef
Option C. Ab Cd-Ef
Option D. None of the mentioned
True Answer C

Explanation :
The first letter of every word is capitalized. Special symbols terminate a word.

What will be the output of the following Python code snippet?

print('ab cd-ef'.title())

Question No# : 20 out of 20