Important Questions

CBSE Guess > Papers > Important Questions > Class XII > 2010 > Computer Science > Computer Science By MRK

CBSE CLASS XII

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

Ans. (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. 2
#include [iostream.h]
class PAYITNOW
{ int Charge;
PUBLIC:
void Raise(){cin>>Charge;}
void Show{cout<<Charge;}
};
void main()
{ PAYITNOW P;
P.Raise();
Show();

Ans.
#include <iostream.h>
class PAYITNOW
{ int Charge;
public:
void Raise(){cin>>Charge;}
void Show(){cout<<Charge;}
};
void main()
{ PAYITNOW P;
P.Raise();
P.Show();
}

1.e. Find the output of the following program2
#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;
}

Ans.
@a@E@E#rTH

Paper By Mr. MRK
Email Id : [email protected]@yahoo.com