Sie sind auf Seite 1von 5

I UNIT TEST

SESSION: 2014
MAX TIME: 1+1/2hr
MARKS: 40

MAX

Q1. Write the names of the header files to which the following belong:
(5)
(i) isdigit()

(ii) strcmp()

(iii) fabs()

(vi) setw()

(vii) exit()

(viii) tolower()

(iv) gets()

(v) eof()

(ix) ceil()

(x) feof()

Q2. What is the difference between a keyword and an identifier in C++? Give
examples of both.(2)
Q3. What is a reference variable? What is its usage?
(2)
Q4. Differentiate between a Call by Value and Call by Reference, giving suitable
examples of each?
(2)
Q5.

Rewrite the following program after removing the syntactical errors (if
any). Underline each correction.
(2)
#include<iostream.h>
int func(int y =10, int &x)
{
if(x%y = 0) return ++x ; else return y-- ;
}
void main()
{
int p = 20, q = 23;
r = func(p,q);
cout>>p>>q>>r;
}

Q6 . Rewrite the following program after removing the syntactical errors (if any).
Underline each correction.
(2)
#include<iostream.h>
void main()
{
int X[ ]={60,50,30,40},Y; count=4;
cin>>Y;
for(i=count-1;i>=0;i--)
switch(i)
{
case 1;
case 2: cout<<Y * X; break;
case 3: cout<<Y+ Y;
}
}
Q7. Find the output of the following program:
#include <iostream.h>
void main()
{
long NUM = 98534210;
int f=0,s=0;
do
{
int rem = NUM % 10;
if( rem % 2 == 0)
f += rem;
else
s += rem;

(3)

NUM /= 10;
}while(NUM > 0);
cout<<\n<<f<< <<s<< = <<f s;

}
Q8. Find the output of the following program: (3)
#include <iostream.h>
#include<ctype.h>
void main()
{
char *name= "ThE bESt meN wIN";
for ( int i =0; name[i]!='\0' ; i++)
{
if ( islower( name[i]) )
name[i] = toupper(name[i]) ;
else
if( isupper(name[i]) )
if ( i%2 == 0)
name[i] ;
else
name[i] = tolower(name[i1]);
}
cout<<name;
}

Q9.

Define a class DONOR with the following specifications : (5)


Private :
Donor number

integer

Name

20 characters

Blood group

2 characters

Public :
Input( )

A function to accept all the information

Output( )

A function to display all the information

Checkgroup( )

A function with char * return to return Blood

Group
Define both the number functions with their given description.
Q10. Define a class in C++ with following description:

(5)

Private Members

A data member Flight number of type integer

A data member Destination of type string

A data member Distance of type float

A data member Fuel of type float

A member function CALFUEL() to calculate the value of Fuel as per


the following criteria
Distance

Fuel

<=1000

500

more than 1000 and


<=2000

1100

more than 2000

2200

Public Members

A function FEEDINFO() to allow user to enter values for Flight


Number, Destination, Distance & call function CALFUEL() to
calculate the quantity of Fuel

A function SHOWINFO() to allow user to view the content of all the


data members

Q.What are the different types of network? (2)


Q. Expand : HTTP, FTP, TCP/IP, SLIP, PPP, NCP, GSM(7)

Das könnte Ihnen auch gefallen