Interview Q&A · C++

C++ Interview Questions & Answers

All 213 C++ interview questions — fundamentals, OOP, memory and smart pointers, templates, STL, exceptions, concurrency, modern C++ (11 to 23), the build model and coding tasks — with correct, up-to-date answers. This bank holds 213 questions across 21 topics and 13 topic groups. Every answer is written for current C++ versions, and each topic links to matching course lessons where they exist.

213 questions answered21 topics13 topic groups
Pick a topic

Every topic below links to its own page with all of its questions in one place.

Read the answer

Answers are checked against current language behaviour; old-guide claims are corrected.

Jump both ways

Each topic points to the matching course lesson, and lessons point back here.

C++ Fundamentals

18 questions across 2 topics — What C++ is, how source becomes a binary, namespaces, I/O and the type system.

Functions & Lambdas

16 questions across 2 topics — Overloading, argument passing, inline, function pointers, lambdas and auto.

Classes & OOP Pillars

18 questions across 2 topics — Constructors, destructors, copy/move, encapsulation, abstraction and the four pillars.

Inheritance & Polymorphism

17 questions across 2 topics — Inheritance mechanics, virtual dispatch, vtables, RTTI and CRTP.

Pointers, References & RAII

20 questions across 2 topics — Pointers vs references, ownership thinking, smart pointers and move semantics.

Templates & Generics

12 questions across 1 topic — Function/class templates, specialization, variadics, SFINAE and concepts.

STL Containers & Algorithms

22 questions across 2 topics — Vector, maps, sets, iterators, invalidation rules and the algorithm idioms.

Exception Handling

12 questions across 1 topic — try/catch/throw, unwinding, safety guarantees, noexcept and RAII.

Concurrency

14 questions across 1 topic — Threads, data races, mutexes, condition variables, atomics and futures.

Modern C++ (11 to 23)

14 questions across 1 topic — What each standard changed — constexpr, optional/variant, spaceship, coroutines, modules.

Compilation, Linking & ODR

10 questions across 1 topic — Translation units, headers, linkage, name mangling and faster builds.

Tricky Outputs & Coding Tasks

20 questions across 2 topics — Prediction gotchas plus implement-it-now favorites with idiomatic solutions.

Scenarios & Rapid Fire

20 questions across 2 topics — Judgment calls from real desks, plus one-line revision for the night before.

Recommended resourcesAffiliate links · may earn us a commission

Classic DSA interview booksThe reference books interviewers themselves learned from — great next to the visualizers.See the books Structured coding coursesVideo courses that pair well with visual practice — pick one language and go deep.Browse courses Cloud hosting for side projectsShip the portfolio project that gets you hired — free credits for new accounts.Claim credits