Quiz Iii Set 1 Final
Quiz Iii Set 1 Final
1. Which of the following is valid when accessing a base class function from a derived class?
a) baseFunc(); b) Base::baseFunc();
c) this->baseFunc(); d) All of the above
11. A company has a base class Employee with functions to calculate basic pay. The Manager and Technician
classes derive from Employee and add specific functions for bonuses. If a Manager object calls a function
defined in Employee, what mechanism ensures the base class function is executed correctly?
a) Function overriding
b) Function overloading
c) Polymorphism through virtual functions
d) None of the above
12. A class Shape is inherited by both 2DShape and 3DShape, and 2DShape is further inherited by Rectangle.
This represents _______________ inheritance.
13. A _______________ function in a base class ensures that the derived class's function is executed at runtime
through a base class pointer.
17. Which concept will result in derived class with more features (consider maximum 3 classes)?
a) Single inheritance
b) Multiple inheritance
c) Multilevel inheritance
d) Hierarchical inheritance
18. If a base class pointer is used to store the address of a derived class object and a non-virtual function is called
through this pointer, the base class function will be invoked, irrespective of the derived class's definition.
a) True b) False
19. In C++, an abstract class can be instantiated if it has at least one virtual function defined in its base class.
a) True b) False
20. The visibility mode of inheritance impacts whether a derived class can override the private members of its
base class.
a) True b) False