Vidyalelo
Python · all questions

Python Loops and Conditionals: MCQs for Exam Readiness
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

91

Questions

5/5

Page

Pick an option on a question to see the right answer and solution.

What will be the output of the following Python code?
x = "abcdef"
i = "a"
while i in x:
    print('i', end = " ")

Select an option to see the answer and solution.

What will be the output of the following Python code?
i = 2
while True:
    if i%3 == 0:
        break
    print(i)
    i += 2

Select an option to see the answer and solution.

What will be the output of the following Python code?
i = 1
while True:
    if i%2 == 0:
        break
    print(i)
    i += 2

Select an option to see the answer and solution.

What will be the output of the following Python code?
x = ['ab', 'cd']
for i in x:
    x.append(i.upper())
print(x)

Select an option to see the answer and solution.

What will be the output of the following Python code?
i = 5
while True:
    if i%0O9 == 0:
        break
    print(i)
    i += 1

Select an option to see the answer and solution.

What will be the output of the following Python code?
True = False
while True:
    print(True)
    break

Select an option to see the answer and solution.

What will be the output of the following Python code?
i = 1
while True:
    if i%3 == 0:
        break
    print(i)
 
    i + = 1

Select an option to see the answer and solution.

What will be the output of the following Python code?
i = 1
while False:
    if i%2 == 0:
        break
    print(i)
    i += 2

Select an option to see the answer and solution.

What will be the output of the following Python code?
i = 5
while True:
    if i%0O11 == 0:
        break
    print(i)
    i += 1

Select an option to see the answer and solution.

What will be the output of the following Python code?
x = ['ab', 'cd']
for i in x:
    i.upper()
print(x)

Select an option to see the answer and solution.

What will be the output of the following Python code?
i = 1
while True:
    if i%0O7 == 0:
        break
    print(i)
    i += 1

Select an option to see the answer and solution.