Python MCQs on String: SET 10

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

print(‘for’.isidentifier())

a) True

b) False

c) None

d) Error

Check Answer

Answer: a
Even keywords are considered as valid identifiers.

 

 

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

print(‘abc’.islower())

a) True

b) False

c) None

d) Error

Check Answer
Answer: a
There are no uppercase letters.

 

 

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

print(‘[email protected] 1,’.islower())

a) True

b) False

c) None

d) Error

Check Answer

Answer: a
There are no uppercase letters.

 

 

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

print(’11’.isnumeric())

a) True

b) False

c) None

d) Error

Check Answer

Answer: a
All the character are numeric.

 

 

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

print(‘1.1’.isnumeric())

a) True

b) False

c) None

d) Error

Check Answer

Answer: b
The character . is not a numeric character.

 

 

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

print(‘[email protected] a’.isprintable())

a) True

b) False

c) None

d) Error

Check Answer

Answer: a
All those characters are printable.

 

 

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

print(”””.isspace())

a) True

b) False

c) None

d) Error

Check Answer

Answer: b
None.

 

 

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

print(‘\t’.isspace())

a) True

b) False

c) None

d) Error

Check Answer

Answer: a
Tab Spaces are considered as spaces.

 

 

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

print(‘HelloWorld’.istitle())

a) True

b) False

c) None

d) Error

Check Answer
Answer: b
The letter W is uppercased.

 

 

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

print(‘Hello World’.istitle())

a) True

b) False

c) None

d) Error

Check Answer
Answer: a
It is in title form.

Pages  1  2  3  4  5  6  7  8  9  10  11  12  13

 

 

 

 

 

Leave a Comment