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.
Every topic below links to its own page with all of its questions in one place.
Answers are checked against current language behaviour; old-guide claims are corrected.
Each topic points to the matching course lesson, and lessons point back here.
Featured questions in this bank
C++ Fundamentals
What is C++?
C++ is a general-purpose, statically typed, compiled programming language that extends C with object-oriented programming, generic programming (templates) and a rich standard library. It gives low-level control over memory and…
Read the full answer →C++ Fundamentals
How does a C++ program go from source code to a running program?
Roughly four stages: preprocessing (handles #include, #define, conditional compilation), compilation (each translation unit is compiled to object code), linking (object files plus libraries are combined into an executable), and…
Read the full answer →Functions, Overloading & Argument Passing
What is function overloading and how does the compiler choose an overload?
Function overloading lets multiple functions share a name with different parameter lists (arity or types). The compiler picks the best viable candidate through overload resolution: exact matches beat promotions, which beat…
Read the full answer →Functions, Overloading & Argument Passing
What are default arguments? What rules apply to them?
Default arguments supply a value when the caller omits it. They must appear trailing (no non-default parameter may follow a defaulted one in the same declaration), can only be specified once per scope (usually in the declaration,…
Read the full answer →Classes, Objects & Constructors
What is a class and an object in C++?
A class is a user-defined type bundling data members and member functions with access control (private/protected/public). An object is an instance of a class with its own storage and lifetime — automatic (stack), static,…
Read the full answer →Classes, Objects & Constructors
What are the special member functions (rule of 0/3/5)?
The six special members are default constructor, destructor, copy constructor, copy assignment, move constructor and move assignment. The rule of 0 says: manage no raw resources — let members handle themselves and declare…
Read the full answer →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