Statement Flow Control in Python
MCQs – Class XI Computer Science (Flow of Control, Conditional & Iterative Statements)
MCQs (WITHOUT answers shown here)
1. Which of the following represents a sequential flow of control?
A. Executing statements one after another
B. Choosing between two alternatives
C. Repeating a set of statements
D. Jumping out of a loop
2. In Python, indentation is mainly used to:
A. Improve code speed
B. Indicate block of statements
C. Comment code
D. Import modules
3. Which of the following is a correct if statement?
A. if x > 10:
B. if (x > 10)
C. if x > 10
D. if x > 10 then:
4. What will be the output of the following code?
x = 5
if x < 10:
print("small")
print("done")
A. small
B. small
done
C. done
D. Error
5. Which of the following keywords is used for multi-branch selection?
A. else
B. elif
C. then
D. switch
6. A flowchart uses which symbol for decision-making?
A. Rectangle
B. Diamond
C. Oval
D. Parallelogram
7. Which statement terminates the current loop?
A. stop
B. exit
C. break
D. continue
8. Which statement skips the current iteration in a loop?
A. exit
B. pass
C. continue
D. break
9. What is the output?
for i in range(1, 5):
print(i, end=" ")
A. 1 2 3 4
B. 1 2 3 4 5
C. 0 1 2 3 4
D. 0 1 2 3
10. range(2, 10, 2) produces:
A. 2, 3, 4, 5, … , 10
B. 2, 4, 6, 8
C. 2, 4, 6, 8, 10
D. 2, 10
11. Which loop is best suited when the number of iterations is known?
A. while loop
B. for loop
C. do-while loop
D. switch loop
12. Which function is used to generate a sequence of integers?
A. seq()
B. series()
C. range()
D. list()
13. What is the output?
x = -7
if x < 0:
x = -x
print(x)
A. -7
B. 0
C. 7
D. Error
14. Output of the code:
a, b, c = 4, 9, 2
print(sorted([a, b, c])[0])
A. 2
B. 4
C. 9
D. Error
15. Which loop will never execute if the condition is false at the start?
A. for
B. while
C. Both A and B
D. None
16. Output of the code:
i = 1
while i < 4:
print(i)
i += 1
A. 1
B. 1 2 3
C. 1 2 3 4
D. Infinite loop
17. What is the result of range(5)?
A. 0,1,2,3,4
B. 1,2,3,4,5
C. 5 values from 1
D. Only 5
18. Output of factorial program snippet:
n = 4
f = 1
for i in range(1, n+1):
f *= i
print(f)
A. 4
B. 16
C. 24
D. Error
19. Which of the following represents an infinite loop?
A. for i in range(1,10):
B. while i < 5:
C. while True:
D. for i in range(0):
20. Output of:
for i in range(3):
for j in range(2):
print("*", end="")
print()
A.
* *
* *
* *
B.
*
*
*
C. ***
D. ******
21. Which statement is true about indentation?
A. Tabs and spaces can be mixed safely
B. Incorrect indentation only causes logical errors
C. Python uses indentation to define blocks
D. Indentation is optional
22. Output of:
x = 12
if x % 3 == 0:
print("div by 3")
else:
print("not div by 3")
A. div by 3
B. not div by 3
C. Error
D. None
23. Which of the following is NOT an iterative statement?
A. for
B. while
C. if
D. nested loops
24. Output of:
for i in range(1,4):
if i == 2:
continue
print(i, end=" ")
A. 1 2 3
B. 1 3
C. 2 3
D. 1 2
25. The statement if a > b and a > c: is used to:
A. Check smallest number
B. Find largest of three numbers
C. Check equality
D. Calculate sum
26. Output of:
sum = 0
for i in range(1, 5):
sum += i
print(sum)
A. 10
B. 15
C. 5
D. 20
27. Output-based question:
i = 1
while i <= 5:
print(i, end=" ")
if i == 3:
break
i += 1
A. 1 2 3 4 5
B. 1 2 3
C. 3
D. 1 2
28. Which of the following can be used to generate patterns?
A. Single loop only
B. Nested loops
C. Conditional statements only
D. break
29. What is the output?
for i in range(1, 4):
for j in range(i):
print(i, end="")
print()
A.
1
22
333
B.
1
12
123
C.
1
23
456
D. Error
30. Output of series summation:
s = 0
for i in range(2, 7, 2):
s += i
print(s)
A. 6
B. 12
C. 14
D. 18
✅ ANSWER KEY
1-A
2-B
3-A
4-B
5-B
6-B
7-C
8-C
9-A
10-B
11-B
12-C
13-C
14-A
15-C
16-B
17-A
18-C
19-C
20-A
21-C
22-A
23-C
24-B
25-B
26-A
27-B
28-B
29-A
30-B