Important Questions

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

CBSE CLASS XII

3. (a) void Replace( int Arr[], int Size)
{
for(int i =0; i<Size; i++)
if(Arr[i]%2 != 0 )
Arr[i] *= 3;
else
Arr[i] *= 2;
}
OR
void Replace( int Arr[], int Size)
{
for(int i =0; i<Size; i++)
Arr[i]%2 ? Arr[i] *= 2 : Arr[i] *= 3;
}

(b) Address of Array[i][j] along the column =
Base Address + W [( i – L1) + (j – L2) * M]
where,
W = size of each location in bytes = 8
L1 = Lower Bound of rows = 0
L2 = Lower Bound of columns = 0
M = Number of rows per column = 20
Address of Array[4][5] = Base Address + 8 [ (4 – 0) +(5 – 0) * 20]
1000 = Base Address + 8 [104]
Base Address = 1000 – 8 x 104
= 1000 – 832
= 168
Address of Array[2][3] = 168 + 8 [ (2 – 0) + (3 – 0) x 20]
= 168 + 8 x 62
= 168 + 496
= 664
OR

Address of Array[i][j] along the column =
Base Address + W [( i – L1) + (j – L2) * M]
where,
W = size of each location in bytes = 8
L1 = Lower Bound of rows = 1
L2 = Lower Bound of columns = 1
M = Number of rows per column = 20
Address of Array[4][5] = Base Address + 8 [ (4 – 1) +(5 –1) * 20]
1000 = Base Address + 8 [83]
Base Address = 1000 – 8 x 83
= 1000 – 664
= 336
Address of Array[2][3] = 336 + 8 [ (2 – 1) + (3 – 1) x 20]
= 168 + 8 x 41
= 168 + 328
= 496

(c) class Stack
{
Book *Top;
public:
Book() //Constructor to initialize Top
{ Top = NULL; }
void Push(); //Function to insert a node
void Pop(); //Function to delete a node
void Display(); //Function to display nodes of Stack
~Book(); //Destructor to delete all nodes
};
void Stack::Pop( )
{
if (Top != NULL)
{
Stack *Temp;
Temp = Top;

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