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. What is the output of the following program :
i = 0
while i < 3:
print i
print i+1
β
Correct Answer: (C)
0 1 1 2 2 3
Q. What is the output of the following program : print 0.1 + 0.2 == 0.3
β
Correct Answer: (B)
False
Explanation: Neither of 0.1, 0.2 and 0.3 can be represented accurately in binary. The
round off errors from 0.1 and 0.2 accumulate and hence there is a difference of 5.5511e-17
between (0.1 + 0.2) and 0.3.
Q. What data type is the object below? L = [1, 23, „helloβ, 1]
β
Correct Answer: (A)
List
Q. What is the output of the following program :
def myfunc(a):
a = a + 2
a = a * 2
return a
print myfunc(2)
β
Correct Answer: (C)
Indentation Error
Q. What is the output of the following program : print '{0:.2}'.format(1.0 / 3)
β
Correct Answer: (B)
0.33
Jump to