Python MCQs with answers Page - 11

Here, you will find a collection of MCQ questions on Python. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 831.35K Points
Coach

Q. Which of the following is not a valid set operation in python?

  • (A) Union
  • (B) Intersection
  • (C) Difference
  • (D) None of the above

A

Admin • 831.35K Points
Coach

Q. What will be the output of the following code snippet?

Code:
a = [1, 2, 3, 4]
b = [3, 4, 5, 6]
c = [x for x in a if x not in b]
print(c)
  • (A) [1, 2]
  • (B) [5, 6]
  • (C) [1, 2, 5, 6]
  • (D) [3, 4]

A

Admin • 831.35K Points
Coach

Q. Which of the following are valid escape sequences in Python?

  • (A)
  • (B)
  • (C) \
  • (D) All of the above

A

Admin • 831.35K Points
Coach

Q. Which of the following are valid string manipulation functions in Python?

  • (A) count()
  • (B) upper()
  • (C) strip()
  • (D) All of the above

A

Admin • 831.35K Points
Coach

Q. Which of the following modules need to be imported to handle date time computations in Python?

  • (A) datetime
  • (B) date
  • (C) time
  • (D) timedate

A

Admin • 831.35K Points
Coach

Q. In which language is Python written?

  • (A) C++
  • (B) C
  • (C) Java
  • (D) None of these

A

Admin • 831.35K Points
Coach

Q. How can assertions be disabled in Python?

  • (A) Passing -O when running Python.
  • (B) Assertions are disabled by default.
  • (C) Both A and B are wrong.
  • (D) Assertions cannot be disabled in Python.

A

Admin • 831.35K Points
Coach

Q. What will be the result of the following expression in Python “2 ** 3 + 5 ** 2”?

  • (A) 65536
  • (B) 33
  • (C) 169
  • (D) None of these

A

Admin • 831.35K Points
Coach

Q. Which of the following statements is used to create an empty set in Python?

  • (A) ( )
  • (B) [ ]
  • (C) { }
  • (D) set()

A

Admin • 831.35K Points
Coach

Q. What arithmetic operators cannot be used with strings in Python?

  • (A) *
  • (B) -
  • (C) +
  • (D) All of the above