Important Questions

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

CBSE CLASS XII

2009 Outside Delhi:

Q.1.a. What is the difference between Actual Parameter and Formal Parameter? Give an example in C++ to illustrate both types of parameters. 2

Ans:

The parameters in the function call statement (or calling function) are called as Actual Parameters. The parameters in the function definition (or called function) are called as Formal Parameters.

Eg:

void manip(int x, int y)
{ ---
---
}
void main( )
{
int a,b;
----
Manip(a,b);
}
Here a,b are Actual Parameters and x,y are Formal Parameters.

Q.1.b. Write the names of the header files to which the following belong: 1
(i) setw( ) (ii)sqrt( )

Ans:

(i) setw( ) – iomanip.h (ii)sqrt( ) - math.h

Q.1.c. Rewrite the following program after removing the syntactical errors (if any).
Underline each correction.
include <iostream.h>
include <stdio.h>
class MyStudent
{ int StudentId=1001;
char Name[20];
public
MyStudent( )
{
}
void Register( )
{ cin>>StudentId;
gets(Name);
}
void Display( )
{ cout<<StudentId<<”:”<<Name<<endl;
}
};
void main( )
{ MyStudent MS;
Register.MS( );
MS.Display( );
}

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