Important Questions

CBSE Guess > Papers > Important Questions > Class XII > 2010 > Computer Science > Computer Science By Ravi Kiran

CBSE CLASS XII

(i) Name the specific features of class shown by Member Function 1 and Member Function 2 in the above example.

(ii) How would Member Function 1 and Member Function 2 get executed?

(c) Define a class Tour in C++ with the description given below :
Private Members :
TCode of type string
NoofAdults of type integer
NoofKids of type integer
Kilometres of type integer
TotalFare of type float
Public Members :

i) A constructor to assign initial values as follows :
TCode with the word “NULL”
NoofAdults as 0
NoofKids as 0
Kilometres as 0
TotalFare as 0

ii) A function AssignFare ( ) which calculates and assigns the value of the data member TotalFare as follows
For each Adult
Fare(Rs) For Kilometres
500 >=1000
300 <1000&>=500
200 <500
For each Kid the above Fare will be 50% of the Fare mentioned in the above table
For example :
If Kilometres is 850, NoofAdults = 2 and NoofKids = 3
Then TotalFare should be calculated as
NumofAdults * 300 + NoofKids * 150
i.e. 2*300 + 3*150=1050

iii) A function EnterTour( ) to input the values of the data members TCode, NoofAdults, NoofKids and Kilometres; and invoke the Assign Fare( ) function.

iv) A function ShowTour( ) which displays the content of all the data members for a Tour.

(d) Answer the questions (i) to (iv) based on the following code :
class Trainer
{
char TNo [5], TName [20], Specialisation [10];
int Days;
protected :
float Remuneration;
void AssignRem (float);
public :
Trainer ( ) ;
void TEntry ( );
void TDisplay ( );
};
class Learner
{
char Regno [10], LName [20], Program [10];
Protected :
int Attendance, Grade;
public:
Learner ( );
void LEntry ( );
void LDisplay ( );
};
class Institute : public Learner, public Trainer
{
char ICode[10], IName [20]; (
public:
Institute ( );
void IEntry ( );
void IDisplay ( );
};

(i) Which type of Inheritance is depicted by the above example?

(ii) Identify the member function(s) that cannot be called directly from the objects of class Institute from the following
TEntry( )
LDisplay()
IEntry()

Paper By Mr. Ravi Kiran
Email Id : [email protected]