31. What will be the output of the following Python code?
x = 123
for i in x:
print(i)
a) 1 2 3
b) 123
c) error
d) none of the mentioned
32. What will be the output of the following Python code?
d = {0: ‘a’, 1: ‘b’, 2: ‘c’}
for i in d:
print(i)
a) 0 1 2
b) a b c
c) 0 a 1 b 2 c
d) none of the mentioned
33. What will be the output of the following Python code?
d = {0: ‘a’, 1: ‘b’, 2: ‘c’}
for x, y in d:
print(x, y)
a) 0 1 2
b) a b c
c) 0 a 1 b 2 c
d) none of the mentioned
34. What will be the output of the following Python code?
d = {0: ‘a’, 1: ‘b’, 2: ‘c’}
for x, y in d.items():
print(x, y)
a) 0 1 2
b) a b c
c) 0 a 1 b 2 c
d) none of the mentioned
35. What will be the output of the following Python code?
d = {0: ‘a’, 1: ‘b’, 2: ‘c’}
for x in d.keys():
print(d[x])
a) 0 1 2
b) a b c
c) 0 a 1 b 2 c
d) none of the mentioned
36. What will be the output of the following Python code?
d = {0: ‘a’, 1: ‘b’, 2: ‘c’}
for x in d.values():
print(x)
a) 0 1 2
b) a b c
c) 0 a 1 b 2 c
d) none of the mentioned
37. What will be the output of the following Python code?
d = {0: ‘a’, 1: ‘b’, 2: ‘c’}
for x in d.values():
print(d[x])
a) 0 1 2
b) a b c
c) 0 a 1 b 2 c
d) none of the mentioned
38. What will be the output of the following Python code?
d = {0, 1, 2}
for x in d.values():
print(x)
a) 0 1 2
b) None None None
c) error
d) none of the mentioned
39. What will be the output of the following Python code?
d = {0, 1, 2}
for x in d:
print(x)
a) 0 1 2
b) {0, 1, 2} {0, 1, 2} {0, 1, 2}
c) error
d) none of the mentioned
40. What will be the output of the following Python code?
d = {0, 1, 2}
for x in d:
print(d.add(x))
a) 0 1 2
b) 0 1 2 0 1 2 0 1 2 …
c) None None None
d) None of the mentioned
Page 1 2 3 4 5 6
Python Interview Questions (MCQs)
We have divided these Python Questions and Answers into various parts based on the topics. Open the Topic of your choice and Practice these MCQs.