Python MCQs with answers Page - 153

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. What is the output of the following code?

Code:
print(5 // 2)
  • (A) 2.5
  • (B) 2
  • (C) 3
  • (D) Error

A

Admin • 831.35K Points
Coach

Q. Which of these is used to define a single-line comment in Python?

  • (A) //
  • (B) /* */
  • (C) #
  • (D) <!-- -->

A

Admin • 831.35K Points
Coach

Q. What is the output of the following code?

Code:
print(len({'a':1,'b':2,'c':3}))
  • (A) 3
  • (B) 6
  • (C) 2
  • (D) Error

A

Admin • 831.35K Points
Coach

Q. Which function is used to find the absolute value of a number in Python?

  • (A) absolute()
  • (B) fabs()
  • (C) abs()
  • (D) mod()

A

Admin • 831.35K Points
Coach

Q. What is the output of the following code?

Code:
print(type(True))
  • (A) <class 'int'>
  • (B) <class 'bool'>
  • (C) <class 'str'>
  • (D) <class 'float'>

A

Admin • 831.35K Points
Coach

Q. Which operator is used to compare both value and data type in Python?

  • (A) ==
  • (B) ===
  • (C) is
  • (D) !=

A

Admin • 831.35K Points
Coach

Q. What is the output of the following code?

Code:
print(list('123'))
  • (A) ['1','2','3']
  • (B) [123]
  • (C) [1,2,3]
  • (D) Error

A

Admin • 831.35K Points
Coach

Q. What is the output of the following code?

Code:
x = {1,2,3,3,2}
print(x)
  • (A) {1, 2, 3}
  • (B) {1, 2, 3, 3, 2}
  • (C) [1,2,3]
  • (D) Error

A

Admin • 831.35K Points
Coach

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

Code:
print(2 ** 3 ** 2)
  • (A) 64
  • (B) 512
  • (C) 16
  • (D) Error

A

Admin • 831.35K Points
Coach

Q. Which built-in function returns the data type of an object?

  • (A) typeof()
  • (B) type()
  • (C) class()
  • (D) dtype()

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ