Beruflich Dokumente
Kultur Dokumente
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.
integer
Name
20 characters
Blood group
2 characters
Public :
Input( )
Output( )
Checkgroup( )
Group
Define both the number functions with their given description.
Q10. Define a class in C++ with following description:
(5)
Private Members
Fuel
<=1000
500
1100
2200
Public Members