1.b) Write the names of the header files to which the following belong: 1(i) strcmp() (ii) fabs()
Answer: (i)string.h (ii) math.h
(1/2 Mark for mentioning name of each header file)
1.c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction.
#include [iostream.h]
class PAYITNOW
{ int Charge;
PUBLIC:
void Raise(){cin>>Charge;}
void Show{cout<<Charge;}
};
void main()
{ PAYITNOW P;
P.Raise();
Show();}
2
Answer:
|
(1/2 Mark for correcting each error) OR(1 Mark for identifying all the 4 errors with no correction)
1.e) Find the output of the following program.
#include <iostream.h>
#include <ctype.h>
void Encrypt(char T[])
{ for (int i=0;T[i]!='\0';i+=2)
if (T[i]=='A' || T[i]=='E')
T[i]='#';
else if (islower(T[i]))
T[i]=toupper(T[i]);
else
T[i]='@';
}
void main()
{ char Text[]="SaVE EArtH";
//The two words in the string Textare separated by single space
Encrypt(Text);
cout<<Text<<endl;}2
Answer:
|
(1 Mark for writing all alphabets at correct positions) (1/2 Mark for writing @ at correct positions) (1/2 Mark for writing # at correct position)
CBSE Computer Science Solved Revision Tour By Mr. Ravi Kiran ( [email protected] )