What this C++ pointer and reference question tests
This is an easy C++ question designed to assess whether you can read and reason about pointer and reference semantics in a concrete code snippet. It's the kind of warm-up question that firms ask early in technical interviews to establish baseline competency before moving to more complex problems.
To answer correctly, you need to trace through variable declarations, understand how pointers and references bind to objects, and predict what gets printed. The question rewards careful reading of syntax and clarity about the difference between a pointer, the object it points to, and a reference to an object.
- Pointer declaration and dereferencing
- Reference binding and aliasing
- Address-of and dereference operators
- Output stream behavior with different types