QUESTION IMAGE
Question
in a ____, the loop body might never execute because the question controlling the loop might be false the first time it is asked.
loop control
pretest loop
summary report
posttest loop
question 27
the first step in a while loop is typically to ____.
initialize the loop control variable
compare the loop control variable to a constant value
execute the body of the loop
increment the loop control variable
Brief Explanations
- In a pretest loop (like a while loop in many programming languages), the condition is checked before the loop body executes. If the condition is false initially, the loop body never runs.
- The first step in a while loop is typically to initialize the loop - control variable. This sets up the starting point for the loop's operation. For example, if you have a loop that counts from 1 to 10, you first initialize a variable (say
i = 1). Then you compare (in the while condition), execute the loop body, and increment. But the very first step is initialization.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
- B. pretest loop
- A. initialize the loop control variable