Python Programming (2180711) MCQs

MCQs of Introduction to Python

Showing 141 to 150 out of 170 Questions
141.
What will be the output of the following Python code snippet? x = 'abcd' for i in range(len(x)): x = 'a' print(x)
(a) a
(b) abcd abcd abcd
(c) a a a a
(d) none of the mentioned
Answer:

Option (c)

142.
What will be the output of the following Python code snippet? x = 'abcd' for i in range(len(x)): print(x) x = 'a'
(a) a
(b) abcd abcd abcd abcd
(c) a a a a
(d) none of the mentioned
Answer:

Option (d)

143.
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
Answer:

Option (c)

144.
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
Answer:

Option (a)

145.
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
Answer:

Option (d)

146.
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
Answer:

Option (c)

147.
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
Answer:

Option (b)

148.
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
Answer:

Option (b)

149.
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
Answer:

Option (d)

150.
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
Answer:

Option (c)

Showing 141 to 150 out of 170 Questions