COMPUTER SCIENCE C++

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:

#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/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:

@ a@E@E#rTH

(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 ( mrkdata@yahoo.com )


Warning: include_once(../../ebooks-footer19.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/coumputer-science/cpp23.php on line 143

Warning: include_once(): Failed opening '../../ebooks-footer19.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/coumputer-science/cpp23.php on line 143

Warning: include_once(../../../footer19.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/coumputer-science/cpp23.php on line 145

Warning: include_once(): Failed opening '../../../footer19.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/coumputer-science/cpp23.php on line 145