Test How Well You Really Know C++
C++ rewards precise knowledge and punishes guesses. Why does -1 < 1u evaluate to false? Why does a virtual call made from a constructor ignore the override? Why does std::move on a const string copy it, and why does a vector copy its elements when it grows? When is a reference to a temporary still valid, and when does it dangle? These practice tests check how well you can predict what a real compiler does with short C++ programs.
What this practice test course offers:
- 200 original multiple-choice questions in 4 practice tests of 50, grouped by topic
- Short, complete programs to reason about: what does it print, does it compile and with which error, which warning does GCC give, or is the behavior undefined
- An explanation for every answer option, plus an overall explanation of the rule behind it
- Every program was compiled with GCC 16.2 in C++23 mode and run; output questions were also checked with AddressSanitizer and UndefinedBehaviorSanitizer, so no answer relies on undefined behavior
- Modern C++ included: guaranteed copy elision, concepts, consteval and if consteval, deducing this, ranges and views, std::expected, std::print and std::println, and the C++23 changes to returning locals and range-for lifetimes
Topics covered:
- Integer promotion, signed and unsigned conversions, overflow, narrowing, literals and shifts
- References, pointers, const, value categories, temporary lifetime and dangling
- Constructors, initialization forms, copy elision, the rule of zero, three and five, destruction order
- Inheritance, virtual dispatch, slicing, name hiding, ADL and access control
- Templates, auto and decltype, forwarding references, overload resolution, concepts, constexpr and consteval
- Move semantics, unique_ptr, shared_ptr and weak_ptr, RAII, exceptions and noexcept
- STL containers, iterator invalidation, algorithms, string and string_view
- Lambdas and captures, ranges and views, structured bindings, the spaceship operator, optional, variant and expected
Who should take this course?
- C++ developers preparing for technical interviews
- Developers who write C++ every day and want to stop being surprised by the language
- Students who have finished a C++ course and want hard, honest practice
If you are new to C++, start with a fundamentals course and come back here to test yourself.
How to use the tests: take one test at a time, then read every explanation, including the ones for questions you answered correctly. Retake a test a few days later to check that the rules have stuck.
This course is independent and is not affiliated with or endorsed by ISO, the C++ Standards Committee (WG21), the Standard C++ Foundation or the GNU Project.







