Skip to content
Sharp

Core Java · interview question

Why does an accumulator variable in a loop matter in practice?

Multiple choiceEasychapter-1-curatedpremiumcore-javaloops-and-iteration
Choose one answer
Answer and explanation

Correct answer

C. To sum values over iterations

Why

An accumulator variable aggregates a value across multiple iterations of a loop, such as summing elements of an array. It starts with an initial value and updates with each iteration.

Test yourself on Core Java

A free test with instant, explained results. No account needed.

Start free test
All Core Java questions →