Skip to content

Cpp Programming

Master Cpp Programming with 50 free flashcards. Study using spaced repetition and focus mode for effective learning in Programming.

🎓 50 cards ⏱️ ~25 min Advanced
Study Full Deck →
Share: 𝕏 Twitter LinkedIn WhatsApp

🎯 What You'll Learn

Preview Questions

12 shown

What are the four main principles of OOP in C++?

Show ▼

The four pillars of OOP are:
Encapsulation – bundling data and methods togetherAbstraction – hiding complex implementation detailsInheritance – deriving new classes from existing onesPolymorphism – using a single interface for different types

What is a class in C++?

Show ▼

A class is a user-defined type that encapsulates data members and member functions. Defined with the class keyword:
class MyClass { public: int x; void show(); };

What is the difference between a class and a struct in C++?

Show ▼

The only default difference is access control:
class members are private by defaultstruct members are public by defaultBoth can have methods, constructors, and inheritance.

What is inheritance in C++?

Show ▼

Inheritance allows a derived class to inherit members from a base class:
class Dog : public Animal { };
This promotes code reuse and establishes an is-a relationship.

What are virtual functions in C++?

Show ▼

A virtual function is declared with the virtual keyword in a base class, enabling runtime polymorphism:
virtual void speak() { }
Derived classes can override it, and the correct version is called via a base class pointer using the vtable.

What is a pure virtual function?

Show ▼

A pure virtual function has no implementation in the base class and is declared as:
virtual void draw() = 0;
Any class containing a pure virtual function becomes an abstract class and cannot be instantiated directly.

What is the purpose of the virtual destructor?

Show ▼

A virtual destructor ensures that when deleting an object through a base class pointer, the derived class destructor is called first:
virtual ~Base() { }
Without it, derived resources may leak.

What is operator overloading in C++?

Show ▼

Operator overloading lets you redefine how operators work for user-defined types:
MyClass operator+(const MyClass& rhs) const { return MyClass(value + rhs.value); }
Most operators can be overloaded except ::, ., .*, and ?:.

How do you overload the stream insertion operator?

Show ▼

The << operator is typically overloaded as a friend function:
friend std::ostream& operator<<(std::ostream& os, const MyClass& obj) { os << obj.data; return os; }

What are namespaces in C++?

Show ▼

Namespaces group identifiers to avoid name collisions:
namespace Math { int add(int a, int b); }
Access with Math::add(1,2) or bring into scope with using namespace Math;.

What is the std namespace?

Show ▼

The std namespace contains the entire C++ Standard Library, including containers, algorithms, and I/O classes. You access its members with std:: prefix, e.g., std::cout, std::vector.

What is RAII in C++?

Show ▼

RAII (Resource Acquisition Is Initialization) ties resource lifetime to object lifetime:
Resources are acquired in the constructorResources are released in the destructorThis guarantees cleanup even if exceptions occur.

🎓 Start studying Cpp Programming

🎮 Study Modes Available

🔄

Flashcards

Flip to reveal

🧠

Focus Mode

Spaced repetition

Multiple Choice

Test your knowledge

⌨️

Type Answer

Active recall

📚

Learn Mode

Multi-round mastery

🎯

Match Game

Memory challenge

Related Topics in Programming

📖 Learning Resources