Important Questions

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

CBSE CLASS XII

f. In the following C++ program what is the
expected value of Mysore from options (i) to (iv) given below.Justify your answer. 2
#include<stdlib.h>
#include<iostream.h>
void main( )
{ randomize( );
int Score[ ] = {25,20,34,56,72,63},Myscore;
cout<<Myscore<<endl;
} Ii) 25 (ii) 34 (iii) 20 (iv) None of the above.

Ans: Expected Output:

None of the above.

2006 Delhi

1.a. Name the header file to which the following below: 1
(i) abs( ) (ii) isupper( )

Ans. (i) abs( ) - math.h, stdlib.h, complex.h
(ii)isupper( ) - ctype.h

1.e. Find the output of the following program2 #include<iostream.h>
void main( )
{ long NUM=1234543;
int F=0,S=0;
do
{ int R=NUM % 10;
if (R %2 != 0)
F += R;
else
S += R;
NUM / = 10;
} while (NUM>0);
cout<<F-S;
}

Ans: Output: 2

2006 Outside Delhi

1.a. Name the header file to which the following belong: 1
(i) pow ( ) (ii)random( )

Ans:
(i) abs( ) - math.h, stdlib.h, complex.h
(ii)random( ) - stdlib.h

1.e. Find the output of the following program

#include<iostream.h
void main( )
{ long Number=7583241;
int First = 0, Second =0;
do
{ int R=Number%10;
if(R%2 ==0)
First += R;
else
Second += R;
Number / = 10;
} while (Number > 0);
cout<<First-Second;
}

Ans: Output

Paper By Mr. MRK
Email Id : [email protected]@yahoo.com