Question Detail

COS 102 6 lecture note; fundamentals of programming Objective Question

Question

What is the primary effect of the `break` statement when executed inside a loop in Python?
Options
A It skips only the current iteration of the loop and proceeds to the next one.
B It terminates the entire loop immediately and transfers control to the statement directly following the loop.
Correct Answer
C It temporarily pauses the loop's execution for a short period before automatically resuming.
D It signals an error if the loop has not completed at least one full iteration.
Correct Answer

Option B is the correct answer.

Detailed Explanation

Page 94 of the document states: "Break can be used to unconditionally jump out of the loop. It terminates the execution of the loop."

Hint

Think of `break` as a way to make an early exit from a loop, regardless of the loop's condition.

Question Info