🇵🇰 CSS Computer Science · flashcards
CSS Computer Science Object Oriented Programming Flashcards
52 question-and-answer cards covering Object Oriented Programming as it is examined in CSS Computer Science. 24 of them are printed below, taken from across the deck — no signup, no paywall on the preview.
24 sample cards from the Object Oriented Programming deck
Sampled from the end of the deck, so these are different cards from the ones shown on the syllabus page.
What is the general syntax of an operator overloading function in C++?
It uses the keyword 'operator' followed by the operator symbol, e.g., returnType operator+(parameters). It can be a member function or a friend/non-member function.
Name at least four operators in C++ that cannot be overloaded.
The scope resolution operator (::), the member access/dot operator (.), the pointer-to-member operator (.*), the ternary conditional operator (?:), and sizeof.
When overloading a unary operator as a member function, how many explicit arguments does it take?
Zero explicit arguments — the single operand is the invoking object (accessed via the 'this' pointer).
When overloading a binary operator as a member function, how many explicit arguments does it take?
One explicit argument — the left operand is the invoking object and the right operand is passed as the parameter.
How are the prefix and postfix increment operators distinguished when overloading?
The postfix version is given a dummy int parameter, e.g., operator++(int), while the prefix version takes no parameter, e.g., operator++().
What is inheritance in OOP?
Inheritance is a mechanism by which a new class (derived/child) acquires the properties and behaviors (members) of an existing class (base/parent), promoting code reuse and establishing an 'is-a' relationship.
What is single inheritance?
Single inheritance is when a derived class inherits from exactly one base class.
What is multiple inheritance?
Multiple inheritance is when a derived class inherits from more than one base class simultaneously.
What is the diamond problem in multiple inheritance?
The diamond problem is an ambiguity that arises when a class inherits from two classes that both derive from a common base class, causing duplicate copies of the base members and ambiguity about which copy to use.
How is the diamond problem resolved in C++?
By using virtual inheritance (declaring the common base as a virtual base class), so that only a single shared copy of the base class subobject exists in the derived class.
In C++, what does the access specifier in 'class B : public A' control?
It controls the access level of inherited members in the derived class. With public inheritance, public members of A stay public and protected stay protected; with private inheritance, all become private; with protected inheritance, public and protected become protected.
What is the purpose of the 'protected' access specifier in the context of inheritance?
Protected members are hidden from outside (non-member) code like private members, but unlike private members they remain accessible to derived classes, enabling controlled inheritance of internal data.
What is method (function) overriding?
Method overriding is when a derived class provides its own implementation of a function that is already defined in its base class, using the same name, return type, and parameters (signature).
What is the difference between method overriding and method overloading?
Overriding redefines an inherited base-class method in a derived class with the same signature (runtime polymorphism, across classes). Overloading defines multiple methods with the same name but different parameter lists within the same scope (compile-time polymorphism).
What is a virtual function in C++?
A virtual function is a member function declared with the keyword 'virtual' in a base class, meant to be overridden in derived classes, enabling runtime (dynamic) polymorphism through base-class pointers or references.
What mechanism enables runtime polymorphism with virtual functions?
Dynamic binding (late binding), typically implemented via a virtual function table (vtable) and a vtable pointer, so the correct overridden function is selected at run time based on the actual object type.
What is a pure virtual function and how is it declared?
A pure virtual function is a virtual function with no implementation in the base class, declared by assigning 0, e.g., virtual void draw() = 0;. It must be overridden by any concrete derived class.
What is an abstract class in C++?
An abstract class is a class that contains at least one pure virtual function. It serves as an interface/base for derived classes and cannot be instantiated directly.
Can you create an object of an abstract class? Can you create a pointer to it?
You cannot create (instantiate) an object of an abstract class, but you can create a pointer or reference to it, which can point to objects of its concrete derived classes.
What happens if a derived class does not override all inherited pure virtual functions?
The derived class itself remains abstract and cannot be instantiated until all pure virtual functions are overridden with concrete implementations.
Why should a base class with virtual functions have a virtual destructor?
To ensure that when an object is deleted through a base-class pointer, the correct derived-class destructor is called, preventing resource leaks and undefined behavior.
What is the Standard Template Library (STL) in C++?
The STL is a library of generic, template-based C++ classes and functions providing reusable data structures and algorithms, primarily organized into containers, iterators, and algorithms (plus function objects).
What are the three main components of the STL?
Containers (data structures like vector, list, map), Algorithms (operations like sort, find, count), and Iterators (objects that traverse and connect containers to algorithms).
Distinguish between STL sequence containers and associative containers, giving examples of each.
Sequence containers store elements in a linear order with positional access (e.g., vector, list, deque); associative containers store elements sorted by key for fast key-based lookup (e.g., set, map, multiset, multimap).
What this deck covers
The Object Oriented Programming deck follows the CSS Computer Science Object Oriented Programming syllabus — 4 chapters and 14 topics — so questions land on material that is genuinely examinable rather than trivia around it. That works out to roughly 13.0 cards per chapter.
Answers are written to be recallable, not just readable — averaging about 178 characters, which is long enough to carry the reasoning and short enough to say out loud.
A deck like this earns its keep on the second and third pass. Read the syllabus first so you know the shape of the subject, then use the cards to find the specific facts that have not stuck.
Object Oriented Programming flashcards FAQ
How many Object Oriented Programming flashcards are in this CSS Computer Science deck?
52 cards. This page previews 24 of them, sampled evenly across the deck so you can judge the difficulty before installing anything.
Are these CSS Computer Science flashcards free?
Yes. The preview here is free to read with no signup, and the full 52-card deck is free inside the Examius app.
What do the Object Oriented Programming cards cover?
They follow the CSS Computer Science Object Oriented Programming syllabus — 4 chapters and 14 topics — so the questions track what is actually examinable.
How should I use these flashcards?
Read the syllabus first so you know the shape of the subject, then drill the deck. Examius schedules each card with spaced repetition, so cards you keep missing come back sooner and ones you know drift further apart.