Python Programming (2180711) MCQs

MCQs of Introduction to Python

Showing 131 to 140 out of 170 Questions
131.
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) a a a a a a
(b) a
(c) no output
(d) error
Answer:

Option (b)

132.
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 a
(b) a
(c) no output
(d) error
Answer:

Option (c)

133.
What will be the output of the following Python code? x = 'abcd' for i in x: print(i) x.upper()
(a) a B C D
(b) a b c d
(c) A B C D
(d) error
Answer:

Option (b)

134.
What will be the output of the following Python code? x = 'abcd' for i in x: print(i.upper())
(a) a b c d
(b) A B C D
(c) a B C D
(d) error
Answer:

Option (b)

135.
What will be the output of the following Python code? x = 'abcd' for i in range(x): print(i)
(a) a b c d
(b) 0 1 2 3
(c) error
(d) none of the mentioned
Answer:

Option (c)

136.
What will be the output of the following Python code? x = 'abcd' for i in range(len(x)): print(i)
(a) a b c d
(b) 0 1 2 3
(c) error
(d) 1 2 3 4
Answer:

Option (b)

137.
What will be the output of the following Python code? x = 'abcd' for i in range(len(x)): print(i.upper())
(a) a b c d
(b) 0 1 2 3
(c) error
(d) 1 2 3 4
Answer:

Option (c)

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

Option (c)

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

Option (a)

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

Option (c)

Showing 131 to 140 out of 170 Questions