Question Detail

COS 102 6 lecture note; fundamentals of programming Objective Question

Question

What is the effect of the break statement in a loop in Python?
Options
A It skips the current iteration and continues with the next.
B It immediately terminates the execution of the loop.
Correct Answer
C It marks a placeholder for future code without any operation.
D It restarts the loop from the beginning.
Correct Answer

Option B is the correct answer.

Detailed Explanation

Page 94 defines break: 'Break can be used to unconditionally jump out of the loop. It terminates the execution of the loop.'

Hint

If you want to exit a loop early, this is the statement you'd use.

Question Info