Important Questions

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

CBSE CLASS XII

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

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

3. (a) Write a function in C++ which accepts an integer array and its size as arguments and replaces elements having odd values with thrice its value and elements having even values with twice its value.
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
9, 8, 15, 32, 27 4

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

(c) Write a function in C++ to delete a node containing Book’s information, from a dynamically allocated Stack of Books implemented with the help of the following structure.
struct Book
}
int BNo;
char BName[20];
Book *Next;
};

(d) Write a function in C++ which accepts a 2D array of integers and its size as arguments and displays the elements which lie on diagonals.
[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
5 4 3
6 7 8
1 2 9
Output through the function should be :
Diagonal One : 5 7 9
Diagonal Two : 3 7 1

(e) Evaluate the following postfix notation of expression : 25 8 3 - / 6 * 10 +

4. (a) Observe the program segment given below carefully, and answer the question
that follows: 1
class PracFile
{
intPracno;
char PracName[20];
int TimeTaken;
int Marks;
public:
// function to enter PracFile details
void EnterPrac( );
// function to display PracFile details
void ShowPrac( ):
// function to return TimeTaken
int RTime() {return TimeTaken;}
// function to assign Marks
void Assignmarks (int M)
{ Marks = M;}
};
void AllocateMarks( )
{ fstreamFile;
File.open(“MARKS.DAT”,ios::binary|ios::in|ios::out);
PracFile P;
int Record = 0;
while (File.read(( char*) &P, sizeof(P)))
{
if(P.RTime()>50)
P.Assignmarks(0)
else
P.Assignmarks(10)
//statement 1
//statement 2
Record + + ;
}
File.close();
}

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