After you pass
You've been through the whole syllabus and built the order book. That's the exact profile these firms hire. Do the debugging gauntlet weekly to keep it sharp, keep the capstone pinned on GitHub, and open the Akuna application. You built the person who can pass that interview.
Final Exam — Interview Simulation
15 questions · pass at 80%
Q01
An interviewer asks you to explain the three consts.
const int* const p means:Whyconst left of * = data is const; const right of * = pointer is const. Both here.
Q02
Why is signed integer overflow more dangerous than unsigned overflow?
WhySigned overflow is UB (the optimizer may assume it never happens); unsigned wraps predictably.
Q03
A class has a user-written destructor that frees a resource but no move/copy members. What rule is violated and what is the risk?
WhyWriting one special member means you likely need all five. Default shallow copy + two destructors = double free.
Q04
std::move is best described as:
WhyIt is a cast. The move constructor/assignment does the actual resource transfer.
Q05
You need O(1) average lookup by order id to cancel orders. Which container?
WhyHash table → O(1) average. That is exactly the order book's id index.
Q06
Why does the order book keep each side in a std::map rather than unordered_map?
WhySorted order gives the best price in O(1) at begin(); a hash map has no ordering.
Q07
A vector reallocation invalidates which iterators/pointers?
WhyGrowth moves the whole buffer; everything pointing in is invalidated.
Q08
A moved-from std::vector is in what state?
WhyStandard moved-from objects are valid but unspecified; you may assign to them or destroy them.
Q09
A joinable std::thread is destroyed without join/detach. Result?
WhyDestroying a joinable thread calls std::terminate. Always join or detach (or use jthread).
Q10
The correct producer-consumer wait is:
WhyThe predicate form loops until the condition holds, handling spurious wakeups correctly.
Q11
In a debugging round you see
delete b; where b is a Base* to a Derived and ~Base is non-virtual. The bug is:WhyDeleting derived via base pointer with non-virtual destructor is UB; the derived destructor doesn't run. Fix: virtual ~Base().
Q12
Which flag combination best catches memory bugs during testing?
WhyASan + UBSan with debug symbols catch use-after-free, out-of-bounds, and UB with exact locations.
Q13
Why can std::vector beat std::list in practice despite list's O(1) middle insert?
WhyCache locality: the ~100x memory/cache gap usually outweighs Big-O differences for realistic sizes.
Q14
Which metric matters most to a low-latency trading firm?
WhyTail latency governs worst-case behavior under which the system must still perform; averages hide dangerous outliers.
Q15
The Rule of Zero, applied to the order book, means:
WhyBecause the members are RAII containers, the compiler-generated copy/move/destroy are correct and OrderBook writes none — and it can't leak.