Question Detail

BIO 107 While Loops & Control Flow Objective Question

Question

According to the document, when is the break statement particularly useful compared to a 'Normal Condition' loop exit?
Options
A When you know exactly how many times the loop should run.
B When the loop's exit condition depends on a numerical count.
C When the exit condition depends on something unpredictable, like user input.
Correct Answer
D When the loop needs to repeat a fixed number of times.
Correct Answer

Option C is the correct answer.

Detailed Explanation

Page 10 clarifies that the 'Break Statement' is used 'when the exit condition depends on something unpredictable, like user input or a complex check inside,' distinguishing it from 'Normal Condition' where the exit is based on a known number or clear status.

Hint

Consider situations where the loop's duration isn't known beforehand.

Question Info