1/49
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Which feature of OOP allows a class to derive properties from another class?
Inheritance
3 multiple choice options
Which access specifier allows members to be accessed in derived classes but not outside?
Protected
3 multiple choice options
What is the keyword used to inherit a class in C++?
:
3 multiple choice options
Which of the following correctly declares a class B derived from class A?
class B : public A
3 multiple choice options
What is the default access specifier for inheritance in C++?
Private
3 multiple choice options
Which function is used to override a base class method in C++?
A virtual function
3 multiple choice options
What is required in base class to achieve runtime polymorphism?
At least one virtual function
3 multiple choice options
Which keyword allows method overriding in a derived class?
override
3 multiple choice options
What is the purpose of virtual functions?
To achieve runtime polymorphism
3 multiple choice options
What is the output type of a virtual function call resolved at runtime
Dynamic Binding
3 multiple choice options
Which type of inheritance is supported in C++?
All of the above
3 multiple choice options
Which of the following is not a distinct syntax-defined form of inheritance in C++?
Hybrid
3 multiple choice options
Which keyword prevents further inheritance of a class?
final
3 multiple choice options
What happens if a class has a pure virtual function?
It becomes an abstract class
3 multiple choice options
Which of these cannot be instantiated?
Abstract class
3 multiple choice options
What is it called when a derived class redefines a method of its base class?
Overriding
3 multiple choice options
Which class is automatically called when an object of derived class is created?
Base class constructor
3 multiple choice options
Which of these is an example of single inheritance?
class B : public A
3 multiple choice options
Which of the following enables function overloading?
Different parameter types
3 multiple choice options
Which of these is an example of function overriding?
Same function signature in base and derived class
3 multiple choice options
What does the keyword virtual do in a base class?
Ensures the correct derived class function is called
3 multiple choice options
Which keyword is used to prevent a method from being overridden?
final
3 multiple choice options
Which inheritance allows a class to inherit from multiple classes?
Multiple
3 multiple choice options
What happens when a method is both virtual and overridden?
The derived class is invoked at runtime
3 multiple choice options
What is a base class?
The class whose properties are inherited
3 multiple choice options
Which of these is true about virtual destructors?
They ensure proper cleanup of derived objects
3 multiple choice options
Which of the following defines pure virtual function?
virtual void func() = 0;
3 multiple choice options
Which of the following allows polymorphism?
Virtual functions
3 multiple choice options
Which function binding happens at compile-time?
Static binding
Which function binding happens at run-time?
Dynamic binding
3 multiple choice options
In C++, a class inherits from another class using the ________ symbol.
colon (:)
A class that provides members to another class is known as the ________ class.
base
A class that receives members from another class is called the ________ class.
derived
To override a base class function in the derived class, the function must be marked as ________ in the base class.
virtual
C++ supports ________ inheritance where a class is derived from more than one base class.
multiple
A function with the same name and parameters in the derived class as in the base class is called
overriding
The process of defining the same function in multiple forms is called
polymorphism
A class that contains at least one pure virtual function is known as an ________ class.
abstract
The keyword ________ is used to define a function that can be overridden in a derived class.
virtual
Function overloading is an example of ________ polymorphism
compile-time
Function overriding is an example of ________ polymorphism
runtime
C++ resolves overloaded functions using the function's ________ list.
parameter
Inheritance allows for ________ of code from base to derived classes
reusability
The ________ specifier prevents a class from being used as a base class
final
Only ________ and protected members are accessible in a derived class
public
A ________ function must be overridden in all derived classes to avoid compilation errors
pure virtual
The base class destructor should be declared as ________ to ensure proper cleanup
virtual
In hierarchical inheritance, multiple classes inherit from a single ________ class.
base
When a derived class modifies the behavior of a function from the base class, it is called
function overriding
A pointer to a base class can point to a derived class object, enabling ________ behavior
polymorphic