CBSE eBooks

CBSE Guess > eBooks > Class XII > Computer Science By . Mr. MRK

Chapter – 1 C++ Revision Tour

Previous Index Next

2002:

1.b.N ame the header files of C++ to which the following functions belong:2

  1. get( )
  2. open( )
  3. abs( )
  4. strcat( )

Ans:

  1. get( ) - iostream.h
  2. open( ) - fstream.h
  3. abs( ) - math.h, stdlib.h
  4. strcat( ) - string.h

1.c. Find the syntax error(s), if any, in the following
program. 2

#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;
}

1.d. Write the output of the following program. 2

void main( )
{
int x=5,y=5;

cout<<x- -;
cout<<”,”;
cout<- - x;

cout<<”,”;
cout<<y- -<<”,”<<- -y;
}

Ans: Output: 5,3,4,4

1.e. Write the output of the following program. 3

#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

Previous Index Next