Logo

Question preview

If you've used templates, you've run into this.

What this preview is

About this preview

If you've used templates, you've run into this. is a easy quant interview question on language knowledge in Cpp.

Unlock full access to getcracked

Join to unlock this question, detailed solutions, and our complete library of quant finance interview prep.

What this C++ template instantiation question tests

This easy question covers a common pitfall in C++ template programming: understanding how the compiler instantiates and links template definitions across multiple translation units. It's the kind of issue that trips up candidates who've worked with templates in practice but haven't internalized the rules.

The question asks you to reason about what happens when template code is split across header and implementation files. Success requires knowing where template definitions must live, how the compiler resolves instantiation, and what errors or unexpected behaviour can result. Interviewers use this to verify that you've debugged real template problems, not just read about them.

  • Template definition vs. declaration
  • Translation unit boundaries and ODR (One Definition Rule)
  • Explicit instantiation and visibility