Important Questions

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

CBSE CLASS XII

(d) Find the output of the following program :
# include < iostream.h>
void main ()
{
intArray[] = {4,6,10,12};
int *pointer = Array ;
for (int I=1 ; I<=3 ; I++)
{
cout<<*pointer<<#”;
pointer ++;
}
cout<<endl;
for (I=1 ; I<=4 ; I++)
{
(*pointer)*=3 ;
-- pointer;
}
for(I=l; I<5; I + + )
cout << Array [I-1] << “@”;
cout << endl;
}

(e) Find the output of the following program : 3
# include < iostream.h>
void Withdef (int HisNum = 30)
{
for (int 1=20 ; I<*= HisNum; I+=5)
cout<<I<<””;
cout<<endl;
}
void Control (int &MyNum)
{
MyNum+=10;
Withdef(MyNum);
}
void main ()
{
int YourNum=20;
Control (YourNum);
Withdef();
cout<<”Number=”<<YourNum<<endl;
}

(f) In the following C++ program what is the expected value of MyMarks from Options (i) to (iv) given below. Justify answer. 2
#include<stdlib. h >
# include<iostream. h>
void main ()
{
randomize ();
int Marks [ ]= {99, 92, 94, 96, 93, 95}, MyMarks;
MyMarks = Marks [1 + random (2) ];
cout<<MyMarks<<endl;
}
(i) 99 (ii) 94
(iii) 96 (iv) None of the above

2. (a)
Differentiate between Constructor and Destructor function in context of Classes and Objects using C++

(b) Answer the questions (i) and (ii) after going through the following class
class Maths
{
char Chapter [20];
int Marks;
public:
Maths ( ) //Member Function 1
{
strcpy (Chapter, “Geometry”);
Marks = 10;
cout<<“Chapter Initialised”;
{
~Math () //Member Function 2
}
cout<<”Chapter Over”;
}
};

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