Identifying bugs in C++ code
This medium-difficulty question asks you to spot a subtle but common pitfall in C++ that can silently cause incorrect behavior or crashes. It tests whether you understand the language's semantics deeply enough to catch mistakes that a casual read-through might miss.
Questions like this appear in technical interviews—especially at trading firms where code correctness is non-negotiable—because they reveal how carefully you reason about memory, scope, type safety, or undefined behavior. The skill is not just writing code that compiles, but writing code that does what you intend in all cases.
- Pointer and reference semantics
- Lifetime and scope rules
- Type conversions and implicit behavior
- Memory safety pitfalls