Reg. No. : Question Paper Code : 97044 B.E./B.Tech. DEGREE EXAMINATION NOVEMBER/DECEMBER 2014 Third Semester Computer Science and Engineering CS 6301 PROGRAMMING AND DATA STRUCTURES-II (Regulation 2013) Time: Three hours Maximum: 100 marks Answer ALL questions PART A (10 2 = 20 marks) 1 Define data abstraction. 2. Write a member function to find the greatest of two numbers using this pointer. 3. Mention any four operators of C++ that cannot be overloaded. 4. What are pure virtual functions? Give example. 5. Give an example on function template. 6. What is the significance of Iterators? 7. Define Fibonacci heaps. 8. What is meant by amortized analysis? 9. Give the ways in which a graph can be represented with an example 10. Define minimum spanning tree. PART B (5 16 = 80 marks) 11 (a) i. List the different types of constructors. Write a program to illustrate the use of different types of constructors. (10) Brief on the features of C++ programming language. (6) (b) i. Explain the ways in which member functions of a class can be defined and called using a suitable example.. (10) Explain with an example the use of static members. (6)
12 (a) i. Write a program to perform string copy operation using dynamic constructor. (6) Consider the following arithmetic expressions : C = 2 + B and K = S T, where B, C, K, S and T are the objects of a class called 1DArray. Write a program to perform these operations by overloading the + and operators appropriately. (10) (b) i. Write a program to perform dynamic initialization of objects. (6) Write a program to illustrate the process of multi-level multiple inheritance concept of C++ language. (10) 13 (a) i. Write a program to illustrate the concept of re-throwing an exception. (8) Write a program to read a string to store it in a file, and read the same string from the file to display it on the output device. (8) (b) i. What is a STL? Brief on its key components and their types. (8) Write a function template to find the minimum value contained in an array. (8) 14 (a) i. What is as Red-Black tree? Mention the properties that a Red-Black tree holds.. (6) Show the results of inserting 43, 11, 69, 72 and 30 into an initially empty AVL tree. Show the results of deleting the nodes 11 and 72 one after the other of the constructed tree. (10) (b) i. What is a B-tree? Mention the properties that a B-tree holds. (6) Construct a binary search tree by inserting 30, 10, 4, 19, 62, 35, 28, 73 into an initially empty tree. Show the results of splaying the nodes 4 and 62 one after the other of the constructed tree. (10) 15 (a) i. Write an algorithm for breadth first search on a graph and give the nodes of the graph G" given in fig.15(a) based on the algorithm. (6) i. Using Dijkstra s algorithm, find the shortest path from the source to all other nodes of the graph 'G given in fig.15(a). (10)
Fig. 15(a) (b) i. Illustrate the working of Warshall s algorithm. (6) Consider a directed acyclic graph D given in fig.15(b). Sort the nodes of D by applying topological sort on D. (10) Fig. 15 (b)
Reg. No. Question Paper Code : 57236 B.E./B.Tech. DEGREE EXAMINATION MAY/JUNE 2016 Third Semester Computer Science and Engineering CS 6301 PROGRAMMING AND DATA STRUCTURES II Time : Three hours (Common to Information Technology) (Regulation 2013) Maximum : 100 marks Answer ALL questions PART A (10 2 = 20 marks) 1 When do you declare a member of a class static? 2. List out the advantages of using storage classes. 3. How does a C string differs from a C++ type string? 4. Distinguish the term overloading and overriding. 5. Distinguish the term template class and class template. 6. List out the types of containers. 7. List out the various operations that can be performed on B-trees. 8. What is amortized analysis? 9. What are the different ways to represent the graph? 10. List out the applications of depth-first search. PART B (5 16 = 80 marks) 11 (a) i. Describe the different mechanisms for accessing data members and member functions in a class with a suitable example. (10) Explain the role of this pointer. (6) OR (b) What is a constructor? Explain the different types of constructors with suitable examples. (16)
12 (a) i. Write a C++ program to overload the decrement operator with prefix and postfix forms. (8) Explain any two types of inheritance supported in C++ with suitable examples. (8) OR (b) With suitable C++ program explain how the polymorphism is achieved at compile time and run time. (16) 13 (a) i. Write a class template to represent a queue of any possible data type. (8) Illustrate about how exceptions are handled using multiple catch handlers. (8) OR (b) i. Explain the components of STL. (8) Write a C++ program that reads a text file and creates another file that is identical except that every sequence of consecutive blank spaces is replaced by a single space. (8) 14 (a) i. Define AVL tree and starting with an empty AVL search tree, insert the following elements in the given order: 2, 1, 4, 5, 9, 3, 6, 7 (8) Explain AVL rotations with a suitable example. (8) OR (b) Implement the Fibonacci heaps and compare their performance with binary heaps when used in Dijkstra s algorithm. (16) 15 (a) i. Illustrate the Dijkstra s algorithm for finding the shortest path with the following graph. (12)
Illustrate the comparison of Floyd s algorithm with Dijkstra s algorithm (4) OR (b) Find the minimum spanning tree for the given graph using both Prim s and Kruskal s algorithm and write the algorithms. (16)
Reg. No. Question Paper Code : 80287 B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2016. Third Semester Computer Science and Engineering CS 6301 PROGRAMMING AND DATA STRUCTURES II (Common to Information Technology) Time : Three hours (Regulation 2013) Answer ALL questions PART A (10 2 = 20 marks) Maximum : 100 marks 1 List the various storage classes available in C++. 2. Mention the role of this pointer. 3. Give the list of operators that cannot be overloaded. 4. Differentiate compile and run time polymorphism. 5. What is an abstract class? 6. What is a function adaptor? 7. State the uses of virtual functions. 8. Write a note on amortized analysis. 9. Define minimum spanning tree for a graph. 10. List the drawbacks of Floyd-Warshall algorithm. PART B (5 13 = 65 marks) 11. (a) (i) Explain features of object oriented programming in detail. (7) (ii) Discuss the types of constructors with examples (6) (b) (i) What do you mean by static member function? Explain in detail with an example (7) (ii) Give a detailed note on const member function. (6)
12. (a) Describe in detail dynamic memory allocation in C++ with examples. (13) (b) Explain the types of inheritance in detail. (13) 13. (a) (i) Write short notes on C++ exception handling. (7) (ii) Write a C++ program to write a set of characters to a file (6) (b) Explain in detail about different STL containers (13) 14. (a) Explain the possible AVL rotations with algorithm and example. (13) (b) Explain insertion and deletion operations on Fibonacci heaps. Construct Fibonacci heaps for the following set of elements 10, 11, 5, 35, 8, 4, 2, 3, 77, 1, 45. (13) 15. (a) Present the pseudocodes of the different graph traversal methods and demonstrate with an example. (13) (b) Explain how transitive closure of a graph can be found using Warshalls algorithm. (13) PART C (1 15 = 15 marks) 16. (a) Using Dijkstra s algorithm to find the shortest path from the source node A. (15) (b) Write a C++ generic function with multiple parameters that performs recursive binary search on a linear array. (15)