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.

40 questions
65 min time limit
70.00% to pass
  1. Which of the following best describes a foreign key in a relational database? A column that references the primary key of another table
  2. What does O(log n) time complexity represent? Logarithmic growth
  3. Which profiling technique samples the call stack at regular intervals to identify hotspots? Sampling profiling
  4. What does the 'encapsulation' principle primarily aim to achieve in OOP? Hiding internal state and requiring all interaction through methods
  5. What is a dangling pointer? A pointer that points to freed or invalid memory
  6. What is the Java Memory Model (JMM) relevant to CPP-level knowledge? It specifies rules about when writes by one thread become visible to other threads
  7. What does 'cohesion' mean in the context of software design? How well the elements within a module belong together
  8. Which property of the ACID model ensures that a transaction either fully completes or has no effect on the database? Atomicity
  9. What does it mean if a test case passes in unit testing? The unit behaves as expected under the test conditions
  10. What is a virtual method in OOP? A method whose behavior can be overridden in a derived class at runtime
  11. What is the Decorator design pattern? Attaching additional responsibilities to an object dynamically without modifying its class
  12. Which concept describes a class implementing more than one interface in Java or C#? Multiple interface implementation
  13. What is CQRS (Command Query Responsibility Segregation)? A pattern that separates read (query) and write (command) operations into distinct models
  14. What is the role of the 'this' keyword in OOP languages? Refers to the current object instance
  15. What is the time complexity of an algorithm that performs a linear search in an unsorted array? O(n)
  16. In which phase of SDLC is the system built and coded? Development
  17. What is the Facade design pattern? A pattern that provides a simplified interface to a complex subsystem
  18. Which data structure is most suitable for implementing a LIFO (Last In, First Out) principle? Stack
  19. Which tool is commonly used for debugging in software development? Debugger
  20. What is a common use of the C programming language? System programming
  21. What is the purpose of regression testing? To ensure that code changes do not break existing functionality
  22. What is garbage collection in a managed runtime environment? Automatic identification and freeing of memory no longer referenced by the application
  23. Which SQL JOIN returns all rows from the left table and matching rows from the right table, with NULLs for non-matching right rows? LEFT OUTER JOIN
  24. What is the purpose of lazy initialization? Defer object creation until the first time it is actually needed
  25. Which approach is the most effective way to prevent SQL injection attacks in application code? Using parameterized queries (prepared statements)
  26. What is the purpose of the 'synchronized' keyword in Java? To ensure only one thread at a time executes the marked method or block
  27. What is the Singleton design pattern? A pattern ensuring a class has only one instance and provides a global access point to it
  28. What does the term 'API' stand for? Application Programming Interface
  29. What is the Proxy design pattern? A pattern providing a surrogate object that controls access to another object
  30. What is secure coding practice regarding sensitive data in logs? Never log passwords, tokens, credit card numbers, or PII; mask or omit sensitive fields
Turn these facts into recall: