QUESTION IMAGE
Question
use a counter or a(n) ___ to control a loops repetitions.
sentinel value
end value
end statement
sentinel variable
question 35
a(n) ___ is very similar to a counter that you use to count loop iterations, except that you usually add a value other than one to this type of variable.
total
accumulator
transaction
validator
Brief Explanations
- In programming, a sentinel value is used to control loop repetitions. It acts as a signal to stop the loop. For example, in a loop that reads user input until a specific value (the sentinel) is entered.
- An accumulator is similar to a counter. While a counter typically increments by 1 each iteration (to count the number of loop runs), an accumulator can add a value other than 1 (e.g., summing up a series of numbers entered by the user in a loop).
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
- A. sentinel value
- B. accumulator