11. Mathematical operations can be performed on a string in Python? State whether true or false:
- False
- True
Answer : A Explanation: We can’t perform mathematical operations on the string even if the string is in the form: ‘1234…’.
12. . Which one of the following is not a python’s predefined data type?
- List
- Dictionary
- Tuple
- Class
Answer : D Explanation: Class is not a python’s predefined data type. But we can create classes on our own.
13. . Which of the following has more precedence?
- +
- ()
- /
- –
Answer : B Explanation: () has more precedence in python programming language.
14. In which language is Python written?
- English
- PHP
- C
- All of the above
Answer : C Explanation: Python is written in the C programming language, and it is also called CPython.
15. Do we need to compile a program before execution in Python?
- No
- Yes
Answer : A Explanation: We don’t need to compile a program before execution in Python.
16. How to convert the uppercase letters in the string to lowercase in Python?
- lowercase()
- capilaize()
- lower()
- toLower()
Answer : C Explanation: lower() function is used to convert string into lower case in python.
17. How to capitalize only the first letter of a sentence in Python?
- uppercase() method
- capitalize() method
- upper() method
- None of the above
Answer : B Explanation: capitalize() method is used to capitalize only the first letter of a sentence in Python.
18. How to convert the lowercase letters in the string to uppercase in Python?
- uppercase()
- toUpper()
- capitalize()
- upper()
Answer : D Explanation: upper() function is used to convert the lowercase letters in the string to uppercase in Python.
19. How to check whether all the characters in a string is printable?
- print() method
- printable() method
- isprintable() method
- echo() method
Answer : C Explanation: isprintable() method.
20. How to swap case in Python i.e. lowercase to uppercase and vice versa?
- casefold() method
- case() method
- convert() method
- swapcase() method
Answer : D Explanation: swapcase().
Pingback: Python Variables and Data Types (Multiple Choice Questions) MCQ - Python Interview objective questions| Python Quiz - cozmocard
Pingback: Machine Learning MCQ Questions And Answers - cozmocard