0%

What is encapsulation in C++?

Correct! Wrong!

Encapsulation involves bundling data and functions that operate on that data within one unit, usually a class.

What is the role of a constructor in a class?

Correct! Wrong!

A constructor initializes an object when it is created, often assigning default values to data members.

What is inheritance in OOP?

Correct! Wrong!

Inheritance allows a class to derive properties and behaviors from another class.

What is polymorphism in C++?

Correct! Wrong!

Polymorphism allows functions or methods to behave differently based on the object calling them.

Which keyword is used to inherit a class?

Correct! Wrong!

The ':' (colon) syntax with public, protected, or private access is used for inheritance in C++.

Which of the following is an access specifier in C++?

Correct! Wrong!

Access specifiers define the scope of class members; common specifiers include public, private, and protected.

Loading Questions...

Which method is called automatically when an object is destroyed?

Correct! Wrong!

A destructor is automatically called to clean up resources when an object goes out of scope.

How is a class object created in C++?

Correct! Wrong!

To create a class object, you declare a variable of the class type.

Which feature allows a derived class to redefine a base class function?

Correct! Wrong!

Function overriding allows a subclass to provide a specific implementation of a function defined in its superclass.