Python MCQs with answers Page - 1

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

Q. What is the output of the following code :

Code:
print 9//2
  • (A) 4.5
  • (B) 4.0
  • (C) 4
  • (D) Error

A

Admin • 799.53K Points
Coach

Q. Which function overloads the >> operator?

  • (A) more()
  • (B) gt()
  • (C) ge()
  • (D) rshift()

A

Admin • 799.53K Points
Coach

Q. What is the output of the following program :

Code:
i = 0
while i < 3:
print i
print i+1
  • (A) 0 2 1 3 2 4
  • (B) 0 1 2 3 4 5
  • (C) 0 1 1 2 2 3
  • (D) 1 0 2 4 3 5

A

Admin • 799.53K Points
Coach

Q. Which module in Python supports regular expressions?

  • (A) re
  • (B) regex
  • (C) pyregex
  • (D) None of the above

A

Admin • 799.53K Points
Coach

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

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

A

Admin • 799.53K Points
Coach

Q. What data type is the object below?
L = [1, 23, „hello?, 1]

  • (A) List
  • (B) Dictionary
  • (C) Tuple
  • (D) Array

A

Admin • 799.53K Points
Coach

Q. What is the output of the following program :

Code:
def myfunc(a):
a = a + 2
a = a * 2
return a
print myfunc(2)
  • (A) 8
  • (B) 16
  • (C) Indentation Error
  • (D) Runtime Error

A

Admin • 799.53K Points
Coach

Q. What is the output of the expression : 3*1**3

  • (A) 27
  • (B) 9
  • (C) 3
  • (D) 1

A

Admin • 799.53K Points
Coach

Q. What is the output of the following program :

Code:
i = 0
while i < 5:
    print(i)
    i += 1
    if i == 3:
        break
else:
    print(0)
  • (A) 0 1 2 0
  • (B) 0 1 2
  • (C) Error
  • (D) None of the above

A

Admin • 799.53K Points
Coach

Q. What will be displayed by the following code?

Code:

def f(value, values): 
    v = 1
    values[0] = 44
t = 3
v = [1, 2, 3] 
f(t, v) 
print(t, v[0]) 
  • (A) 1 1
  • (B) 1 44
  • (C) 3 1
  • (D) 3 44

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