Extern with Initializer
What this preview is
Extern with Initializer 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++ extern and initializer question tests
This is a medium-difficulty C++ language-knowledge question that probes your understanding of how extern declarations interact with variable initialization across translation units. It's the kind of problem that separates candidates who've worked with multi-file C++ projects from those who've only read the spec.
To solve it, you need to reason carefully about the difference between declaring and defining a variable, how the linker resolves symbols across compilation units, and the order in which initializers run. The question rewards precise knowledge of C++ scoping rules and the one-definition rule (ODR).
- External linkage vs. internal linkage
- Declaration versus definition
- Initialization order in multi-unit programs
- The one-definition rule (ODR)
Related practice
Unlock full access to getcracked
Join to unlock this question, detailed solutions, and our complete library of quant finance interview prep.