94.0k views
0 votes
The statements in the body of a while loop may never be executed, whereas the statements in the body of a do-while loop will be executed a. at least once b. at least twice c. as many times as the user wishes d. Never e. None of these

User Nakiesha
by
5.0k points

1 Answer

3 votes

Answer:

a. at least once

Step-by-step explanation:

A loop is a code snippet that uses a condition to run repeatedly for multiple times which could be zero, one or more times. As long as the condition is true, the loop statement executes over and over again. Three common types of loop are;

i. for loop

ii. while loop

iii. do while loop

In a for or while loop, the condition for the loop is first tested before the statements in the loop are executed. Statements in the body of the loop are executed zero or more times. i.e the loop statement (statement in the body of the loop) may or may not be executed.

In a do..while loop, the statements in the loop are executed first before the condition of the loop is tested. In this case, the statements in the body of the loop are executed one or more times. i.e the loop statement is executed at least once.

User Brett Green
by
5.6k points