COMPUTER SCIENCE C++

1.f) In the following program, if the value of N given by the user is 15, what maximum andminimum values the program could possibly display?

#include <iostream.h>
#include <stdlib.h>
void main()
{ int N,Guessme;
randomize();
cin>>N;
Guessme=random(N)+10;
cout<<Guessme<<endl;
}

2

Answer:

Maximum Value:24 ,Minimum Value:10

(1 Mark for writing correct minimum value) (1 Mark for writing correct maximum value)

Model Paper 2 for 2008-09 Batch

1.b) Write the names of the header files to which the following belong: 1 (i) frexp() (ii) isalnum()

Answer:i) math.h (ii) ctype.h

(1/2 Mark for mentioning name of each header file)

1.d) Find the output of the following program

#include <iostream.h>
void Changethecontent(int Arr[], int Count)
{ for (int C=1;C<Count;C++)
Arr[C-1]+=Arr[C];
}
void main()
{ int A[ ]={3,4,5},B[ ]={10,20,30,40},C[ ]={900,1200};
Changethecontent(A,3);
Changethecontent(B,4);
Changethecontent(C,2);
for (int L=0;L<3;L++)
cout<<A[L]<<’#’;
cout<<endl;
for (L=0;L<4;L++)
cout<<B[L] <<’#’;
cout<<endl;
for (L=0;L<2;L++)
cout<<C[L] <<’#’;
}

3

Answer:

7#9#5#
30#50#70#40#
2100#1200#

(1 Mark for each correct line of output) Note: Deduct ½ Mark for not showing : in the output Deduct ½ Mark for not considering endl

 

CBSE Computer Science Solved Revision Tour By Mr. Ravi Kiran ( [email protected] )