Advertisements

C++ Programming Mastery: Tricky MCQ Practice Tests

Advertisements
200 tricky C++23 questions on conversions, lifetime, classes, templates, move semantics, STL and ranges, run on GCC 16
1
1/5
(46) Ratings
0 students
Created by LOGAKRISHNAN N
Advertisements

What you'll learn

  • Predict the type and value of arithmetic expressions involving promotions, signed and unsigned mixing, shifts and literals.
  • Recognize undefined behavior, dangling references and lifetime errors before they reach production.
  • Know exactly which constructor, assignment operator or destructor runs, including copy elision and implicit moves.
  • Reason about virtual dispatch, slicing, name hiding, argument-dependent lookup and access control in class hierarchies.
  • Read template code the way the compiler does: deduction, overload resolution, concepts and constant evaluation.
  • Manage ownership and errors with move semantics, smart pointers, RAII and exceptions, and use the STL, lambdas and ranges safely.
This course includes:
200 questions on-demand video
0 articles
0 downloadable resources
0 lessons
Full lifetime access
Access on mobile and TV
Certificate of completion
Advertisements

Course content

Requirements

  • Working knowledge of C++: you have written classes, used the standard library and compiled your own programs.
  • Comfort reading short programs of 10 to 20 lines; nothing needs to be installed to take the tests.
  • A computer, tablet or phone with a web browser.

Description

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.

Who this course is for:

  • C++ developers preparing for technical interviews.
  • Developers who write C++ every day and want a precise model of what the language guarantees.
  • Developers moving from C++11 or C++17 to C++20 and C++23 who want to check what changed.
  • Students who have finished a C++ course and want challenging practice questions.
Advertisements
CPPFREE1126
Advertisements
Advertisements
Free Online Courses with Certificates
Logo
Register New Account