What this C++ code-review question tests
This is an easy multiple-choice question that assesses your ability to spot common pitfalls in C++ loops and control flow. It's the kind of question quant firms ask to verify that candidates have solid foundational knowledge of language semantics—the kind of mistake that, if left unnoticed, can introduce subtle bugs into production code.
To answer correctly, you'll need to trace through the code mentally, paying close attention to loop conditions, variable scope, and how control-flow statements like break, continue, and return interact with loops. The question rewards precision and familiarity with C++ reference behavior.
- Loop termination and iteration order
- Scope and variable lifetime
- Early exit and flow control