Parse and Scope
What this preview is
Parse and Scope is a medium quant interview question on language knowledge in Cpp.
- Difficulty
- Medium
- Topic
- Language Knowledge
- Discipline
- Quant development
- Language
- Cpp
- Companies
- 0
What this C++ scoping and name-resolution question tests
This is a medium-difficulty C++ question that probes your understanding of variable scope, shadowing, and how the compiler resolves names across nested blocks and translation units. It rewards careful reading of code and clear mental execution.
To work through problems like this, you need to trace which declaration a given name refers to at each point in the program—accounting for local scope, block scope, and global scope. The follow-up variant (uncommenting a line) often introduces a subtle error or undefined behaviour that hinges on scope rules or one-definition-rule (ODR) violations. Interviewers value candidates who can predict compiler behaviour precisely and explain why a particular name resolves the way it does.
- Block scope and shadowing
- Name lookup and resolution order
- Linkage and the one-definition rule
- Global vs. local scope interaction
Related practice
Unlock full access to getcracked
Join to unlock this question, detailed solutions, and our complete library of quant finance interview prep.