Important Questions

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

CBSE CLASS XII

No_of_travellers No_of_buses
Less than 20 1
Equal to or more than 20 and less than 40 2
Equal to 40 or more than 40 3
A function ShowTravel( ) to display the content from all the data members on screen.

(d) Answer the questions (i) to (iv) based on the following code : 4
class Drug
{
char Category[10];
char Date_of_manufacture[10];
char Company[20];
public:
Drug();
void enterdrugdetails();
void showdrugdetails{);
};
class Tablet : public Drug
{
protected:
char tablet_name[30];
char Volume_label[20];
public:
float Price;
Tablet();
void entertabletdetails();
void showtabletdetails();
};
class PainReliever : public Tablet
{
int Dosage_units;
char Side_effects[20];
int Use_within_days;
public:
PainReliever();
void enterdetails();
void showdetails();
};

(i) How many bytes will be required by an object of class Drug and an object of class PainReliever espectively ?

(ii) Write names of all the data members which are accessible from the object of class PainReliever.

(iii) Write names of all the members accessible from member functions of class Tablet.

(iv) Write names of all the member functions which are accessible from objects of class PainReliever.

3. (a) Write a function in C++ which accepts an integer array and its size as arguments/parameters and exchanges the values of first half side elements with the second half side elements of the array. 3
Example :
If an array of eight elements has initial content as 8, 10, 1, 3, 17, 90, 13, 60
The function should rearrange the array as 17, 90, 13, 60, 8, 10, 1, 3

(b) An array Arr[35][15] is stored in the memory along the row with each of its element occupying 4 bytes. Find out the base address and the address of an element Arr[20][5], if the location Arr[2][2] is stored at the address 3000. 4

(c) Write a function in C++ to perform a DELETE operation in a dynamically allocated queue considering the following description : 4
struct Node
{
float U,V;
Node *Link;
};
class QUEUE
{
Node *Rear,*Front;
public:
QUEUE(){Rear=NULL;Front=NULL;}
void INSERT();
void DELETE();
QUEUE();
};

(d) Write a function in C++ to print the sum of all the values which are either divisible by 3 or are divisible by 5 present in a two dimensional array passed as the argument to the function. 3

(e) Evaluate the following postfix notation of expression : 20 10 + 5 2 * – 10 / 2

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