Documente Academic
Documente Profesional
Documente Cultură
COMPUTER SCIENCE
WORKSHEET – I
CH.1 C++ REVISION TOUR
DOI : 20-02-19 DOS:22-02-19
a. (i) cos() (ii) setw() (iii) toupper() (iv) strcpy() b. (i) strcat () (ii) scanf () (iii) getchar() (iv) clrscr ()
c. (i) isupper() (ii) frexp () (iii) exp() (iv) strcmp() d. (i) write() (ii) arc() (iii) open() (iv) strlen()
e. (i) gets ( ) (ii) strcmp( ) (iii) abs( ) (iv) isalnum( ) f. (i) strcmp() (ii) fabs() (iii) getchar() (iv) putchar
2. Which C++ header file(s) will be essentially required to be included to run / execute the following C++
code
3. Rewrite the corrected code for the following program. Underline each correction (if any)
4. Write a function name SUMFUN(), with arguments x and N, which returns the sum of the following series
5. Out of the following, find those identifiers, which cannot be used for naming Variable, Constants or
Functions in a C + + program: Total*Tax, double, case, My Name, New switch, Column31, _Amount
6. Look at the following C++ code and find the possible output(s) from the options (i) to (iv) following it.
Also, write the maximum and the minimum values that can be assigned to the variable Taker
a. b.
void main() void main()
{ {
randomize(); int GuessMe[4]=
int Taker; {100,50,200,20};
Taker =random(3); int Taker = random(2)+2;
char for(int
COLOUR[][5]={"BLUE","PINK","GR Chance=0;Chance<=Taker;Chance
EEN","RED"}; ++)
for(int 1=0;I<= Taker;I++) cout<<GuessMe[Chance]<<"#";
{ }
for(int J=0;J<=I;J++)
cout<<COLOR[J];
cout<<endl;
}
}
7. Based on the following C++ code, find out the expected correct output (s) from the options (i) to (iv). Also, find out
the minimum and the maximum value that can be assigned to the variable Trick used in the code at the time when
value of count is 3 :
a. b. void main()
void main() {
{ int Begin=3,Stop;
char status[][10]={"EXCEL","GOOD", "OK"};
for(int Run=l;Run<4;Run++)
int Turn = 10, Trick;
for(int Count=1;Count<4;Count++) {
{ Stop=random(Begin)+6;
Trick = random(Count); cout<<Begin++<<Stop<<"*";
cout<<Turn-Trick<<Status[Trick]<<"#"; }
} }
} (i) 36*46*57*
(i) 10EXCEL#EXCEL#8OK# (ii) 37*46*56*
(ii) 10EXCEL#8OK#9GOOD#
(iii) 37*48*57*
(in) 10EXCEL#9GOOD#10EXCEL#
(iv) 10EXCEL#10GOOD#8OK# (iv) 35*45*57*