Control Structures MCQs

13 MCQs  — Fundamental Programming MCQs  (Page 1 of 2)

Practice Control Structures MCQs with correct answers and explanations. These questions are from the Fundamental Programming MCQs section.

What happens when this C code runs? int i = 0; while (i < 5) { if (i == 2) continue; i++; }
The loop ends with i = 2
Compilation error
The loop ends with i = 5
Infinite loop
In C++ nested loops, what does break do?
It exits all enclosing loops
It skips to the next iteration of the outer loop
It exits the function
It exits only the innermost enclosing loop or switch