Top 50+ Solved Python Programming MCQ Questions Answer

From 1 to 15 of 39

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

a. 4.5

b. 4.0

c. 4

d. Error

Q. Which function overloads the >> operator?

a. more()

b. gt()

c. ge()

d. rshift()

  • d. rshift()

Q. What is the output of the following program :i = 0while 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

  • c. 0 1 1 2 2 3

Q. Which module in Python supports regular expressions?

a. re

b. regex

c. pyregex

d. None of the above

  • a. re

Q. What is the output of the following program :

a. True

b. False

c. Machine dependent

d. Error

  • b. False

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

a. Lists

b. Dictionary

c. Tuples

d. Class

  • d. Class

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

a. 8

b. 16

c. Indentation Error

d. Runtime Error

  • c. Indentation Error

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

a. 27

b. 9

c. 3

d. 1

Q. 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

  • b. 0.33

Q. What is the output of the following program :print 'abcefd'.replace('cd', '12')

a. ab1ef2

b. abcefd

c. ab1efd

d. ab12ed2

  • b. abcefd

Q. What is the output of the following program?dictionary1 = {'GFG' : 1, 'Google' : 2, 'GFG' : 3 }print(dictionary1['GFG']);

a. Compilation error due to duplicate keys

b. Runtime time error due to duplicate keys

c. 3

d. 1

Subscribe Now

Get All Updates & News