COMPUTER SCIENCE C++

1.b) Name the header file, to which the following built-in function belongs:(i) strcmp( ) (ii)getc( ) .

1

Ans:    (i) strcmp( ) - string.h
            (ii) getc( ) - stdio.h

1.c) Rewrite the following program after removing all the syntax error(s) if any.

#include<iostream.h>
void main( )
{ int P[ ]={90,10,24,15};Q,Number=4; Q=9;
for[int I=Number-1;I>=0,I--]
switch(I){ case 0;
case 3:cout>>P[I]*Q<<endl;break;
case 1:
case 2: cout<<P[I]+Q;
}
}

2

Ans:

#include<iostream.h>
void main( )
{ int P[ ]={90,10,24,15},Q,Number=4; Q=9;
for(int I=Number-1;I>=0;I--)
switch(I)
{ case 0:
case 3:cout<<P[I]*Q<<endl; break;
case 1:
case 2: cout<<P[I]+Q;
}
}

1.e) Write the output of the following program:

#include<iostream.h>
int Execute(int M)
{ if(M%3==0)
return M*3;
else
return M+10;
}
void Output(int B=2)
{ for(int T=0;T<B;T++)
cout<<Execute(T)<<”*”;
cout<<endl;
}
void main( )
{ Output(4);
Output( );
Output(3);
}

 

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/cpp14.php on line 124

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/cpp14.php on line 124

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

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/cpp14.php on line 126