Question

    What is the difference between do-while and while

    condition?
    A In do-while, a semicolon is used after the condition. Correct Answer Incorrect Answer
    B Semicolon is not used in While Correct Answer Incorrect Answer
    C While statement is after the condition Correct Answer Incorrect Answer
    D none of the above Correct Answer Incorrect Answer

    Solution

    The key difference lies in when the loop condition is checked. In the while loop, the condition is checked before the first iteration, potentially resulting in zero iterations. In the do-while loop, the condition is checked after the first iteration, ensuring that the loop body is executed at least once.

    Practice Next