Professional Documents
Culture Documents
OOP Sample Question Paper - 2
OOP Sample Question Paper - 2
9036
3 Hours / 80 Marks Seat No.
class Region {
int m,t ;
Region()
{
m=0;
}
public:
Region (int y)
{
t=y;
}
}
main ()
{
Region r;
-1-
Region r (20);
}
a) Write program to declare a class ‘staff’. Having data member as name & post.
Accept this data for 5 staffs & display name of the staff who are H.O.D.
b) Write a program to overload = = in a class ‘string’to check the equality of string .
c) Write a program for below class hierarchy for the employee where the base class is
employee & derived classes are programmer & manager. Here, make display ( )
function virtual which is common for all & which will display information of
programmer & manager interactivity.
Employee
Programmer Manager
class first {
public: int m;
first (int x)
{
m=x*x;
}
};
class second
{
public: first a(10);
};
class third
{
public: second b;
};
void main ()
{
third c;
cout <<c.b.a.m;
}
-3-