CBSE eBooks
CBSE Guess > eBooks > Class XII > Computer Science By . Mr. MRK
Chapter – 1 C++ Revision Tour

1.b. Name the header file(s) that shall be needed for successful compilation of the following C++ code. 1
void main( )
{
char Text[40];
strcpy(Text,”AISSCE”);
puts(Text);
}
Ans: string.h, stdio.h
1.c. Rewrite the following program after removing the syntactical error(s), if any. Underline each correction. 2
#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];
}
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: 3
#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;
}
Ans: Output:
10,15,20,
25,30,
10,15,20,
Number =30

Computer Science By Mr. MRK
|