Logo

Question preview

Parents are always right?

What this preview is

About this preview

Parents are always right? is a easy 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.

Understanding class memory layout in C++ inheritance

This is an easy question that tests your grasp of how C++ lays out objects in memory, particularly when inheritance is involved. Quant firms ask questions like this to verify that candidates understand the machine-level representation of classes—knowledge that becomes critical when optimising for cache locality, reducing latency, or debugging memory corruption issues.

To answer correctly, you need to reason about the order in which member variables and inherited components are arranged in memory, and how a 64-bit system aligns them. The question invites you to ignore artificial padding, so focus on the logical sequence of data members as they would appear in a linear memory dump. This tests whether you can visualize the actual byte layout of an object without relying on a debugger or sizeof() calls.

  • Base-class subobjects and their placement
  • Member declaration order and layout
  • Pointer and integer size assumptions on 64-bit architectures