Question Detail

BIO 107 While Loops & Control Flow Objective Question

Question

In the counting example from Slide 5, what is the value of the count variable immediately *after* the loop has finished executing?
Options
A 1
B 5
C 6
Correct Answer
D 0
Correct Answer

Option C is the correct answer.

Detailed Explanation

The loop continues as long as count is 5 or less. After printing 5, count becomes 6. At this point, 6 ≤ 5 is False, and the loop terminates. So, count is 6 after the loop.

Hint

The loop condition is checked *before* each iteration. When does the condition become false?

Question Info