Which variable is commonly used to count how many array elements satisfy a condition?
Explanation
The count pattern starts a counter at 0 before the traversal, increments it inside an if, and returns it after the loop. Because a later element could still match, the finished count is known only after every value has been visited.
- A is not correct: An accumulator adds the element values themselves to a running total, which measures how much the array holds rather than how many elements matched.
- C is not correct: A Boolean flag records only whether a match exists at all, so it cannot distinguish one matching element from many of them.
- D is not correct: The index variable tracks which position the traversal is visiting, and it advances on every iteration whether or not the element matches.