OOPS
Question 1 |
It is desired to design an object-oriented employee record system for a company. Each employee has a name, unique id and salary. Employees belong to different categories and their salary is determined by their category. The functions to get Name, getld and compute salary are required. Given the class hierarchy below, possible locations for these functions are:
- (i) getld is implemented in the superclass
(ii) getld is implemented in the subclass
(iii) getName is an abstract function in the superclass
(iv) getName is implemented in the superclass
(v) getName is implemented in the subclass
(vi) getSalary is an abstract function in the superclass
(vii) getSalary is implemented in the superclass
(viii) getSalary is implemented in the subclass

Choose the best design
(i), (iv), (vi), (viii) | |
(i), (iv), (vii) | |
(i), (iii), (v), (vi), (viii) | |
(ii), (v), (viii) |
Question 1 Explanation:
Name and id are a property of every employee and independent of their category. So these should be implemented in superclass. Every employee has a salary but this is determined by their category. So getsalary must be abstract function in superclass and implemented in subclass.
Question 2 |
Which of the following statement is not True?
A data member of a class can be declared as static and is normally used to maintain values
common to the entire class. | |
A friend function can be invoked like a normal function without the help of any object. | |
The scope resolution operator (::) can overloaded like normal operators | |
Multiple may lead to duplication of inherited members from a "Grandparent"
base class. This may be avoided by making the common base class a virtual base class.
|