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
Explanation: Even keywords are considered as valid identifiers.
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
Explanation: There are no uppercase letters.
3. What will be the output of the following Python code snippet?
print('a@ 1,'.islower())
a) True
b) False
c) None
d) Error
View Answer
Explanation: There are no uppercase letters.
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
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
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
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
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
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
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
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.
- Get Free Certificate of Merit in Python Programming
- Participate in Python Programming Certification Contest
- Become a Top Ranker in Python Programming
- Take Python Programming Tests
- Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Apply for Programming Internship
- Practice Programming MCQs
- Buy Python Books
- Apply for Python Internship
- Buy Information Technology Books