gitGood.dev
Back to Blog

Top 50 C++ Interview Questions for 2026

P
Pat
5 min read

Top 50 C++ Interview Questions for 2026

C++ interviews split cleanly into three audiences: HFT/quant shops, systems infra (databases, kernels, search engines), and games/embedded. The language overlap is large but the emphasis differs. HFT cares about cache lines and lock-free queues. Infra cares about lifetimes and concurrency primitives. Games care about allocators and SIMD.

These 50 questions cover the common core. If you are targeting one specialty, push deeper into its section.


Language Fundamentals (1-12)

  1. What is RAII, and what is the canonical example you would show a junior engineer?
  2. Walk me through the rule of zero, three, and five. When did C++11 force the rule of five into existence?
  3. What is the difference between const, constexpr, consteval, and constinit?
  4. Explain copy elision, RVO, and NRVO. What changed in C++17 about guaranteed copy elision?
  5. What is a trivially copyable type, and why does the standard care?
  6. std::string_view vs const std::string& for a function parameter - pick one and defend it.
  7. What is the difference between final, override, and virtual on a member function?
  8. Explain how virtual dispatch works under the hood. Where does the vtable live?
  9. What is the empty base optimization and why does the standard library lean on it?
  10. enum vs enum class - when does the difference bite you in practice?
  11. What is std::launder and when have you needed it?
  12. Walk me through the lifetime of a temporary. When does a dangling reference happen "by accident"?

Move Semantics & Ownership (13-22)

  1. What does std::move actually do? (Hint: nothing, until something else picks it up.)
  2. Why is the move constructor allowed to be noexcept-marked, and why does it matter for std::vector?
  3. What is reference collapsing, and what is a forwarding (universal) reference?
  4. Explain std::forward and where mis-using it silently breaks generic code.
  5. unique_ptr vs shared_ptr vs weak_ptr - pick one for: a tree node parent, an observer, a polymorphic factory return type.
  6. How does shared_ptr reference counting actually work? What is the control block, and where does it live?
  7. What is make_shared vs shared_ptr<T>(new T), and what is the gotcha when T has a private destructor?
  8. What is a sink parameter, and how do you implement one cleanly today (perfect forwarding, by value, etc.)?
  9. When does a destructor run for a thrown exception? What does std::terminate have to do with it?
  10. Walk me through "you can do everything unique_ptr does with boost::scoped_ptr" - what did unique_ptr add?

Templates & Generic Programming (23-30)

  1. What is SFINAE, and why has C++20 made it half-obsolete with concepts?
  2. Walk me through writing a concept that constrains a type to "looks like a container."
  3. What is CRTP, and what runtime cost does it remove vs virtual dispatch?
  4. Variadic templates - implement tuple at a whiteboard level. Where does the compile-time recursion go?
  5. What is if constexpr, and what readability problem did it fix?
  6. Explain template argument deduction guides. When do you need to write one?
  7. What is two-phase name lookup, and why is template<class T> struct Foo : Base<T> painful?
  8. What is a fold expression, and what is one realistic use beyond a print helper?

Memory Model & Concurrency (31-40)

  1. Walk me through the C++ memory model. What is "happens-before"?
  2. std::atomic memory orders - relaxed, acquire, release, acq_rel, seq_cst. Pick the right one for a counter and for a flag.
  3. What is the difference between a data race and a race condition?
  4. How does std::mutex differ from std::shared_mutex? When is the shared variant a footgun under contention?
  5. What is std::condition_variable, and what is the textbook bug pattern people write with it?
  6. std::thread vs std::jthread. What did C++20 fix?
  7. What is std::stop_token, and how does it cooperate with cancellation?
  8. Implement a single-producer / single-consumer ring buffer. What memory ordering do the head/tail pointers need?
  9. False sharing - what is it, how do you find it, and how do you fix it without alignas(64) everywhere?
  10. What is std::future and std::promise, and why does almost no shop use them in production?

Performance & Systems (41-46)

  1. What is cache-line size on a modern x86 server, and how does it shape data structure design?
  2. SIMD via intrinsics vs <execution> parallel algorithms vs hand-rolled assembly - when does each pay off?
  3. What is "small string optimization," and how do you tell whether a std::string is using it?
  4. How do allocators work in C++17/20 (std::pmr)? When would you write a custom one?
  5. Walk me through profiling a hot loop with perf and turning a 30% CPU function into 5%.
  6. How do you reduce binary size on a release build that has grown to 200 MB?

Modern C++ & Style (47-50)

  1. What did C++20 modules change about build times in practice? Have you used them in anger?
  2. Coroutines in C++20 - explain the customization-point soup (promise_type, awaiter, co_await). When are they actually nice to use?
  3. Ranges - what does views::filter | views::transform | views::take actually compile to?
  4. How do you keep a large C++ codebase from drifting into 5 dialects? What linters and CI gates earn their keep?

How to Use This List

C++ interviewers smell memorization fast. Practice answering these with examples from your own code - even toy projects count. Pull the example off your laptop, walk through it, name the tradeoff you actually made.

If you can do that for all 50, you are ready.


Drill these in mock-interview format with instant feedback on gitGood. $5/month, no annual lock-in.