Logo

Question preview

wtf const

What this preview is

About this preview

wtf const is a medium 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.

Understanding const semantics in C++

This is a medium-difficulty question that tests your grasp of C++ const qualification rules and how they interact with pointers, references, and object mutation. It's the kind of question trading firms use to separate candidates who understand the language deeply from those who rely on pattern-matching.

The question asks you to trace through code and predict its output, which requires you to reason carefully about const correctness—where the compiler allows or forbids modifications, and what that means for runtime behaviour. You'll need to think about the distinction between a const pointer, a pointer to const, and const member functions, and understand how these rules apply in context.

  • Const pointer vs. pointer to const
  • Const member functions and mutable members
  • Type qualification and const-casting semantics
  • How the compiler enforces const constraints at compile time