Question Detail

BIO 107 While Loops & Control Flow Objective Question

Question

According to the 'When to use Break?' slide, which scenario is NOT typically associated with the primary use of a break statement?
Options
A A loop that needs to terminate based on a user typing a specific word.
B A loop that waits for a file to be present before continuing.
C A loop designed to run exactly 100 times.
Correct Answer
D A loop that requires a complex internal check to determine termination.
Correct Answer

Option C is the correct answer.

Detailed Explanation

The slide distinguishes between 'Normal Condition' (where the end is known, like running exactly 100 times) and 'Break Statement' usage (for unpredictable exits). A loop running a fixed number of times can typically be controlled by the loop condition itself, rather than needing an internal break.

Hint

The slide differentiates between predictable and unpredictable exit conditions.

Question Info