Python MCQ – String – 10

This set of Python Multiple Choice Questions & Answers (MCQs) focuses on “Strings – 10”.

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

print('for'.isidentifier())

a) True
b) False
c) None
d) Error
View Answer

Answer: a
Explanation: Even keywords are considered as valid identifiers.
advertisement
advertisement

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

print('abc'.islower())

a) True
b) False
c) None
d) Error
View Answer

Answer: a
Explanation: There are no uppercase letters.
Note: Join free Sanfoundry classes at Telegram or Youtube

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

advertisement
print('a@ 1,'.islower())

a) True
b) False
c) None
d) Error
View Answer

Answer: a
Explanation: There are no uppercase letters.
advertisement

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

print('11'.isnumeric())

a) True
b) False
c) None
d) Error
View Answer

Answer: a
Explanation: All the character are numeric.

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

print('1.1'.isnumeric())

a) True
b) False
c) None
d) Error
View Answer

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

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

print('1@ a'.isprintable())

a) True
b) False
c) None
d) Error
View Answer

Answer: a
Explanation: All those characters are printable.

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

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

a) True
b) False
c) None
d) Error
View Answer

Answer: b
Explanation: None.

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

print('\t'.isspace())

a) True
b) False
c) None
d) Error
View Answer

Answer: a
Explanation: Tab Spaces are considered as spaces.

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

print('HelloWorld'.istitle())

a) True
b) False
c) None
d) Error
View Answer

Answer: b
Explanation: The letter W is uppercased.

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

print('Hello World'.istitle())

a) True
b) False
c) None
d) Error
View Answer

Answer: a
Explanation: It is in title form.

Sanfoundry Global Education & Learning Series – Python.

To practice all test questions on Python, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.