Asked by Bella Carranza on Jun 24, 2024
Verified
Which of the following is true about a while loop?
A) The body of the loop is executed at least once.
B) The logical expression controlling the loop is evaluated before the loop is entered and after the loop exists.
C) The body of the loop may not execute at all.
D) It is a post-test loop
Post-test Loop
A loop that performs its body's actions at least once before testing a condition at the end of each iteration, typically implemented with a "do-while" loop.
Logical Expression
An expression that represents a condition and evaluates to either true or false.
- Identify the differences between pre-test loops and post-test loops.
Verified Answer
GG
GodAura GamingJun 29, 2024
Final Answer :
C
Explanation :
The while loop is a pre-test loop, meaning the condition is checked before the loop body is executed. This allows for the possibility that the loop body may not execute at all if the condition is false from the beginning.
Learning Objectives
- Identify the differences between pre-test loops and post-test loops.