LearnFrenzy
Sign in Take a free test

C Loops · Loops MCQ · Question 4

How many loops does break exit in nested loops? Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 4 Back to Exercise

break is executed inside the inner loop of two nested loops. What happens?

  • A Both loops end
  • B Only the inner loop ends; the outer loop continues Correct
  • C The program ends
  • D Only the outer loop ends
Correct Answer: Option B

break leaves the innermost enclosing loop or switch only. To leave both, use a flag, a return from a function, or a goto to a label after the loops.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links