A C++ compiler accepts plenty of code whose meaning it cannot guarantee, and plenty more that does something other than what it appears to do. The C++ (Intermediate) test is about the rules that tell those programs apart from correct ones: who owns an object and when it dies, what a move actually does, how the compiler deduces templates and chooses between overloads, which operations invalidate an iterator, and where the language stops making promises at all. Each question isolates one such rule in a short program or a few lines of code.
Many questions show a complete program and ask what it prints. Others ask which declarations compile, which line has undefined behaviour, or what the standard does and does not guarantee after an operation. Expect several questions where the right answer is "it does not compile" or "the behaviour is undefined": knowing when C++ refuses a program, and when it accepts one it cannot give a meaning to, is part of this level. A few questions ask you to select every correct option, scored only when the set is exact. The coding section that follows must be answered in C++.
Who it is written for
The test is for programmers who use C++ beyond a first course: at work, in systems or game code, in competitive programming with an eye on how the standard library behaves, or before interviews where C++ is the language. It assumes the C++ (Basic) material — pointers and references, constructors and destructors, virtual functions, const, the common containers — and builds on it.
If you learned C++ before C++11, most of the gap is in the newer half of the language: move semantics, smart pointers, auto deduction, lambdas and the C++17 library types. Start there. If you came to C++ through competitive programming, expect ownership, class design and undefined behaviour to need the most work, since contest code rarely depends on them.
Areas of the language and library
Each area is a topic on your result. The C++ study plan teaches all of them; its modules on memory and ownership, copies and moves, templates, and performance and undefined behaviour carry the most weight here.
- Memory and RAII. Ownership with
std::unique_ptrandstd::shared_ptr, reference counts andstd::weak_ptr,std::make_shared, what RAII guarantees when an exception unwinds the stack, and the rule of zero. - Move semantics. Value categories, rvalue references, what
std::moveandstd::forwardreally do, when a move happens and when a copy happens instead,noexceptmove constructors, and copy elision. - Templates. Argument deduction, full and partial specialisation,
if constexpr,std::enable_ifand SFINAE, how function templates compete with ordinary overloads, and why template code lives in headers. - Inheritance and virtual functions. What virtual dispatch does and does not reach, how
overrideandfinalare checked, abstract classes and pure virtual functions, name hiding, multiple and virtual inheritance, and virtual destructors. - STL containers. Which operations invalidate iterators, pointers and references in each container,
emplaceversuspush,reserveversusresize, and howstd::mapbehaves on lookup and insertion. - STL algorithms and iterators. The contracts behind the algorithms: half-open ranges, iterator categories, strict weak ordering, stable and unstable sorting, binary search on a sorted range, algorithms that rearrange elements rather than erase them, and reverse iterators.
- Undefined behaviour. Recognising the common sources — lifetimes that end too early, out-of-range access, signed overflow, invalidated iterators, unsynchronised access from two threads — and telling them apart from results that are merely unspecified. Two of them have their own lessons:
std::string_viewand its lifetime rules andstd::thread,joinanddetach. - Modern C++. Lambda captures,
mutablelambdas and init-captures, structured bindings,autoanddecltype(auto)deduction,constexprfunctions,std::optionalandstd::variant.constversusconstexpris the lesson to read first. constand references. Overloading onconst,mutablemembers, andconst_cast.- Classes.
explicitconstructors, operator overloading conventions, and which special member functions the compiler declares for you.
Making the compiler show you the rules
Almost every rule above can be checked on your own machine in a few minutes, and checking is what turns a rule you half-remember into one you can apply under time.
- Instrument a class. Give a throwaway type a default constructor, copy and move constructors, both assignment operators and a destructor, each printing one letter. Put it in a
std::vector, pass it to functions, return it, capture it in a lambda: the output shows which special member ran, and when. - Turn the checkers on. Compile with
-Wall -Wextra, and on GCC or Clang add-fsanitize=address,undefined. Undefined behaviour often looks fine when the program runs; the sanitizers report it at the line where it happens. - Ask the compiler what it deduced. Inside a template,
static_assert(std::is_same_v<T, int>);fails with a message naming the typeTreally became — quicker than reasoning about deduction from memory. - Compare standards. When a rule might have changed between versions, compile the same snippet with
-std=c++14and-std=c++17; a new error or a different output is the change.
The study plan's modules Memory, ownership and RAII; Copies, moves and the rule of five; Templates and generic programming; STL containers; Algorithms and lambdas; Modern C++; and Performance and undefined behaviour line up with the topics above, and their exercises run on a judge.
The coding section: algorithms in C++
The coding section draws from the problem catalogue at easy and medium difficulty, and at medium the algorithm matters as much as the code: Submit runs every hidden case, so an approach that is only fast enough for the visible examples can still lose marks. Review costs with the Big-O notation lesson and practise the patterns medium problems lean on — binary search, heaps, prefix sums and hashing — with problems from Binary search, Heap and Hash table.
In C++ the standard library does most of the heavy lifting: std::sort with a comparator, std::unordered_map for counting, std::priority_queue for repeated minimums, std::lower_bound on sorted data. The whole library is already included and you complete one function that returns its answer. Pasting is off during a sitting; your best submission for each problem counts, with partial credit for every hidden case it passes.