Logo

Question preview

Static* and Dynamic*

What this preview is

About this preview

Static* and Dynamic* is a medium quant interview question on language knowledge in Cpp, asked at Quant.

Unlock full access to getcracked

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

What this C++ memory-model interview question tests

This is a medium-difficulty question that probes your understanding of static and dynamic storage duration in C++. It appears frequently in quant-trading interviews because correct mental models of variable lifetime and scope are essential when writing systems code that must manage memory carefully and predictably.

To reason through problems like this, you need to distinguish between variables declared with the static keyword (which have static storage duration and persist for the program's entire lifetime) and ordinary automatic or dynamically-allocated variables. The question rewards careful attention to initialization order, scope rules, and how different storage classes interact with function calls and program flow.

  • Static storage duration and initialization semantics
  • Automatic vs. dynamic allocation lifetimes
  • Function scope and re-entrancy with static state