Important Questions

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

CBSE CLASS XII

(d) Answer the questions (i) to (iv) based on the following code : 4
class Teacher
{
char TNo[5], TName[20], DeptflO];
int Workload;
protected:
float Salary;
void AssignSal(float);
public:
Teacher( ) ;
void TEntry( ) ;
void TDisplay( );
};
class Student
{
char Admno[10], SName[20], Stream[10];
protected:
int Attendance, TotMarks;
public:
Student( );
void SEntry( );
void SDisplay( );
};
class School : public Student, public Teacher
};
char SCode[10], SchName[20];
public:
School ( ) ;
void SchEntry( );
void SchDisplay( );
};

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

(ii) Identify the member functiion(s) that cannot be called directly from the objects of class School from the following :
TEntry( )
SDisplay( )
SchEntry( )

(iii) Write name of all the member(s) accessible from member functions of class School.

(iv) If class School was derived privately from class Teacher and privately from class Student, then, name the member function(s) that could be accessed through Objects of class School.

3. (a) Write a function in C++ which accepts an integer array and its size.as arguments and replaces elements having even values with its half and elements having odd values with twice its value. 4
Example : if an array of five elements initially contains the elements as
3, 4, 5, 16, 9
then the function should rearrange the content of the array as
6, 2, 10, 8, 18

(b) An array Arr[15][20] is stored in the memory along the row with each element occupying 4 bytes. Find out the Base Address and address of the element Arr[3][2], if the element Arr[5][2] is stored at the address 1500. 4

(c) Write a function in C++ to delete a node containing customer’s information, from a dynamically allocated Queue of Customers implemented with the help of the following structure : 4
struct Customer
{
int CNo;
char CName[20];
Customer *Link;
};

(d) Write a function in C++ which accepts a 2D array of integers and its size as arguments and displays the elements of middle row and the elements of middle column. [Assuming the 2D Array to be a square matrix with odd dimension
i.e. 3×3, 5×5, 7×7 etc...]
Example, if the array content is
3 5 4
7 6 9
2 1 8
Output through the function should be :
Middle Row : 7 6 9
Middle Column : 5 6 1

(e) Evaluate the following postfix notation of expression : 15 3 2 + / 7 + 2 *

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