What this C++ code-reading question tests
This is an easy C++ question that asks you to trace through a short code snippet and predict its output. It is a fast, low-stakes way for interviewers to check whether you have solid mental clarity around C++ semantics—specifically, how the language handles certain operators, type conversions, or control flow that may behave differently than in other languages.
Questions like this appear early in interviews to establish baseline competency before moving to algorithm or design problems. They reward careful reading and a willingness to reason through edge cases rather than guessing. Many candidates make mistakes because they rely on intuition from Python or Java rather than checking C++ semantics explicitly.
- Operator precedence and associativity
- Type promotion and implicit conversion
- Scope and variable shadowing
- Statement vs. expression evaluation