What is the diamond problem in C++ inheritance?
A. A situation where the derived class cannot override the base class method
B. A situation where the base class cannot be inherited by more than one derived class
C. A situation where ambiguity arises due to multiple inheritance chains
D. A situation where ambiguity arises due to lack of inheritance
Select an option to see the answer and solution.
In C++, which access specifier allows the members of a base class to be accessible in the derived class and its derived classes, but not from outside the class hierarchy?
A. public
B. private
C. friend
D. protected
Select an option to see the answer and solution.
What is the default access specifier for a base class when inheriting in C++?
A. private
B. public
C. protected
D. friend
Select an option to see the answer and solution.
In C++, what happens if a derived class inherits multiple base classes and each base class contains a member with the same name?
A. The member of the derived class must explicitly specify which base class member to access
B. The member of the derived class will access the member from the base class with the same name
C. A compilation error occurs
D. The member of the derived class accesses all members with the same name from all base classes
Select an option to see the answer and solution.
Which keyword is used to prevent a class from being inherited in C++?
A. final
B. sealed
C. prevent_inheritance
D. noinherit
Select an option to see the answer and solution.
In C++, what is the process of creating a new class using an existing class as a blueprint and adding new functionalities to it?
A. Derivation
B. Composition
C. Inheritance
D. Polymorphism
Select an option to see the answer and solution.
What is the term used to describe a class that inherits from another class in C++?
A. Base class
B. Child class
C. Parent class
D. Derived class
Select an option to see the answer and solution.
In C++, what happens if a derived class redefines a method that is already defined in its base class?
A. Method in the base class overrides the derived class method
B. Both methods are available for use
C. Method in the derived class overrides the base class method
D. A compilation error occurs
Select an option to see the answer and solution.
In C++, which type of inheritance involves a class inheriting from multiple classes directly or indirectly?
A. Hierarchical inheritance
B. Multiple inheritance
C. Multilevel inheritance
D. None of the above
Select an option to see the answer and solution.
What is the name given to the process of creating a new class by inheriting properties and behaviors from an existing class in C++?
A. Polymorphism
B. Encapsulation
C. Inheritance
D. Composition
Select an option to see the answer and solution.
In C++, which access specifier allows the members of a base class to be accessible in the derived class, but not from outside the class?
A. public
B. private
C. friend
D. protected
Select an option to see the answer and solution.
What is the term used to describe a class that inherits properties and behaviors from another class in C++?
A. Base class
B. Child class
C. Derived class
D. Parent class
Select an option to see the answer and solution.
In C++, what is the default access specifier for a base class when inheriting?
A. private
B. public
C. protected
D. friend
Select an option to see the answer and solution.
What is the process called when a new class is created by inheriting properties and behaviors from an existing class in C++?
A. Composition
B. Encapsulation
C. Inheritance
D. Polymorphism
Select an option to see the answer and solution.
In C++, what is the process called when a class inherits properties and behaviors from multiple base classes?
A. Hierarchical inheritance
B. Multiple inheritance
C. Multilevel inheritance
D. None of the above
Select an option to see the answer and solution.
What happens if a derived class inherits multiple base classes and each base class contains a member with the same name in C++?
A. The member of the derived class must explicitly specify which base class member to access
B. The member of the derived class will access the member from the base class with the same name
C. A compilation error occurs
D. The member of the derived class accesses all members with the same name from all base classes
Select an option to see the answer and solution.
In C++, which access specifier allows the members of a base class to be accessible in the derived class, its derived classes, but not from outside the class hierarchy?
A. friend
B. private
C. protected
D. public
Select an option to see the answer and solution.
In C++, which keyword is used to denote the access specifier in a derived class when inheriting from a base class?
A. using
B. inherits
C. extends
D. : protected
Select an option to see the answer and solution.
In C++, what happens if a derived class inherits from multiple base classes and each base class has a member with the same name?
A. The member of the derived class must explicitly specify which base class member to access
B. The member of the derived class will access the member from the base class with the same name
C. A compilation error occurs
D. The member of the derived class accesses all members with the same name from all base classes
Select an option to see the answer and solution.
Which type of inheritance involves a class inheriting from multiple classes directly or indirectly in C++?
A. Multilevel inheritance
B. Hierarchical inheritance
C. Single inheritance
D. Multiple inheritance
Select an option to see the answer and solution.