Chapter 10: Flow of Control — Online MCQ Test
COMPUTER SCIENCE · CLASS 11th · Tamil Nadu State Board
Practice Chapter 10: Flow of Control with a free chapter-wise online MCQ test.
This chapter covers: Exploring control structures this chapter details decision-making statements and looping constructs in C++. Students master if-else switch statements for while and do-while loops t....
AI-generated questions from basic to board-exam level, with instant results and explanations.
Chapter 10: Flow of Control — Important Questions & Answers
Which statement is known as a selection statement in C++?
- A. if
- B. for
- C. while
- D. do-while
Answer: A. if
The 'if' statement is a decision-making or selection statement, whereas the others are iteration statements.
The 'if' statement is a decision-making or selection statement, whereas the others are iteration statements.
Which of the following is an entry-controlled loop?
- A. do-while
- B. while
- C. switch
- D. if-else
Answer: B. while
In a while loop, the condition is checked at the beginning before executing the loop body.
In a while loop, the condition is checked at the beginning before executing the loop body.
How many times does the body of a 'do-while' loop execute at minimum?
- A. Zero
- B. One
- C. Infinite
- D. Depends on the condition
Answer: B. One
Since the condition is checked after the body, the body of a do-while loop executes at least once regardless of the condition.
Since the condition is checked after the body, the body of a do-while loop executes at least once regardless of the condition.
Consider: if(x=10) cout << "Hi"; What happens if x was initially 5?
- A. Compilation error
- B. Nothing happens
- C. Hi is printed
- D. Program crashes
Answer: C. Hi is printed
The expression x=10 is an assignment returning 10, which evaluates to 'true' in C++, so 'Hi' is printed.
The expression x=10 is an assignment returning 10, which evaluates to 'true' in C++, so 'Hi' is printed.
Which of these expressions is invalid as a switch case label?
- A. 10
- B. 'A'
- C. x + 2 (where x is a constant)
- D. 5.5
Answer: D. 5.5
Switch case labels must be constant integral types (int, char, enum). Floating-point values are not allowed.
Switch case labels must be constant integral types (int, char, enum). Floating-point values are not allowed.