Understanding C++ namespace scope and visibility in quant code
This is a hard C++ question that tests your grasp of namespace resolution, name hiding, and the order in which the compiler resolves symbols across different scopes. Quant firms use questions like this to confirm you can read and predict the behaviour of real production code without running it—a critical skill when debugging latency-sensitive systems.
The question asks you to trace through a code snippet and determine its output, which requires understanding how declaration order, scope rules, and namespace lookup interact. Candidates often stumble by assuming the most obvious or "intended" binding, rather than following C++'s precise lookup rules. Success here depends on careful attention to where names are declared, which scopes are active, and whether any prior declaration shadows or blocks a later one.
- Namespace and class scope binding
- Name hiding and shadowing
- Unqualified vs. qualified name lookup
- Declaration visibility across translation units