What is a unique characteristic of a do-while loop in programming?

2025

What is a unique characteristic of a do-while loop in programming?

  1. A.

    It behaves exactly like a while loop.

  2. B.

    It executes the loop body at least once before evaluating the condition.

  3. C.

    The loop may skip executing the body entirely.

  4. D.

    It checks the condition before executing the loop body.

Attempted by 95 students.

Show answer & explanation

Correct answer: B

A do-while loop is distinct from other iteration structures because it guarantees that the code block inside the loop will execute at least one time. This happens because the condition is evaluated only after the body has run, rather than before. In contrast, a standard while loop checks the condition first; if it is initially false, the body never executes.

Therefore, Option B correctly identifies this unique behavior where execution precedes evaluation.

Explore the full course: Rssb Senior Computer Instructor