Question Detail

COS 102 test topic Objective Question

Question

What is the effect of encountering a `break` statement inside a nested loop?
Options
A It terminates all surrounding loops immediately
B It terminates only the innermost loop containing it
Correct Answer
C It halts program execution completely
D It skips the current iteration and resumes the next
Correct Answer

Option B is the correct answer.

Detailed Explanation

A standard break statement exits solely the nearest enclosing loop or switch construct.

Hint

No hint available

Question Info