CPP Cheat Sheet 2026

The 30 highest-yield CPP facts, distilled from real exam questions. Print it, save it as a PDF, or study it here — free, no sign-up.

70 questions
120 min time limit
70% to pass
  1. How should CPP professionals measure success in performance optimization & profiling? Using defined metrics, benchmarks, and regular evaluation against established goals
  2. Which STL container provides constant-time access by index and automatic resizing? std::vector
  3. What is the key difference between composition and inheritance as design strategies? Composition models a 'has-a' relationship; inheritance models an 'is-a' relationship
  4. What does write() return when it encounters an error? -1
  5. Which of the following statements about std::array is TRUE? Its size is fixed at compile time and it is stack-allocated by default
  6. Which method of std::map returns an iterator to an element if found, or end() if not? find()
  7. What is the conventional return type for the copy assignment operator (operator=)? T&
  8. Which SOLID principle does the Open/Closed Principle (OCP) describe? Software entities should be open for extension but closed for modification
  9. What does the '*' operator do when used with pointers? Returns the value stored at the memory address
  10. What is the result of the fold expression `(args + ...)` when args is an empty pack? Compilation error for operator+
  11. What does the RAII idiom guarantee in C++ memory management? Resources are acquired in a constructor and released in the corresponding destructor
  12. What happens when you delete a pointer that was not allocated with new? It is undefined behavior
  13. What does the 'explicit' keyword do when applied to a constructor? Prevents the constructor from being used for implicit type conversions
  14. Which algorithm computes the sum of a range sequentially from left to right? std::accumulate
  15. What happens when an exception is thrown inside a destructor that is already executing due to stack unwinding? std::terminate() is called
  16. What does the ThreadSanitizer (TSan) detect in C++ multithreaded applications? Data races where two threads access shared memory without synchronization
  17. Which of the following is NOT a valid use of catch(...)? Accessing the caught exception object's members
  18. What does the C++17 structured binding `auto [x, y] = std::make_pair(1, 2.0);` deduce for `x` and `y`? x is int, y is double
  19. What is the relationship between unit testing & code quality and overall C++ Programming Professional Certificate professional competency? It is an essential component that strengthens the overall competency framework
  20. What does 'false sharing' mean in the context of multi-threaded performance? Threads access different variables that reside on the same cache line
  21. What is the relationship between templates & generic programming and overall C++ Programming Professional Certificate professional competency? It is an essential component that strengthens the overall competency framework
  22. What is the purpose of `std::enable_if` in template programming? To conditionally enable a template specialization based on a compile-time boolean
  23. What is the purpose of std::allocator in C++? To provide a customizable memory allocation strategy for containers
  24. Which sorting algorithm does std::stable_sort typically use? Merge sort
  25. Which file stream method returns the current position of the get pointer? tellg()
  26. Which cache concept refers to the tendency of programs to access memory locations near recently accessed locations? Spatial locality
  27. What is the relationship between concurrency & multithreading and overall C++ Programming Professional Certificate professional competency? It is an essential component that strengthens the overall competency framework
  28. What is the effect of declaring a move constructor as noexcept on container operations like std::vector resize? The vector will use the move constructor instead of copy constructor during reallocation
  29. What is the relationship between build systems & package management and overall C++ Programming Professional Certificate professional competency? It is an essential component that strengthens the overall competency framework
  30. What does `make -j$(nproc)` accomplish on a Linux system? Launches parallel make jobs up to the number of available CPU cores
Turn these facts into recall:
Was this helpful?