Automatically extracted historical question data. Academic accuracy and examination rules require verification.
Section marks require review. Marks charts are withheld.
Part B — 11
Define a Class Time (Hrs and Mins) as a user defined type. Write a the program to
- test your class to’see that it does the following tasks
a. Initialize the members of the-class Time i.e. Hrs and Mins using all the type of
constructors. - 6)
ம். Write a-code to perform the following type conversion . . (4)
Time T71 (3, 50);
int duration = 11; // duration is total mins of T1 |
c. Write acode to overload the following. T1=T2+T3 using friend - .
function (T1,T2 and T3 are Time objects) 6)
DefinitionSource quality review required
Part B — 12a
a) i) Consider the following class hierarchy. The class master derives information
from both account and admin classes which in turn derive information from the class
person. Define all the four classes. What will -be the problem in this class hierarchy
and how-do you solve it. Also write a program to create, update and display the
information contained in master objects.
J Person
— a Name, Code “a
Account | Admin
Ray. ் | eapenence
ww
Master
Name, Code ,
| Pay . experience
ii) Two files DATA1 and DATA2 contain sorted list of integers. Write a program to
produce a third file DATA which holds a single sorted, merge list of these two lists.
(oR) ன ச
b) i) Write a class template to represent a- generic vector. Include the member
functions to perform the following tasks: . . ee)
A. To create the vector
B. Find the minimum element and return that element. ...
C. Write a function template for swap. Sort the elements using
-. swap function.
ii) How do you achieve Runtime Polymorphism? With example code explain
runtime polymorphism. ன க, (8)
Other Or UnclassifiedSource quality review required
Part B — 13a
a) i) Write a routine for insertion and deletion in a Queue. Check for necessary
condition before doing the operation. (8):
ii) Given Input {4371, 1323, 6173, 4199, 4121, 4344; 9679} and a hash function
09- X mod 10 , show the resulting : (8)
A. Open addressing hash table using linear probing (4)
8. Open addressing hash table using quadratic probing (4)
Other Or UnclassifiedSource quality review required
Part B — 13b
b) i) Create a min heap.using the following elements: 10,12, 1, 14, 6, 5, 8,15, 3,
. 9,7, 4,2. Also perform deletemin operation twice in the above min | heap
_ and show the resultant heap. (8).
~ ji) Convert the following infix expression to postfix expression and also evaluate.
the expression using stack. 3+5*4+2*7 48).
. | 14. a) i) Write routines to implement the following basic binary search tree operations.
(19)
A. Insertion (3)
B. Deletion (3)
C. Show the result of inserting 2, 1,4, 5, 9, 3, 6, 8, 7 into an empty binaiy
search tree. (4) .
ii) Show the result of applying topological sort to the following graph — 6)
Other Or UnclassifiedSource quality review required
Part B — 13b
b) i) Insert the following elements in the initially empty AVL tree and how do you
-balance the tree after each element insertion? ~ (6). .
Elements — 3, 5, 4, 6, 9, 7, 8, 2, 1, 12, 10
ii) Write a routine to find minimum spanning tree (Prim’s/ Kruskal’s) in a graph.
Find the minimum spanning tree in the following undirected graph (Show the
result of each stage ) (10)
Other Or UnclassifiedSource quality review required
Part B — 15a
a) i) What is divide and conquer technique? Write a routine and explain how the
divide and conquer technique used in merge sort. (10):
it) Show the result of running shellsort on the input 10,12,9,8,7 6, 11, 5,3, 4, 2,.1
using the increments {6, 3, 1} இ.
06)
ட) i) Write a routine and explain the quick sort algorithm with example. ட... (10).
1) Sort the sequence 3, 8, 5, 2, 9, 4, 1, 6, 7 using Insertion sort. . (6)
Other Or UnclassifiedSource quality review required