What this C++ code-tracing question tests
This is an easy code-tracing question that checks your familiarity with core C++ language semantics. It rewards careful reading of the code as written, not what you might expect it to do. Firms use questions like this early in technical interviews to establish a baseline: can you predict program behaviour reliably?
The skill here is precise mental execution—stepping through variable declarations, scope, and side effects without running the code. Even simple-looking snippets often contain subtle language features that trip up candidates who rely on intuition rather than the actual rules.
- Variable scope and lifetime
- Order of operations and evaluation
- Type conversions and default behaviour