Anda di halaman 1dari 15

MAHALAKSHMI

ENGINEERING COLLEGE

TIRUCHIRAPALLI - 621213. QUESTION BANK


DEPARTMENT: ECE SUBJECT CODE: EC2202
SEMESTER III

SUBJECT NAME: DATA STRUCTURES AND OBJECT ORIENTED PROGRAMMING


UNIT I PART A (2 MARKS)

1. When do we declare a member of a class static? 2. Why is it necessary to overload an operator?

(AUC DEC 2009) (AUC DEC 2009)

3. What is a scope resolution operator and how it can be used for global variable? (AUC MAY 2010) 4. How is a class declared in C++? (AUC MAY 2010)

5. What effects do the visibility labels private, protected and public have on the members of a class? 6. What are the advantages of operator overloading? (AUC DEC 2010) (AUC DEC 2010)

7. What are the advantages of using new operator as compared to malloc() function? (AUC MAY 2011) 8. Give the syntax of operator function? 9. What is the significance of contour structures? 10. List the type conversions present in C++. 11. Compare procedural and object oriented language. 12. How will you use streams for input and output? 13. What is dynamic binding? 14. Can inline functions can be compared to macros. Justify? 15. Can polymorphism occur in member functions? Explain. (Function overloading) 16. What is a constructor? Explain copy constructor. 17. Define destructor. 18. What is call by value and call by reference. 19. Define new and delete operators. 20. How will you pass objects as arguments using pass-by-reference method? 21. Write about the memory allocation of members of a class? 22. Define friend functions and explain its characteristics. (AUC MAY 2011) (AUC DEC 2011) (AUC DEC 2011)

M.Sathya . Asst. Prof / CSE

23. List out the operators which cannot be overloaded and cannot be overloaded using friend functions. 24. Explain basic to class type conversion. 25. Write about keywords, identifiers and constants. 26. What are the types of expressions? 27. State the use of void in C++. 28. Define an enumeration data type. 29. What are the properties of static data member and member functions? 30. What are the ways in which a constructor can be called? PART B (16 MARKS)

1. (i) Explain the functions of C++ with suitable examples. (8) (ii) Explain about contour structures. (8) 2. (i) Explain the type conversions present in C++. (8) (ii) Write a note on constructors and destructors. (8) (AUC DEC 2011) (AUC DEC 2011)

3. (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) (AUC MAY 2011)

4. (i) Define copy constructor and dynamic constructor. What are all the different ways of writing copy constructor? (6) (ii) Where to use friend function in binary operator overloading? How? Explain with an example. (10) (AUC MAY 2011)

5. (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) (AUC DEC 2010) 6. (i) Explain the control structures of C++ with suitable examples. (12) (ii) Define function overloading with a simple example. (4) (AUC DEC 2010)

7. (i) Give the syntax and usage of the reserved word inline with two examples. (8) (ii) Explain the importance of constructor and destructor functions. (AUC MAY 2010) 8. What is operator overloading? Overload the numerical operators + and / for complex numbers addition and division. (AUC MAY 2010)

M.Sathya . Asst. Prof / CSE

9. (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) (AUC DEC 2009) 10. (i) What is a parameterized constructor? Explain with example. (8) (ii) What is a conversion function? How is it created? Explain with example. (8) (AUC DEC 2009) 11. Explain the basic concepts of object oriented programming. 12. (i) What are the advantages of using default arguments? Explain with example program. (8) (ii) Write a program to demonstrate how a static data can be accessed by a static member function? (8) 13. Write a program to get the student details and print the same using pointers to objects and pointers to members of a class. Create a class student. And use appropriate member functions. 14. (i) Explain unary operator overloading and list the rules overloading the operators with example. (8) (ii) Write a C++ program to check whether the string is palindrome or not. (8)

M.Sathya . Asst. Prof / CSE

UNIT II PART A (2 MARKS) 1. What is an abstract class? 2. What does this pointer point to? 3. What is meant by binding? 4. How the pointer is implemented in C++? 5. What is inheritance? What are its advantages? 6. Define virtual function. (AUC DEC 2009) (AUC DEC 2009) (AUC MAY 2010) (AUC MAY 2010) (AUC DEC 2010) (AUC DEC 2010)

7. State the difference between char * const ptr and char const * ptr. (AUC MAY 2011) 8. List the modes in which the files can be opened? 9. What is polymorphism? 10. How are file handling templates useful in programming? 11. Define the various types of inheritance with example. 12. What is virtual base class? 13. How can a private member be made inheritable? 14. List and define the types of polymorphism. 15. What is template function? What is operator function? 16. What are advantages of multiple inheritance? 17. How is polymorphism achieved at compile time and run time? 18. What are virtual destructors? How do they differ from virtual constructors? 19. Distinguish between overloaded functions and function templates 20. When do we need multiple catch Handlers? 21. Write a program to demonstrate the concept of rethrowing an exception. 22. What is the need for template function in C++? What are the advantages? 23. What are templates? 24. Illustrate the exception handling mechanism. 25. What happens when a raised exception is not caught by catch block? 26. Give the syntax of a pointer to a function which returns an integer and takes arguments one of integer type and 2 of float type. What is the difference between a class and a structure? 27. How do virtual funs differ from overloaded funs? What is difference between public, private &protected inheritance? 28. What difference is between compile time and run time polymorphism? 29. What are the applications of this pointer? 30. Distinguish between virtual class and abstract class
M.Sathya . Asst. Prof / CSE

(AUC MAY 2011) (AUC DEC 2011) (AUC DEC 2011)

PART B (16 MARKS)

1. (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) (AUC DEC 2009)

2. (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) (AUC DEC 2009) 3. (i) Discuss friend class and specify its importance. Explain with example. (8) (ii) Discuss virtual function and polymorphism with example. (8) (AUC MAY 2010) 4. (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) (AUC MAY 2010) 5. (i) Differentiate inheritance from polymorphism. (6) (ii) Write a C++ program to illustrate the concept of hierarchical inhgeritance. (10) (AUC DEC 2010) 6. (i) What is the use of template? Write an overloaded function template called max(), which will find the maximum of any two given numbers. (8) (ii) Explain the exception handling mechanism of C++ in detail. (8) (AUC DEC 2010) 7. 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 outpatient (opno, doctor-id, 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 consultant fee. For in-patients, print bill according to their accommodation either in general-ward or special-ward. (AUC MAY 2011)

8. (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) (AUC MAY 2011) 9. (i) Write a program to explain the significance of pointers in C++. (8) (ii) Explain the concept of virtual functions. (8) 10. (i) Explain about file handling templates. (8) (ii) Illustrate exception handling with an example in C++. (8) (AUC DEC 2011) (AUC DEC 2011)

11. Explain the various types of Inheritance with suitable example program.

M.Sathya . Asst. Prof / CSE

12. What are abstract classes? Give an example (with the program) to illustrate the use of abstract classes. 13. Write notes on Typing conversions and derived class with program. 14. Write notes on Formatted and Unformatted Console I/O Operations. (16)

15. Explain about File Pointers and Manipulations with example. (16) 16. Discuss about manipulators and file streams with Program. (16) 17. Write on Details about File modes and File I/O. 18. Define a student class. Inherit that into MCAStudent class and NonMCAStudent. MCA Students inherits into GLSSTudents and NonGLSStudents. A function

howPracticalHours can only be applied to MCAStudents. We have a base class Student pointer to a GLSStudent object.Use dynamic_cast ti check that NonMCAStudents do not ShowPracticalHours.

M.Sathya . Asst. Prof / CSE

UNIT III PART A (2 MARKS) 1. What is deque? 2. What is heap and mention its types. 3. Write any two data structures used in Operating System. 4. What are the representations of big and small O notations? 5. Define stack. Mention the operations on stack. 6. What is binary heap? What are its types? (AUC DEC 2009) (AUC DEC 2009) (AUC MAY 2010) (AUC MAY 2010) (AUC DEC 2010) (AUC DEC 2010)

7. What is the advantage of using doubly linked list over singly linked list. (AUC MAY 2011) 8. What is meant by collision in hashing? 9. How is data sorted in QUEUE statement? 10. Insertion sort is faster than bubble sort. Justify 11. Write down the definition of data structure. 12. What is Complexity analysis? Define its types. 13. Explain the performance analysis of the algorithm? 14. Define Efficiency of an algorithm? 15. Define Worst case, best case and average case of an algorithm? 16. Define Divide and Conquer algorithm? 17. Mention some application of Divide and Conquer algorithm? 18. Define dynamic programming algorithm? List its applications. 19. Define algorithm paradigms space of an algorithm? 20. Mention the various spaces utilized by a program? 21. Define ADT (Abstract Data Type) and linear data structure. 22. Define Non Linear data structure? 23. What are different types of Linked List? 24. Define stack and queue. 25. What is single linked list? Define HEAD pointer and NULL pointer? 26. Mention applications of stack and queue. 27. Define Infix, prefix and postfix notations? 28. What are the conditions that followed in the array implementation of queue? 29. List the areas in which data structures are used widely. 30. Convert the expression ((A + B) * C (D E) ^ (F + G)) to equivalent Prefix and Postfix notations. (AUC MAY 2011) (AUC DEC 2011) (AUC DEC 2011)

M.Sathya . Asst. Prof / CSE

PART B (16 MARKS)

1. Define double linked list. Explain the various operations of double linked list with algorithm. (16) (AUC DEC 2009)

2. (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) (AUC DEC 2009) 3. (i) Explain priority queues and how are binary heaps used in that. (8) (ii) Explain the properties of heap. (8) (AUC MAY 2010)

4. (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) (AUC MAY 2010) 5. (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) (AUC DEC 2010) 6. (i) What are the advantages of linked list over array? (4)

(ii) Define hashing. (2)

(ii) Write a C++ program to implement stack through linked list. (10)
(AUC DEC 2010) 7. (i) Describe general rules to be considered while calculating time complexity of an algorithm. (6) (ii) Write algorithm to insert an element into a stack and a queue. Can stack be used for recursion? Justify. 8. (AUC MAY 2011)

(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) (AUC MAY 2011)

9.

(i) Explain the algorithm and program of selection sort. (8) (ii)Write short notes on heap sorting. (8) (AUC DEC 2011)

10.

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 instructing these values one by one. Display the heap after each insertion. Show the result in array. Now insert elements 15, 20 and 45 using the bubbling up process. Show the max heap following each insert. (AUC DEC 2011)

M.Sathya . Asst. Prof / CSE

11.

Given singly linked list whose first node is pointed to by the pointer variable C formulate an algorithm to delete the first occurrence of X from the list and Insert the element X after the position P in the list.

12.

Explain the process of postfix expression evaluation with an example. Discuss in detail the array implementation of queue (16) Explain the implementation stack using linked list. (i) Explain the process of conversion from infix expression to postfix using stack.

13.
14.

15.

(ii) Explain the process of postfix expression evaluation with Example.


16.

(i) Write the ADT operation to test whether current position is the last in the linked list . (ii) Write the ADT operation for insertion and deletion routine in linked lists.

17.

List out the ADT operation to enqueue and Dequeue and element in queue. (16)

18. List out the ADT operations of circular linked list? (16) 19. Define hash function? Write the routines to find and insert an element in separate chaining. 20. Explain rehashing techniques to avoid collision. (16) 21. Explain extendible hashing to resolve collision. (16) 22. Define Heap? State the properties of heap. Explain the Maximum heap and minimum heap with an example? (16)

M.Sathya . Asst. Prof / CSE

UNIT - IV PART A (2 MARKS)

1. What is AVL tree? 2. When does a graph become tree? 3. How many trees are possible with 3 nodes? 4. What is spanning tree? 5. What is meant by adjacency matrix? 6. State the properties of binary search tree. 7. When does a binary tree become a binary search tree? 8. Define minimum spanning tree. 9. Differentiate between trees and graphs.

(AUC DEC 2009) (AUC DEC 2009) (AUC MAY 2010) (AUC MAY 2010) (AUC DEC 2010) (AUC DEC 2010) (AUC MAY 2011) (AUC MAY 2011) (AUC DEC 2011)

10. Does the minimum spanning tree of the graph give the shortest distance between any two specified nodes? When is it possible? 11. Define tree? Define non-linear data structure. 12. What is a Binary tree? List its applications.
13. What is meant by traversing? What is binary tree traversal? What are the different

(AUC DEC 2011)

types of traversing? 14. What are the two methods of binary tree implementation? 15. Define Graph? Name the different ways of representing a graph? 16. What are the two traversal strategies used in traversing a graph? 17. What is an acyclic graph? 18. Give some example of NP complete problems. 19. Define Height of tree, Depth of tree, Degree of a node, Degree of a tree. 20. Define Terminal or non-terminal node. 21. Define expression tree or construction tree. 22. Define a depth first spanning tree. 23. What are the various operation performed in the binary search tree? 24. General idea of hashing and what is the use of hashing function? 25. What is priority queue? List application of priority queues. 26. What are the main properties of a binary heap? 27. Define tree traversal and mention the type of traversals? 28. What is a graph? Define its types. 29.What are the conditions for a graph to become a tree? 30. Explain about Adjacency linked list. 31. What are the methods to solve minimum spanning tree?

M.Sathya . Asst. Prof / CSE

10

PART B (16 MARKS)

1. Discuss the different methods of traversing binary tree with algorithms. (AUC DEC 2009) 2. Discuss Prims and Kruskals algorithm for computing the minimal spanning tree weighted undirected graph. (AUC DEC 2009)

3. (i) Traverse the given tree below using inorder, preorder and post order traversals. (10)

(ii) Convert the expression ((A+B)*C-(D-E)^(F+G)) to equivalent prefix and postfix notations. (6) (AUC MAY 2010)

4. (i) Convert the given graph with weighted edges to minimal spanning tree. (10)

(ii) Write a short note on AVL trees. (6)

(AUC MAY 2010)

5. (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 example. (6) (AUC DEC 2010) 6. (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) (AUC DEC 2010)

7. 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? (AUC MAY 2011) 8. (i) Write down the Dijsktras algorithm and explain it with an example. (8)
M.Sathya . Asst. Prof / CSE

11

(ii) Consider the following diagram. Using Prims algorithm and Kruskals algorithm draw all the intermediate stages of the graph to find minimum spanning tree. (8) (AUC MAY 2011) 9. (i) Explain with illustration the various types of rotations needed to retain the properties of an AVL tree during insertion of a node. State the time complexity of insertion of a node into 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) (AUC DEC 2011)

10. Consider the following graph G. The label of an edge is the cost of the edge. (i) Give the representation the graph G in a computer. What is the space Using Kruskals algorithm, draw a minimum spanning t ree of the graph G (AUC DEC 2011)

complexity? (ii)

describing each step of the algorithm. Also write the order in which the edgea are selected. 11.

Write an algorithm for finding minimum spanning tree and explain application,

illustrate the algorithm with typical data of yours own example. (16) 12. Explain the algorithm for depth first search and breath first search with the following graph (16)
13. Design a single source shortest path algorithm and explain it with example. 14. Describe open and closed hashing techniques in detail. 15. Explain two basic heap operations in detail. 16. Find a minimum spanning tree for the graph in the figure given below. Using both

Prims and Kruskals algorithm.


17. Find all the articulation in the graph given below. Show the depth-first spanning tree

and the values of Num & Low for each version.


18. Find the shortest unweighted path from B to all other vertices for the graph in the

figure.

M.Sathya . Asst. Prof / CSE

12

UNIT V PART A (2 MARKS)

1. What is the worst case and best case time complexity of binary tree? (AUC DEC 2009) 2. What is indexed sequential search? 3. What is the feature of bucket sort algorithm? 4. Define dynamic programming. (AUC DEC 2009) (AUC MAY 2010) (AUC MAY 2010) (AUC DEC 2010)

5. What is sorting? How is it essential for data base applications? (AUC DEC 2010) 6. Which is the fastest sorting algorithm in practice? What is the average and worst case running time of it? (AUC MAY 2011)

7. Give the working method of Divide and Conquer in two simple steps. (AUC MAY 2011) 8. Compare and contrast greedy method and dynamic programming. (AUC DEC 2011) 9. Which data structure is suitable for implementing backtracking? (AUC DEC 2011) 10. What are the two main classifications of sorting based on the source of data? 11. What is meant by external sorting and internal sorting? 12. What are the various factors to be considered in AUC DECiding a sorting algorithm? 13. What is the main idea in Bubble sort, shell sort, quick sort. 14. What is the advantage of quick sort? 15. What is the average efficiency of heap sort? 16. What is complexity analysis and performance analysis of an algorithm? 17. Define space complexity. 18. What is the best case analysis of insertion sort? 19. What does asymptotic notation mean? 20. Define best case of an algorithm. 21. Define Greedy method. 22. What is maxheap? 23. What are the two stages for heap sort? 24. Mention some methods for choosing the pivot element in quicksort? 25. What are the three cases that arise during the left to right scan in quicksort? 26. Define two way merge, multi way merge, polyphase merge. 27. What is replacement selection? 28. What are the properties involved in heapsort?
M.Sathya . Asst. Prof / CSE

13

29. Define articulation points.


30. Give some example of NP complete problems.

PART B (16 MARKS)

1. (i) Write a C program to implement binary search and compute its complexity. (8) (ii) Compare the worst case and best case complexity of various sorting techniques. (8) (AUC DEC 2009) 2. Explain the all pairs shortest path algorithm with an example. (16) (AUC DEC 2009) 3. Explain the algorithm of Quick sort by sorting the following set of numbers as example. 42 47 52 57 62 37 32 27 22 (AUC MAY 2010) 4. Describe the divide and conquer technique with the help of merge sort. (AUC MAY 2010) 5. (i) Explain heap sort with an illustration. (8) (iii) Explain the greedy algorithm to find minimum spanning tree. (8) (AUC DEC 2010) 6. (i) Explain the insertion sort with its time complexity. (8) (ii) Explain as how to divide and conquer technique can be applied for merge sort (8) (AUC DEC 2010) 7. (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. 67 3 24 45 9 12 30 29 (AUC MAY 2011) 90

8. (i) How do the greedy algorithms work? (8) (ii) Write the algorithm for All-pair-shortest path and explain it with an example. (8) (AUC MAY 2011) 9. (i) Write the algorithms of heap sort and bucket sort. Implement the C++ program for heap sort. 10. (i) Explain greedy algorithm with an example. (8) (ii) What is dynamic programming? List its applications and explain any one. (8) (AUC DEC 2011) 11. Write ADT operation for Heap sort. Using the above algorithm sort the following 35,45,25,11,6,85,17,35 12. Show how heap sort processes the input 142,543,123,65,453,879,572,434,111,242 ,811,102. 13. Trace the quick sort algorithm for the following numbers 90,77,60,99,55,88,66
M.Sathya . Asst. Prof / CSE

(AUC DEC 2011)

14

14. Briefly explain about Greedy algorithm with example (16) 15. Briefly explain about Dynamic programming (16) 16. Explain the divide and conquer technique with the help of merge sort.

M.Sathya . Asst. Prof / CSE

15

Anda mungkin juga menyukai