Chapter 6: Control Structures — Online MCQ Test
COMPUTER SCIENCE · CLASS 12th · Tamil Nadu State Board
Practice Chapter 6: Control Structures with a free chapter-wise online MCQ test.
This chapter covers: This chapter examines program flow control mechanisms in Python. It covers sequential conditional branching statements like if else and iterative loop structures including for and....
AI-generated questions from basic to board-exam level, with instant results and explanations.
Chapter 6: Control Structures — Important Questions & Answers
Which statement is used to make a decision in Python?
- A. if
- B. for
- C. while
- D. break
Answer: A. if
The if statement is used for conditional decision-making in Python.
The if statement is used for conditional decision-making in Python.
Which loop is best suited for repeating a block of code a known number of times?
- A. if
- B. for
- C. break
- D. pass
Answer: B. for
A for loop is generally used when the number of iterations is known in advance.
A for loop is generally used when the number of iterations is known in advance.
What will be the output of the following code? x = 5 if x > 3: print('Yes') else: print('No')
- A. No
- B. Yes
- C. 5
- D. Error
Answer: B. Yes
Since x is greater than 3, the if block executes and prints Yes.
Since x is greater than 3, the if block executes and prints Yes.
What is the output of the following code? for i in range(5): if i == 3: break print(i, end=' ')
- A. 0 1 2
- B. 0 1 2 3
- C. 1 2 3
- D. 0 1 2 3 4
Answer: A. 0 1 2
The loop stops when i becomes 3, so only 0, 1, and 2 are printed.
The loop stops when i becomes 3, so only 0, 1, and 2 are printed.
Which of the following best explains the difference between break and continue?
- A. break exits the loop, continue skips only the current iteration
- B. break skips only the current iteration, continue exits the loop
- C. Both always terminate the program
- D. Both are used only with if statements
Answer: A. break exits the loop, continue skips only the current iteration
Break stops the loop completely, while continue moves to the next iteration without ending the loop.
Break stops the loop completely, while continue moves to the next iteration without ending the loop.