Python MCQs with answers Page - 27

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 • 832.27K Points
Coach

Q. In Python, the primary use of the tell() method is that

  • (A) within the file, it tells the end position
  • (B) within the file, it tells the current position
  • (C) it tells us if the file is opened
  • (D) none of the above

A

Admin • 832.27K Points
Coach

Q. Which of these in not a core data type?

  • (A) Lists
  • (B) Dictionary
  • (C) Tuples
  • (D) Class

A

Admin • 832.27K Points
Coach

Q. Which of the following will run without errors?

  • (A) round(45.8)
  • (B) round(6352.898,2,5)
  • (C) round()
  • (D) round(7463.123,2,1)

A

Admin • 832.27K Points
Coach

Q. What is the return type of function id?

  • (A) int
  • (B) float
  • (C) bool
  • (D) dict

A

Admin • 832.27K Points
Coach

Q. What error occurs when you execute the following Python code snippet?

Code:
apple = mango
  • (A) SyntaxError
  • (B) ValueError
  • (C) NameError
  • (D) TypeError

A

Admin • 832.27K Points
Coach

Q. In order to store values in terms of key and value we use what core data type.

  • (A) list
  • (B) tuple
  • (C) class
  • (D) dictionary

A

Admin • 832.27K Points
Coach

Q. What is the average value of the following Python code snippet?

Code:
>>>grade1 = 80
>>>grade2 = 90
>>>average = (grade1 + grade2) / 2
  • (A) 85.0
  • (B) 85.1
  • (C) 95.0
  • (D) 95.1

A

Admin • 832.27K Points
Coach

Q. Select all options that print.

Code:
hello-how-are-you
  • (A) print(‘hello’, ‘how’, ‘are’, ‘you’)
  • (B) print(‘hello’, ‘how’, ‘are’, ‘you’ + ‘-‘ * 4)
  • (C) print(‘hello-‘ + ‘how-are-you’)
  • (D) print(‘hello’ + ‘-‘ + ‘how’ + ‘-‘ + ‘are’ + ‘you’)

A

Admin • 832.27K Points
Coach

Q. What is the return value of trunc()?

  • (A) int
  • (B) bool
  • (C) float
  • (D) None

A

Admin • 832.27K Points
Coach

Q. Predict the output

Code:
List = [True, 50, 10] List.insert(2, 5) print(List, "Sum is: ", sum(List))
  • (A) [True, 50, 10, 5] Sum is: 66
  • (B) [True, 50, 5, 10] Sum is: 65
  • (C) [True, 50, 5, 10] Sum is: 66
  • (D) TypeError: unsupported operand type(s) for +: ‘int’ and ‘str’

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