Factory Output
What this preview is
Factory Output is a medium quant interview question on language knowledge in Cpp.
- Difficulty
- Medium
- Topic
- Language Knowledge
- Discipline
- Quant development
- Language
- Cpp
- Companies
- 0
Understanding move semantics and return value optimisation in C++
This is a hard C++ language-knowledge question that tests your grasp of move semantics, return value optimisation (RVO), and the subtleties of how modern C++ (C++17 and later) handles object construction and copying. It requires you to trace through constructor and move-constructor calls, understand when they fire, and reason about what gets printed at each step.
The question rewards deep familiarity with the C++ object lifecycle: how temporaries are created, when move operations are invoked versus elided, and how compiler optimisations interact with explicitly defined or deleted member functions. Interviewers ask this kind of question to distinguish candidates who have merely read about move semantics from those who can reliably predict behaviour in edge cases.
- Copy and move constructors: when each is called
- Return value optimisation and named return value optimisation (NRVO)
- The effect of deleting or explicitly defining special member functions
- Temporary object lifetime and scope
Related practice
Unlock full access to getcracked
Join to unlock this question, detailed solutions, and our complete library of quant finance interview prep.