CBSE eBooks

CBSE Guess > eBooks > Class XII > Computer Science By . Mr. MRK

Chapter – 1 C++ Revision Tour

Previous Index Next

1. 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: (ii) 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 program: 2

#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

Previous Index Next