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
- Which of the following best describes a foreign key in a relational database? → A column that references the primary key of another table
- What does O(log n) time complexity represent? → Logarithmic growth
- Which profiling technique samples the call stack at regular intervals to identify hotspots? → Sampling profiling
- What does the 'encapsulation' principle primarily aim to achieve in OOP? → Hiding internal state and requiring all interaction through methods
- What is a dangling pointer? → A pointer that points to freed or invalid memory
- 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
- What does 'cohesion' mean in the context of software design? → How well the elements within a module belong together
- Which property of the ACID model ensures that a transaction either fully completes or has no effect on the database? → Atomicity
- What does it mean if a test case passes in unit testing? → The unit behaves as expected under the test conditions
- What is a virtual method in OOP? → A method whose behavior can be overridden in a derived class at runtime
- What is the Decorator design pattern? → Attaching additional responsibilities to an object dynamically without modifying its class
- Which concept describes a class implementing more than one interface in Java or C#? → Multiple interface implementation
- What is CQRS (Command Query Responsibility Segregation)? → A pattern that separates read (query) and write (command) operations into distinct models
- What is the role of the 'this' keyword in OOP languages? → Refers to the current object instance
- What is the time complexity of an algorithm that performs a linear search in an unsorted array? → O(n)
- In which phase of SDLC is the system built and coded? → Development
- What is the Facade design pattern? → A pattern that provides a simplified interface to a complex subsystem
- Which data structure is most suitable for implementing a LIFO (Last In, First Out) principle? → Stack
- Which tool is commonly used for debugging in software development? → Debugger
- What is a common use of the C programming language? → System programming
- What is the purpose of regression testing? → To ensure that code changes do not break existing functionality
- What is garbage collection in a managed runtime environment? → Automatic identification and freeing of memory no longer referenced by the application
- 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
- What is the purpose of lazy initialization? → Defer object creation until the first time it is actually needed
- Which approach is the most effective way to prevent SQL injection attacks in application code? → Using parameterized queries (prepared statements)
- What is the purpose of the 'synchronized' keyword in Java? → To ensure only one thread at a time executes the marked method or block
- What is the Singleton design pattern? → A pattern ensuring a class has only one instance and provides a global access point to it
- What does the term 'API' stand for? → Application Programming Interface
- What is the Proxy design pattern? → A pattern providing a surrogate object that controls access to another object
- 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: