Python Programming (2180711) MCQs

MCQs of Introduction to Python

Showing 121 to 130 out of 170 Questions
121.
What will be the output of the following Python code? i = 1 while False: if i%2 == 0: break print(i) i += 2
(a) 1
(b) 1 3 5 7 …
(c) 1 2 3 4 …
(d) none of the mentioned
Answer:

Option (d)

122.
What will be the output of the following Python code? True = False while True: print(True) break
(a) TRUE
(b) FALSE
(c) None
(d) none of the mentioned
Answer:

Option (d)

123.
What will be the output of the following Python code? i = 0 while i < 5: print(i) i += 1 if i == 3: break else: print(0)
(a) 0 1 2 0
(b) 0 1 2
(c) error
(d) none of the mentioned
Answer:

Option (b)

124.
What will be the output of the following Python code? i = 0 while i < 3: print(i) i += 1 else: print(0)
(a) 0 1 2 3 0
(b) 0 1 2 0
(c) 0 1 2
(d) error
Answer:

Option (b)

125.
What will be the output of the following Python code? x = ""abcdef"" while i in x: print(i, end="" "")
(a) a b c d e f
(b) abcdef
(c) i i i i i i …
(d) error
Answer:

Option (d)

126.
What will be the output of the following Python code? x = ""abcdef"" i = ""i"" while i in x: print(i, end="" "")
(a) no output
(b) i i i i i i …
(c) a b c d e f
(d) abcdef
Answer:

Option (a)

127.
What will be the output of the following Python code? x = ""abcdef"" i = ""a"" while i in x: print(i, end = "" "")
(a) no output
(b) i i i i i i …
(c) a a a a a a …
(d) a b c d e f
Answer:

Option (c)

128.
What will be the output of the following Python code? x = ""abcdef"" i = ""a"" while i in x: print('i', end = "" "")
(a) no output
(b) i i i i i i …
(c) a a a a a a …
(d) a b c d e f
Answer:

Option (b)

129.
What will be the output of the following Python code? x = ""abcdef"" i = ""a"" while i in x: x = x[:-1] print(i, end = "" "")
(a) i i i i i i
(b) a a a a a a
(c) a a a a a
(d) none of the mentioned
Answer:

Option (b)

130.
What will be the output of the following Python code? x = ""abcdef"" i = ""a"" while i in x[:-1]: print(i, end = "" "")
(a) a a a a a
(b) a a a a a a
(c) a a a a a a …
(d) a
Answer:

Option (c)

Showing 121 to 130 out of 170 Questions