Question Detail

COS 102 6 lecture note; fundamentals of programming Objective Question

Question

Consider the Python code snippet from slide 11: count = 0 while count >= 10: count += 1 print(count) What is the expected output?
Options
A 0
B 11
C Error
D None of the above
Correct Answer
Correct Answer

Option D is the correct answer.

Detailed Explanation

The while loop condition is count >= 10. Initially, count is 0. Since 0 is not greater than or equal to 10, the loop condition is false from the start. The loop body will never execute, and therefore nothing will be printed. 'None of the above' is the correct choice as it implies no output or a different output than the given options.

Hint

Pay close attention to the initial value of 'count' and the loop condition. Will the loop ever start?

Question Info