Python Basics (Multiple Choice Questions) MCQ – Python Interview objective questions| Python Quiz

11.  Mathematical operations can be performed on a string in Python? State whether true or false:

  1. False
  2. 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?

  1. List
  2. Dictionary
  3. Tuple
  4. 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?

  1. +
  2. ()
  3. /

Answer : B
Explanation: () has more precedence in python programming language.

14.  In which language is Python written?

  1. English
  2. PHP
  3. C
  4. 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?

  1. No
  2. 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?

  1. lowercase()
  2. capilaize()
  3. lower()
  4. 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?

  1. uppercase() method
  2. capitalize() method
  3. upper() method
  4. 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?

  1. uppercase()
  2. toUpper()
  3. capitalize()
  4. 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?

  1. print() method
  2. printable() method
  3. isprintable() method
  4. echo() method

Answer : C
Explanation: isprintable() method.

20. How to swap case in Python i.e. lowercase to uppercase and vice versa?

  1. casefold() method
  2. case() method
  3. convert() method
  4. swapcase() method

Answer : D
Explanation: swapcase().

This Post Has 2 Comments

Leave a Reply