Professional Documents
Culture Documents
[Delhi]
Maximum Marks : 70
Note.
Duration : 3 Hours
2
2
2
Examination Paper
(f) Write a C ++ function having two value parameters X and Y with result type float to find the sum of
series given below.
4
1+ X1/2! + X2/3! + ..+ XN/(N+1)!
Ans. (a) (i) Inheritance : It is an ability to derive a new class in terms of an existing class. The existing class
is known as a base class and the new class is known as derived class.
(ii) Encapsulation : It means wrapping up of data and functions which operate on the data into a
single unit called the object (or class).
(b) (i) math.h
(ii) iomanip.h
(iii) ctype.h
(iv) string.h
(c) The correct program is :
# include<iostream.h>
// Correction 1
void main()
{
int R,W=90;
// Correction 2
while (W>60)
// Correction 3
{
R=W-50;
switch (W)
{
case 20:cout<<"Lower Range"<<endl; // Correction 4
case 30:cout<<"Middle Range"<<endl; // Correction 5
case 40:cout<<"Higher Range"<<endl; // Correction 6
}
}
}
(i) Name the base class and derived class of the class QQQ.
(ii) Name the data member(s) that can be accessed from function DISP() .
(iii) Name the member function(s), which can be accessed from the objects of class RRR.
(iv) Is the member function OUT() accessible by the objects of the class QQQ ?
Ans. (a) A copy constructor is that constructor which is used to initialize one object with the values from
another object of same class during declaration. A constructor overloading is similar to function
overloading as it can also be overloaded for various combinations of parameter types. The only
difference is that the overloaded function can return a value while the overloaded constructor
cannot return a value.
(b) // Class and function declaration of the student data
class student
{
int admno;
char sname[20];
float eng, math, science;
float total;
Examination Paper
float ctotal()
{
return (eng + math + science);
}
public :
void Takedata()
{
cout << "Enter admission no : ";
cin >> admno;
cout << "Enter name : ";
cin >> sname;
cout << "Enter english mark : ";
cin >> eng;
cout << "Enter math mark : ";
cin >> math;
cout << "Enter science mark : ";
cin >> science;
total = ctotal();
}
void Showdata()
{
cout << "Admission no is : " << admno<<endl;
cout << "Name is : " << sname << endl;
cout << "English mark : " << eng<<endl;
cout << "Math mark : " << math<<endl;
cout << "Science mark : " << science << endl;
cout << "Total mark is : " << total<<endl;
}
};
(c)
3. (a)
(b)
(c)
(d)
(e)
Ans. (a) // This function search an element in an array using binary search.
int binary(float P[10], float data ,int n)
{
Examination Paper
}
cout<<"\n\t sum of " <<(i+1)<<"column is "<<sum;
Operation
Stack
50
40
+
PUSH 50
PUSH 40
POP 40
POP 50
Calculate 50+40 = 90
PUSH 90
PUSH 18
PUSH 14
POP 14
POP 18
Calculate 1814 = 4
PUSH 4
PUSH 4
POP 4
POP 4
Calculate 4*4 = 16
PUSH 16
POP 16
POP 90
Calculate 90+16 = 106
PUSH 106
50
50, 40
18
14
4
*
Ans = 104
(e) // Declaration for linked stack
struct node
{
int data;
node *link;
};
// Function body for delete stack elements
node *pop(node *top,int &val)
{
node *temp;
clrscr();
if (top == NULL )
{
cout<<"Stack Empty ";
val = 1;
}
else
{
temp = top;
top = top->link;
val = temp->data;
temp->link = NULL;
90
90, 18
90, 18, 14
90, 4
90, 4, 4
90, 16
106
delete temp;
}
return (top);
}
2
4
class EMPLOYEE
{
int ENO;
char ENAME[10];
public :
void GETIT() {cin>>ENO;(ENAME);}
void SHOWIT(){cout<<ENO<<ENAME<<endl;}
};
5. (a) What is relation ? What is the difference between a tuple and an attribute ?
2
Write the SQL commands for (b) to (g) and write the outputs for (h) on the basis of the table
HOSPITAL:
Examination Paper
TABLE : HOSPITAL
(b)
(c)
(d)
(e)
(f)
(g)
(h)
Ans. (a)
(b)
(c)
(d)
(e)
(f)
(g)
(h)
6. (a)
(b)
(c)
(d)
No.
Name
Age
Department
Dateofadm
Charges
Sex
Arpit
62
Surgery
21/01/98
300
Zarina
22
ENT
12/12/97
250
Kareem
32
Orthopaedic
19/02/98
200
Arun
12
Surgery
11/01/98
300
Zubin
30
ENT
12/01/98
250
Ketaki
16
ENT
24/02/98
250
Ankita
29
Cardiology
20/02/98
800
Zareen
45
Gynaecology
22/02/98
300
Kush
19
Cardiology
13/01/98
800
10
Shilpa
23
Nuclear Medicine
21/02/98
400
X.Y
(X.Y)
X+Y
F = uvw + uv + uw + z
Examination Paper
sum = x + y
y
carry = x . y
(f) The Boolean expression X + YZ using NOR gate is :
x
x + yz
y
z'
(g)
7. (a)
(b)
(c)
(d)
Ans. (a)
(b)
(c)
(d)