Multiple choice

The break statement causes an exit ______.

  1. only from the innermost loop

  2. only from the innermost switch

  3. from all loops and switches

  4. from the innermost loop or switch

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The break statement in C++ exits from the innermost loop or switch statement that contains it. It does not exit from all nested loops or switches simultaneously - only the immediately enclosing one. To exit from multiple levels, you would need multiple break statements or a different control structure like goto.