Question Detail

COS 102 6 lecture note; fundamentals of programming Objective Question

Question

When a `continue` statement is encountered within a loop in Python, what typically happens?
Options
A The program immediately exits, regardless of any outer loops or code.
B The loop terminates completely, and the program continues from the statement after the loop.
C The remaining statements in the current iteration of the loop are skipped, and control immediately moves to the beginning of the next iteration.
Correct Answer
D The loop pauses its execution until a specific external event occurs.
Correct Answer

Option C is the correct answer.

Detailed Explanation

Page 97 of the document explains: "The continue statement... rejects all the remaining statements in the current iteration of the loop and moves the control back to the top of the loop."

Hint

Consider `continue` as a way to skip ahead in a loop without stopping the loop entirely.

Question Info