Question Detail

BIO 107 While Loops & Control Flow Objective Question

Question

According to the 'The Infinite Loop' slide, what is the usual cause of an infinite loop?
Options
A The <code>while</code> condition is always <code>False</code>.
B Forgetting to define the loop variable before the loop.
C Forgetting to update the variable inside the loop that controls the condition.
Correct Answer
D Using a <code>break</code> statement incorrectly.
Correct Answer

Option C is the correct answer.

Detailed Explanation

Page 7 states, 'This usually happens if you forget to update your variable inside the loop.' Without an update, the condition may never change to False, causing the loop to run indefinitely.

Hint

An infinite loop means the condition *never* becomes false. How does a condition typically change its truth value over time?

Question Info