COMPUTER SCIENCE C++

1.b) Name the header file(s) that shall be needed for successful compilation of the following C++ code.

void main( )
{ char Text[40];
strcpy(Text,”AISSCE”);
puts(Text); }

1

Ans: string.h, stdio.h

1.c) Rewrite the following program after removing the syntactical error(s), if any.Underline each correction.

#include<iostream.h>
const int Size 5;
void main( )
{ int Array[Size];
Array={50,40,30,20,10};
for(Ctr=0;Ctr<Size;Ctr++)
cout>>Array[Ctr];}

2

Ans)

#include<iostream.h>
const int Size=5;
void main( )
{ int Array[Size];
Array={50,40,30,20,10};
for(Ctr=0;Ctr<Size;Ctr++)
cout<<Array[Ctr];
}

1.e) Find the output of the following program.

#include<iostream.h>
void Indirect(int Temp=20)
{ for(int I=10;I<=Temp;I+=5)
cout<<I<<”,”;
cout<<endl;
}
void Direct(int &Num)
{ Num+=10;
Indirect(Num);
}
void main( )
{ int Number=20;
Direct(Number);
Indirect( );
cout<<”Number =”<<Number<<endl;
}

3

Ans: Output:

10,15,20,25,30, 10,15,20, Number =30

f) In the following C++ program what is the expected value of Mysore from options (i) to(iv) given below.Justify your answer.

#include<stdlib.h>
#include<iostream.h>
void main( )
{ randomize( );
int Score[ ] = {25,20,34,56,72,63},Myscore;
cout<<Myscore<<endl; } Ii) 25 (ii) 34 (iii) 20 (iv) None of the above.

2

Ans: Expected Output:

(i) None of the above.

 

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/cpp8.php on line 140

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/cpp8.php on line 140

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

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/cpp8.php on line 142