🎯
C++ Interview Prep
Every question has a link to the full explanation. Work through each category — if you can answer all of these comfortably, you're prepared for senior C++ interviews at any company.
Interview strategy
C++ interviews test depth, not breadth. For each topic, be ready to go from the surface answer (the what) down to implementation details (the how) and trade-offs (the why). "Explain vtables" means: describe the layout, the indirection cost, and when you'd prefer CRTP.
Memory & Ownership
Move Semantics & Value Categories
- What is the difference between lvalue and rvalue?
- When is std::move NOT a move?
- What is RVO and when does the compiler apply it?Soon
- Explain perfect forwarding
- What does std::forward do that std::move doesn't?
Templates & Generics
- What is template specialization? Full vs partial?
- What is SFINAE? How do Concepts replace it?
- Explain CRTP and give a real use case
- What are variadic templates? Write a type-safe printfSoon
- What is type erasure? Implement a simple std::function
OOP & Polymorphism
- Virtual functions: vtable, vptr, and overheadSoon
- When should you use virtual vs templates (static polymorphism)?
- Explain diamond inheritance and virtual inheritanceSoon
- What does final and override do?Soon
- Pure virtual functions and abstract classesSoon
Concurrency
- What is a data race? How does C++ define UB for concurrent access?Soon
- Explain memory_order_relaxed vs acquire/release vs seq_cstSoon
- Implement a thread-safe singleton
- What is the ABA problem in lock-free programming?Soon
- std::mutex vs std::atomic — when to use each?
Undefined Behavior & Safety
- Name five common sources of undefined behavior in C++Soon
- What does signed integer overflow do in C++?
- Explain strict aliasing. Why does it matter for optimization?Soon
- What is use-after-free and how do you detect it?
- What does noexcept guarantee? Can it be violated?
Standard Library Gotchas
- Why is std::vector<bool> special?Soon
- Iterator invalidation: which operations invalidate which?
- unordered_map vs map — when does performance invert?
- What is std::string small-string optimization?Soon
- Explain std::launder and when you need itSoon
System Design & Architecture
- Design a thread-safe bounded queue (producer-consumer)Soon
- How would you design a plugin system in C++?
- Explain ABI stability. What breaks it?Soon
- How do you reduce binary size for embedded targets?
- Walk me through a custom allocator implementationSoon