COMPUTER SCIENCE C++

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

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

2

Answer:Maximum Value:19 Minimum , Value:10

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

Header filesImportant Functions.

From Old Papers
Name the header files that shall be needed forthe following:

2009 Outside Delhi:

(i) setw( ) – iomanip.h
(ii) sqrt( ) – math.h

2008 Delhi & OD:

Due to cout, include iostream.h
Due to setw( ), include iomanip.h

2007 Delhi & OD:

Due to strcat( ), include string.h
Due to gets( ), include stdio.h

2006 Delhi:

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

2006 Outside Delhi

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

2005 Delhi:

(i) abs( ) - stdlib.h, math.h
(ii) strcmp( ) - string.h

2005 OD:

(i) puts( ) - stdio.h
(ii) isalnum( ) - ctype.h

2004 :

(i) gets( ) - stdio.h
(ii) strcmp( ) - string.h
(iii) abs( ) - math.h, stdlib.h
(iv) isalnum( ) - ctype.h

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