Examination Papers, 1998: (Delhi)
Examination Papers, 1998: (Delhi)
Examination Papers, 1998: (Delhi)
[Delhi]
Maximum Marks : 70 Duration : 3 Hours
Note. All the questions are compulsory.
Programming Language : C++
Examination Paper 1
cout << A << B << endl;
Execute(A, B);
cout << A << B << endl;
}
(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
}
}
}
// Correction 1 : Declaration syntax error # missing before include
// Correction 2 : Undefined symbol ‘W’. So put comma (,) before ‘W’ at ;
// Correction 3 : While statement missing (
// Correction 4 : Unreachable code ‘case’ missing and double quote missing
// Correction 5 : Same as correction 4
// Correction 6 : Same as correction 4
(d) The output is : iNTTaNEE
(e) The output is as :
50 240
290 340 240
340 240
(f) // Function to find the sum of series of float type
float sum_series(float X, float N)
{
float sum = 1.0, temp = 1.0; // Initialize the series first value 1
for (int i = 2; i <= N+1; i++) // Starting series value is 2
{
temp = temp * (X/i); // (4/2!) and so on
sum += temp;
}
return sum;
}
2. (a) What is copy constructor ? What do you understand by constructor overloading ? 2
Examination Paper 3
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) (i) Base class : PPP
Derived class : RRR
(ii) M and U
(iii) DISP(), INDATA(int, int) and OUTDATA()
(iv) No
3. (a) Suppose an array P containing float is arranged in ascending order. Write a user defined function in
C++ to search for one float from P with the help of binary search method. The function should return
an integer 0 to show absence of the number and integer 1 to show presence of the number in the
array. The function should have the parameters as (i) an array P (ii) the number DATA to be searched
(iii) number of elements N. 4
(b) An array T[15][10] is stored in the memory with each element requiring 2 bytes of storage. If the base
address of T is 2000, determine the location of T[7][8] when the array T is stored by 3
(i) Row major (ii) Column major.
(c) Write a user -defined function in C++ to display the sum of column elements of a two dimensional
array R[7][7] containing integers. 2
(d) Evaluate the following postfix expression using a stack and show the contents of stack after execution
of each operation : 2
50, 40, +, 18, 14, –, 4, *, +
(e) Give the necessary declaration of a linked implemented stack containing integer type numbers; also
write a user defined function in C++ to pop a number from this stack. 4
Ans. (a) // This function search an element in an array using binary search.
int binary(float P[10], float data ,int n)
{
Examination Paper 5
}
cout<<"\n\t sum of " <<(i+1)<<"column is "<<sum;
}
}
(d) The stack operation is :
Scanned elements Operation Stack
50 PUSH 50 50
40 PUSH 40 50, 40
+ POP 40
POP 50
Calculate 50+40 = 90
PUSH 90 90
18 PUSH 18 90, 18
14 PUSH 14 90, 18, 14
– POP 14
POP 18
Calculate 18–14 = 4
PUSH 4 90, 4
4 PUSH 4 90, 4, 4
* POP 4
POP 4
Calculate 4*4 = 16
PUSH 16 90, 16
+ POP 16
POP 90
Calculate 90+16 = 104
PUSH 104 104
∴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;
Examination Paper 7
TABLE : HOSPITAL
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
No. Name Age Department Dateofadm Charges Sex
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1 Arpit 62 Surgery 21/01/98 300 M
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
2 Zarina 22 ENT 12/12/97 250 F
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
3 Kareem 32 Orthopaedic 19/02/98 200 M
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
4 Arun 12 Surgery 11/01/98 300 M
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
5 Zubin 30 ENT 12/01/98 250 M
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
6 Ketaki 16 ENT 24/02/98 250 F
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
7 Ankita 29 Cardiology 20/02/98 800 F
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
8 Zareen 45 Gynaecology 22/02/98 300 F
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
9 Kush 19 Cardiology 13/01/98 800 M
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
10 Shilpa 23 Nuclear Medicine 21/02/98 400 F
1234567890123456789012345678901212345678901234567890123456789012123456789012345678901234567890121234
Examination Paper 9
(e) The logic circuit for a half adder is :
x sum = x + y
y
carry = x . y
x
x+yz'
y
z'
(g) H(U,V,W) = (U+V+W’) . (U+V’+W’) . (U’+V+W) . (U’+V’+W)
7. (a) What are repeaters ? 1
(b) What is the difference between LAN and MAN ? 1
(c) Describe the following in brief : 2
(i) MOSAIC (ii) Usenet.
(d) What do you understand by backbone network ? 1
Ans. (a) Repeater is used to regenerate data and voice signals when they become weaker before reaching
destination node. Repeater reads the incoming packet and amplifies it and transmits to another
segment of the network.
(b) LAN and MAN is different in their geographical area and the speed of transfer. LAN is restricted to
one building or nearby two or three buildings but MAN can cover one metropolitan, i.e., from one
small city to one town.
(c) (i) MOSAIC : Mosaic is a program for cruising the Internet. The National Centre wrote this
program for Supercomputer Application at the university of Illinois. It has a simple windows
interface, which creates useful hypertext links that automatically perform some of the menu bar
and button functions.
(ii) Usenet : In Internet, Usenet is the way to meet people and share information. Usenet newsgroup
is a special group set up by people who want to share common interests ranging from current
topic to cultural heritages.
(d) When we connect number of LANs to form one WAN, the network which is used as a backbone to
connect the LANs is called backbone network.