Sie sind auf Seite 1von 11

B.E./B.Tech.

DEGREE EXAMINATION, NOVEMBER/DECEMBER 2009


Third Semester
Electronics and Communication Engineering
EC 2202 — DATA STRUCTURES AND OBJECT ORIENTED
PROGRAMMING IN C++
(Regulation 2008)
Time: Three hours Maximum: 100 Marks
Answer ALL questions
PART A — (10 × 2 = 20 Marks)

1. When do we declare a member of a class static?


2. Why is it necessary to overload an operator?
3. What is an abstract class?
4. What does ‘this’ pointer point to?
5. What is deque?
6. What is a heap and mention its types?
7. What is AVL Tree?
8. When does a graph become tree?
9. What is the worst case and best case time complexity of binary tree sort?
10. What is indexed sequential search?

PART B — (5 × 16 = 80 Marks)

11. (a) (i). What is a friend function? What are the merits and demerits of using friend
function? (8)

(ii) Define a class ‘string’. Use overload ‘==’ operator to compare two strings. (8)

Or

(b) (i) What is a parameterized constructor? Explain with example. (8)

(ii) What is a conversion function? How is it created? Explain its syntax. (8)
12. (a) (i) Describe the syntax of multiple inheritance. When do we use such an

Inheritance? (10)

(ii) What is a virtual function? When do we make a virtual function “pure”? (6)

Or

(b) (i) What is a file mode? Describe the various file mode options available. (8)

(ii) What is an exception? How is an exception handled in C++? (8)

13. (a) (i) Define double linked list. Explain the various operations of double linked list
with algorithm. (16)

Or

(b) (i) What is hashing? Explain the various hash functions with example. (10) (ii) What

is Priority queue? Discuss the array implementation of priority queue. (6)

14. (a) Discuss the different methods of traversing a binary tree with algorithm. (16)

Or

(b) Discuss Prim’s and Kruskal’s algorithm for computing the minimal spanning tree
weighted undirected graph. (16)

15. (a) (i) Write a ‘C’ program to implement binary search and compute its complexity.(8)

(ii) Compare the worst case and best case time complexity of various sorting
techniques. (8)

Or

(b) Explain the all pairs shortest path algorithm with an example. (16)
B.E./B.Tech. DEGREE EXAMINATION, APRIL/MAY 2010
Third Semester
Electronics and Communication Engineering
EC2202 — DATA STRUCTURES AND OBJECT ORIENTED
PROGRAMMING IN C ++
(Regulation 2008)
Time: Three hours Maximum: 100 Marks
Answer ALL Questions
PART A — (10 × 2 = 20 Marks)

1. How is a class declared in C++?


2. What is a scope resolution operator and how can it be used for global
variable?
3. What is meant by binding?
4. How the pointer is implemented in C++?
5. Write any two data structures used in Operating System?
6. What are the representations of Big and small „O notations?
7. How many trees are possible with 3 nodes?
8. What is a spanning tree?
9. What is the feature of bucket sort algorithm?
10. Define dynamic programming.

PART B — (5 × 16 = 80 Marks)
11. (a) (i) Give the syntax and usage of the reserved word inline with two
examples. (8)
(ii) Explain the importance of constructors and destructors with
example. (8)
Or
(b) What is operator overloading? Overload the numerical operators „+and /
for complex numbers “addition” and “division” respectively. (16)
12. (a) (i) Define friend class and specify its importance. Explain with
suitable example. (8)
(ii) Discuss Virtual function and polymorphism with example. (8)
Or
(b) (i) Explain the concept of inheritance by considering an example of
“vehicle”. (8)
(ii) Explain the operators used for dynamic memory allocation with
examples. (8)
13. (a) (i) Explain Priority Queues and how are binary heaps used in that. (8)
(ii) Explain the properties of heap. (8)
Or
(b) (i) Write a C ++ program to implement Stack and its operations PUSH
and POP. (10)
(ii) What is hashing? Classify hashing functions based on the various
methods. (6)
14. (a) (i) Traverse the tree given below using Inorder, Preorder and
Postorder traversals. (10)
(ii) Convert the expression ((A + B) * C - (D - E) ^ (F + G)) to equivalent
Prefix and postfix notations. (6)
Or

(b) (i) Convert the given graph with weighted edges to minimal spanning
tree. (10)
(ii) Write a short note on AVL trees. (6)
15. (a) Explain the algorithm of Quicksort by sorting the following set of
numbers as an example:
42 47 52 57 62 37 32 27 22
Or
(b) Describe divide and conquer technique with the help of mergesort. (16)
B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2010
Third Semester
Electronics and Communication Engineering
EC 2202 — DATA STRUCTURES AND OBJECT ORIENTED
PROGRAMMING IN
C++
(Regulation 2008)
Time : Three hours Maximum : 100
Marks Answer ALL questions
PART A — (10 × 2 = 20 Marks)

1. What effects do the visibility labels private, protected and public have
on the members of a class?
2. What are the advantages of operator overloading?
3. What is inheritance? What are its advantages?
4. Define virtual function.
5. Define stack. Mention the operations on stack.
6. What is binary heap? What are its types?
7. What is meant by an adjacency matrix?
8. State the properties of binary search tree.
9. What is sorting? How is sorting essential for data base applications?
10. What is meant by dynamic programming?

PART B — (5 × 16 = 80 Marks)
11. (a) (i) Compare and contrast Structured Programming and Object
Oriented Programming. (8)
(ii) Distinguish between Data Encapsulation and Data Abstraction. (4)
(iii) Mention the purpose of Constructor and Destructor functions. (4)
Or
(b) (i) Explain the control structures of C++ with suitable examples. (12)
(ii) Define function overloading with a simple example. (4)
12. (a) (i) Differentiate inheritance from polymorphism. (6)
(ii) Write a C++ program to illustrate the concept of hierarchical
inheritance. (10)
Or
(b) (i) What is the use of template? Write an overloaded function template
called max( ), which will find the maximum of any two given
integers. (8)
(ii) Explain the exception handling mechanism of C++ in detail. (8)
13. (a) (i) Explain the operations performed on queue in detail. Write a C++
program to implement these queue operations. (10)
(ii) Explain insertion, deletion and replacement of nodes in a heap. (6)
Or
(b) (i) What are the advantages of linked list over array? (4)
(ii) Define Hashing. (2)
(iii) Write a C++ program to implement stack through linked list. (10)
14. (a) (i) Write an algorithm to traverse binary tree level by level, with each
level of the tree being traversed from left to right. (10)
(ii) Explain spanning tree and minimal spanning tree with examples. (6)
Or
(b) (i) Define AVL tree. Explain the operations on AVL tree with
illustrations. (6)
(ii) Explain breadth first search algorithm for the traversal of any
graph with suitable examples. Define time complexity of the
algorithm. (10)
15. (a) (i) Explain heap sort with an illustration. (8)
(ii) Explain the greedy algorithm to find minimum spanning tree. (8)
Or
(b) (i) Explain the insertion sort with its time complexity. (8)
(ii) Explain as to how divide and conquer technique can be applied for
merge sort. (8)
B.E./B.Tech. DEGREE EXAMINATION, APRIL/MAY 2011
Third Semester
Electronics and Communication Engineering
EC 2202 — DATA STRUCTURES AND OBJECT ORIENTED PROGRAMMING IN
C++
(Regulation 2008)
Time: Three hours Maximum: 100
Marks
Answer ALL questions.
PART A — (10 × 2 = 20 Marks)
1. What are the advantages of using ‘new’ operator as compared to ‘malloc ()’
function?
2. Give the syntax of Operator function.
3. State the difference between ‘char * const ptr’ and ‘char const * ptr’.
4. List out the modes in which the files can be opened.
5. What is the advantage of doubly linked list over single linked list?
6. What is meant by collision in hashing?
7. When a binary tree does become binary search tree?
8. Define minimum spanning tree.
9. Which is the fastest sorting algorithm in practice? What is the average and worst
case running time of it?
10. Give the working method of Divide and Conquer in two simple steps.

PART B — (5 × 16 = 80 Marks)

11. (a) (i) Explain the concept of passing by reference using reference variables. (6)
(ii) Write a C++ program to assign ‘n’ projects to ‘m’ programmers based on
the skill set of programmers using friend function. Use static variable to count total
number of assignments. (10)
Or
11. (b) (i) Define ‘Copy constructor’ and ‘Dynamic constructor’. What are the different
ways of writing copy constructor? (6)
(ii) Write a note on constructors and destructors. (10)

12. (a) Write a C++ program to define a class called ‘patient’ (name, age, sex). Derive
two classes from ‘patient’ namely ‘in-patient’ (ipno, date-of-adm, date-of-
discharge) and ‘out-patient’ (opno, doctor-id, and consultation-fee). Define two
classes namely ‘general-ward’ (rent/day) and ‘special-ward’ (roomno, rent/day, eb-
bill). For out-patient print the bill with consultation-fee. For in-patients, print bill
According to their accommodation either in general-ward or special-ward. (16)
Or
(b) (i) Write a program to maintain employee details using files. Arrange the file in
descending order of their salary. (8)
(ii) What is called pure virtual function? (3)
(iii) Explain the concept of multiple catch statements in exception handling.(5)
13. (a) (i) Describe general rules to be considered while calculating time complexity of
an algorithm. (6)
(ii) Write an algorithm to insert an element into a stack and a queue. Can stack
be used for recursion? Justify your answer. (10)
Or
(b) (i) Explain basic Heap operations and some of specialized operations with
examples. (8)
(ii) Give the algorithm for inserting an element and deleting an element in a
linked list. (8)

14. (a) What is an AVL tree? What are the different case issues when an element is
inserted into an AVL tree? How to solve those issues? (16)

Or

(b) (i) Write down the Dijkstra’s algorithm and explain it with example. (8)
(ii) Consider the following diagram. Using Prim’s algorithm and Kruskal’s
algorithm draw all the intermediate stages of the graph to find minimum spanning
tree. (8)

10

7 G
1
4 B 2
6
5 C E
A 6
8 6 2
D 3
F

15. (a) (i) Give the algorithm for insertion sort. (8)
(ii) Illustrate the intermediate steps of heap tree using heap sort for the given set
of numbers. (8)
67, 3, 24, 45, 9, 12, 30, 29, 90.

Or

(b) (i) How do the Greedy algorithms work? (5)


(ii) Write the algorithm for All-pairs shortest path and explain it with an
example. (11)
B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2011
Third Semester
Electronics and Communication Engineering
EC 2202 — DATA STRUCTURES AND OBJECT ORIENTED PROGRAMMING IN
C++
(Regulation 2008)
Time: Three hours Maximum: 100
Marks
Answer ALL questions.
PART A — (10 × 2 = 20 Marks)
1. What is the significance of contour structures?
2. List the type conversions present in C++.
3. What is polymorphism?
4. How are file handling templates useful in programming?
5. How is data stored in QUEUE structure?
6. Insertion sort is faster than bubble sort. – Justify this statement.
7. Differentiate between trees and graphs.
8. Does the minimum spanning tree of the graph give the shortest didtance
between any two specified nodes? When it is possible?
9. Compare and contrast greedy method and dynamic programming.
10. Which data structure is suitable for implementing backtracking?
PART B — (5 × 16 = 80 Marks)
11. (a) (i) Explain the functions of C++ with suitable examples. (8)
(ii) Explain about contour structures. (8)
Or
(b) (i) Explain the type conversions present in C++. (8)
(ii) Write a note on constructors and destructors. (8)

12. (a) (i) Write a program to explain the significance of pointers in C++. (8)
(ii)Explain about virtual functions. (8)
Or
(b) (i) Explain about file handling templates. (8)
(ii) Illustrate Exception handling with an example in C++. (8)
13. (a) (i) Explain the operations performed by stack in detail. Write a C++ program
to implement these operations. (8)
(ii) Write a program to insert a node using heap. (8)
Or
(b) (i) Design an algorithm to split a circular list into two circular lists. (8)
(ii) Formulate an algorithm to create an ordered linear list with no duplicate
terms. The input is a polynomial with three variables that is unordered and has
repeated terms. (8)

14. (a) (i) Explain with illustration the various types of rotations needed to retain the
properties of an AVL tree during insertions of a node. State the time complexity
of insertion of a node into an AVL. (8)
(ii) Draw the result of inserting 20, 10, and 24 one by one into the AVL tree given
below. Draw the tree after each insertion.
(8)
53

72
25

12 38 64 83

7 58 75
19

Or

14. (b) Consider the following graph G. The label of an edge is the cost of the edge.

30

a 40 b 30 c

20 10 30

40

e 20 f

d 50

(i) Give the representation of the graph G in a computer. What is the space complexity?
(8)
(ii) Using kruskals algorithm, draw a minimum spanning tree (MST) of the graph G
describing each step of the algorithm. Also write down the order in which the edges
are selected. (8)
15. (a) (i) Explain the algorithm and program of selection sort. (8)
(ii) Write short notes about heap sorting. (8)
Or
(b) Consider the array Heap = [ 3,5,6,7,20,8,2,9,12,15,30,17]. Consider an empty heap.
Construct a MAX HEAP while inserting these values one by one. Display the heap
after each insertion. Show the result in array format. Now insert elements 15, 20 and
45 using the bubbling up process. Show the max heap following each insert.
B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2012
Third Semester
Electronics and Communication Engineering
EC 2202 — DATA STRUCTURES AND OBJECT ORIENTED PROGRAMMING IN C++
(Regulation 2008)
Time: Three hours Maximum: 100 Marks
Answer ALL questions.
PART A — (10 × 2 = 20 Marks)

1. Define object.
2. What is constructor?
3. List out the operators which cannot be overloaded.
4. What does multiple inheritance mean?
5. What are the basic data structures available in C++?
6. Define heap.
7. When the tree is called Complete binary tree?
8. Define ADT.
9. Define spanning tree.
10. What is the worst case and best case no. of comparisons in a linear search?

PART B – (5 x 16 = 80 marks)
11. (a) Write a menu-driven program to accept 2 integers and an operator (+,-,*, %,/)
and to perform the operation and print the result.
Or
(b) Specify a class called complex to represent complex numbers. Overload +, -
and * operators when working on the objects of this class.
12. (a) Define Friend Function. What is polymorphism? Explain multiple
inheritance. Or
(b) What is string? Write a C++ Program to sort the given strings in the
alphabetically.
13. (a) Explain the operations of Binary heap.
Or
(b) Write algorithms for insertion and deletion in linked stack.
14. (a) Describe the shortest path identification using dijkstra’s algorithm.
Or
(b) What is graph? Explain the depth first search tree.
15. (a) Describe the concept of Bubble Sort & Merge sort with example.
Or
(b) With example explain the binary search technique.

Das könnte Ihnen auch gefallen