Home / Engineering / Python Programming MCQs / Page 1

Python Programming MCQs | Page - 1

Dear candidates you will find MCQ questions of Python Programming here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.

Q. 1) What is the output of the following code : print 9//2

(A) 4.5
(B) 4.0
(C) 4
(D) Error
View Answer Discuss Share

Q. 2) Which function overloads the >> operator?

(A) more()
(B) gt()
(C) ge()
(D) rshift()
View Answer Discuss Share

Q. 3) What is the output of the following program :
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
View Answer Discuss Share

Q. 4) Which module in Python supports regular expressions?

(A) re
(B) regex
(C) pyregex
(D) None of the above
View Answer Discuss Share

Q. 5) What is the output of the following program : print 0.1 + 0.2 == 0.3

(A) True
(B) False
(C) Machine dependent
(D) Error
View Answer Discuss Share

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

(A) Lists
(B) Dictionary
(C) Tuples
(D) Class
View Answer Discuss Share

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

(A) List
(B) Dictionary
(C) Tuple
(D) Array
View Answer Discuss Share

Q. 8) What is the output of the following program :
def myfunc(a):
a = a + 2
a = a * 2
return a
print myfunc(2)

(A) 8
(B) 16
(C) Indentation Error
(D) Runtime Error
View Answer Discuss Share

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

(A) 27
(B) 9
(C) 3
(D) 1
View Answer Discuss Share

Q. 10) What is the output of the following program : print '{0:.2}'.format(1.0 / 3)

(A) 0.333333
(B) 0.33
(C) 0.333333:-2
(D) Error
View Answer Discuss Share