CBSE Guess > Papers > Important Questions > Class XII > 2010 > Computer Science > Computer Science By Ravi Kiran
CBSE CLASS XII
1. (a) Differentiate between a Logical Error and Syntax Error. Also give suitable
examples of each in C++.
(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);
}
(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];
}
(d) Find the output of the following program : 2
#include<iostream.h>
void main()
{
int Numbers[] = {2,4,8,10};
int *ptr = Numbers;
for (int C = 0; C<3; C++)
{
cout<< *ptr << “@”;
ptr++;
}
cout<<endl;
for(C = 0; C<4; C++)
{
(*ptr)*=2;
--ptr;
}
for(C = 0; C<4; C++)
cout<< Numbers [C]<< “#”;
cout<<endl;
}
(e) Find the output of the following program :
#include<iostream.h>
void Indirect(int Temp=20)
{
for (int 1=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 ;
}
Paper By Mr. Ravi Kiran
Email Id : [email protected] |