Important Questions

CBSE Guess > Papers > Important Questions > Class XII > 2010 > Computer Science > Computer Science By Ravi Kiran

CBSE CLASS XII

Q.1.c. Find the syntax error(s), if any, in the following program.
#include<iostream.h>
void main( )
{ int x;
cin>>x;
for( int y=0,y<10,y++)
cout<<x+y;
}

Ans:

#include<iostream.h>
void main( )
{ int x;
cin>>x;
for( int y=0;y<10;y++)

cout<<x+y;
}

Q.1.d. Write the output of the following program.
void main( )
{ int x=5,y=5;
cout<<x- -;
cout<<”,”;
cout<- - x;
cout<<”,”;
cout<<y- -<<”,”<<- -y;
}

Ans:

Output. 5,3,4,4

Q.1.e. Write the output of the following program.
#include<iostream.h>
void X(int &A,int &B)
{ A=A+B;
B=A-B;
A=A-B;
}
void main( )
{ int a=4,b=18;
X(a,b);
cout<<a<<”,”<<b;
}

Ans:

Output:
18,4

Paper By Mr. Ravi Kiran
Email Id : [email protected]