Logo

Question preview

Even One Virtual Method

What this preview is

About this preview

Even One Virtual Method 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 object size and virtual methods in C++

This is an easy C++ language-knowledge question that tests your understanding of how the compiler lays out objects in memory, particularly when virtual methods are involved. It's the kind of detail-oriented question quant shops ask to verify that candidates have a solid grasp of C++ internals rather than just surface-level syntax.

The core concept is that adding even a single virtual method to a class changes its memory footprint in a specific, predictable way. On a 64-bit architecture, this has immediate and measurable consequences for object size. To answer correctly, you need to know how the compiler handles virtual function dispatch and what data it must store alongside your instance variables.

  • Virtual method tables (vtables) and pointers
  • Object memory layout and alignment
  • The sizeof operator and its interaction with virtual functions