The do loop differs from the while loop in that a. the while loop will always ex
ID: 3793374 • Letter: T
Question
The do loop differs from the while loop in that
a. the while loop will always execute the body of the loop at least once
b. the do loop will always execute the body of the loop at least once
c. the do loop will continue to loop while condition in the while statement is false and the while loop will continue to loop while the condition in the while statement is true
d. the while loop will continue to loop while condition in the while statement is false and the do loop will continue to loop while the condition in the while statement is true
e. none of the above, there is absolutely no difference between the two types of loops
a. the while loop will always execute the body of the loop at least once
b. the do loop will always execute the body of the loop at least once
c. the do loop will continue to loop while condition in the while statement is false and the while loop will continue to loop while the condition in the while statement is true
d. the while loop will continue to loop while condition in the while statement is false and the do loop will continue to loop while the condition in the while statement is true
e. none of the above, there is absolutely no difference between the two types of loops
Explanation / Answer
Answer is b.
do loop structure is as shown below
do{
}while()
So it executes the block atleast once and then checks the condition
Hence, the do loop will always execute the body of the loop at least once
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.