Q1 Assume that the cell users are two kinds – those with a post paid option and those

with a prepaid option. Post paid gives a fixed free talk time and the rest is computed at the rate of Rs.1.90 per pulse. Prepaid cards have a fixed talk time. Define a class Cell_user as a base class and derive the hierarchy of classes. Define member functions and override them wherever necessary to (i) retrieve the talk time left for each user. (ii) print the bill in a proper format containing all the information for the post paid user.

Q2 Write a C++ program to prepare the mark sheet of an university examination with the following items from the keyboard : Name of the student Roll no. Subject name Subject code Internal marks External marks Design a base class consisting of data members Name of the student and Roll no. The derived class consists of the data members Subject name, Subject code, Internal marks and External marks.

Q3 Write a program to overload the unary minus operator using friend function.

250. Define a class Electricity in which the function Bill computes the cost. Each of these three classes should have a nondefault constructor and a putdata() function to display its data.00 then an additional surcharge of 15% is added on the difference. Q6 Answer the questions (i) and (ii) after going through the following class: class WORK { int WorkID. Q5 An electricity board charges the following rates to domestic users to discourage large consumption of energy : For the first 100 units Beyond 300 units − 50 P per unit − 60 P per unit If the total cost is more than Rs. char WorkType. Define a derived class More_Electricity and override Bill to add the surcharge. public: ~WORK( ) // Function 1 .Q4 Create a class Patient that stores the patient name (a string) and the disease (a string) of the patient. From this class derive two classes : In_patient which has a data member roomrent (type float) and Out_patient which has a data member OPD_charges (float). Write a main() program to test In_ patient and Out_patient classes by creating instances of them and then displaying the data with putdata().

function3 and function4 shown in the above example of class WORK is called automatically.WorkType+1. function2. WorkType=W.WorkID+12. // Function 4 // Function 3 // Function 2 (i) (ii) Which member function out of function1. } void status( ) { cout<<WorkID<<”. //Statement 1 WORK Y (W). Function2. } WORK(WORK &W) { WorkID=W. } WORK( ) { WorkID=10. //Statement 2 Which member function out of Function1.{ cout<<”Un-Allocated”<<endl. } }. WorkType=’T’.”<<WorkType<<endl. when the scope of an object gets over? Is it known as Constructor OR Destructor OR Overloaded Function OR Copy Constructor? WORK W. Function3 and Function4 shown in above definition of class WORK will be called on execution of statement written as Statement 2? What is this function specifically known as out of Destructor or Copy Constructor or Parameterized Constructor? .

Q7 Define a class Travel in C++ with the description given below : Private Members : T_Code No_of_Adults No_of_Children Distance TotalFare Public Members :  A Constructor to assign initial values as follows : T_Code with the word “NULL” No_of_Adults as 0 No_of_Children as 0 Distance as 0 TotalFare as 0  A function AssignFare( ) which calculates and assigns the value of the data member TotalFare as follows : of type char[15] of type integer of type integer of type integer of type float For each Adult: Fare (Rs) For Distance (Km) 200 300 500 <500 <1000 & >=500 >=1000 For each Child the above Fare will be 50% of the Fare mentioned in the above table. No_of_Adults = 3 and No_of_Children = 2 Then the fair for the Adults is 300. Then Total Fare should be calculated as No_of_Adults*300 + No_of_Children *150 . For example : If Distance is 750.

void main() { void demo(int &. } void demo(int &x.  A function ShowTravel().i.b=5. demo(::a.int y.a. } Q10 Consider the following and answer the questions given below: class CEO { double Turnover. 2 protected: .int. int a=20. Q9 ) Find the output of the following program: #include<iostream.h> int a=10.int*). which displays the content of all the data members.e. No_of_Children and Distance.int *z) { a+=x. No_of_Adults. *z=a+y.&b). y*=a. cout<<x<<y<<*z<<endl. 3 * 300 + 2 * 150 = 1200  A function EnterTravel() to input the values of the data members T_Code. cout<<::a<<a<<b<<endl. and invoke the AssignFare( ).

void Indata(). public: Director ().int Noofcomp. public: CEO(). class Manager : public Director { float Expenses. 3) Is the data member Funds accessible by the object of the class Manager and why? 4) If the class Manager is derived in protected mode in place of public then. void OUTPUT(). } 1) a) Which constructor will be called first at the time of declaration of an object of class Manager? b) How many bytes will an object belonging to class Manager require? 2) Name the member function(s). give the names of inherited members in the protected section only? . Manager(). public: void Display(). void Outdata(). class Director : public CEO { int Noofemp. which are directly accessible from the object of class Manager. protected: float Funds. }. void INPUT(int). }.