Question Detail

BIO 107 While Loops & Control Flow Objective Question

Question

What are the three essential components for a while loop to function correctly and avoid infinite loops, as described in the 'Anatomy of a While Loop' slide?
Options
A <code>if</code>, <code>else</code>, <code>elif</code>
B <code>while</code> keyword, <code>condition</code>, <code>update</code>
Correct Answer
C <code>start</code>, <code>process</code>, <code>end</code>
D <code>input</code>, <code>output</code>, <code>decision</code>
Correct Answer

Option B is the correct answer.

Detailed Explanation

Page 4 explicitly lists 'while: The keyword to start.', 'Condition: Must be True to run.', and '+ Update: Essential to prevent infinite loops!' as the three critical components.

Hint

Look for the bullet points describing the parts of a while loop on page 4.

Question Info