+ All Categories
Home > Documents > EC6301-Object Oriented Programming Semester/EC6301-Object... · page 1 valliammai engineering...

EC6301-Object Oriented Programming Semester/EC6301-Object... · page 1 valliammai engineering...

Date post: 09-May-2018
Category:
Upload: ngophuc
View: 260 times
Download: 4 times
Share this document with a friend
19
Page 1 VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 603203. DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING EC6301 OOPS AND DATA STRUCTURE QUESTION BANK II- YEAR III SEM ACDEMIC YEAR: 2017-2018 ODD SEMESTER Prepared by 1. Mr.L.Karthikeyan, A.P(Sr.G)/C SE 2. Ms.A.Vidhya, A.P(Sr.G)/CSE 3. Ms.S.Suma, A.P(Sr.G)/ CSE
Transcript
Page 1: EC6301-Object Oriented Programming Semester/EC6301-Object... · page 1 valliammai engineering college srm nagar, kattankulathur – 603203. department of electronics and communication

Page 1

VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur – 603203.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EC6301 OOPS AND DATA STRUCTURE

QUESTION BANK

II- YEAR III SEM

ACDEMIC YEAR: 2017-2018 ODD SEMESTER

Prepared by

1. Mr.L.Karthikeyan, A.P(Sr.G)/C SE

2. Ms.A.Vidhya, A.P(Sr.G)/CSE

3. Ms.S.Suma, A.P(Sr.G)/ CSE

Page 2: EC6301-Object Oriented Programming Semester/EC6301-Object... · page 1 valliammai engineering college srm nagar, kattankulathur – 603203. department of electronics and communication

Page 2

EC6301 OOPS AND DATASTRUCTURES

UNIT I DATA ABSTRACTION AND OVERLOADING

Overview of C++ – Structures – Class Scope and Accessing Class Members – Reference Variables

– Initialization – Constructors – Destructors – Member Functions and Classes – Friend Function –

Dynamic Memory Allocation – Static Class Members – Container Classes and Integrators – Proxy

Classes – Overloading: Function overloading and Operator Overloading.

PART A

Q. No Questions BT

Level

Competence

1 Infer the features of Object Oriented Programming. BTL -4 Analyzing

2 Distinguish between Procedure Oriented Programming

and Object Oriented programming.

BTL -2 Understanding

3 Which is used for data hiding in C++? List its types. BTL -1 Remembering

4 Collect the use of scope resolution operator. BTL -1 Remembering

5 Assess what operation is performed when the default

assignment operator = is applied to objects.

BTL -5 Evaluating

6 Define a class and object BTL -1 Remembering

7 Differentiate between structures and class. BTL -2 Understanding

8 Analyze the theme behind Encapsulation and Data

Abstraction.

BTL -4 Analyzing

9 Name the access modes used within a class. BTL -1 Remembering

10 Summarize polymorphism and its types. BTL -5 Evaluating

11 Create a C++ code to swap two variables without using

temporary variables in function.

BTL -6

Creating

12 Illustrate Default constructor and its characteristics. BTL -3 Applying

13 Show various types of constructors with example. BTL -3 Applying

14 Point out the benefits of using static class data. Give an

example of a class with static members.

BTL -4 Analyzing

15 Generalize about friend function. BTL -6 Creating

16 Quote the properties of a static data member and function. BTL -1 Remembering

17 Discuss about proxy class and container class BTL -2 Understanding

18 Demonstrate function overloading and operator overloading. BTL -3 Applying

19 Give the c++ code to swap values of two variables using

reference variables in function.

BTL -2 Understanding

20 Describe any four operators that cannot be overloaded in

C++.

BTL -1 Remembering

Page 3: EC6301-Object Oriented Programming Semester/EC6301-Object... · page 1 valliammai engineering college srm nagar, kattankulathur – 603203. department of electronics and communication

Page 3

PART – B

1 Discuss in detail about the features of object oriented

programming. (13)

BTL -2 Understanding

2

Compare the concept of constructor and destructor? Explain

with suitable example the different types of constructors in

C++.(13)

BTL -4

Analyzing

3

Define a supplier class. Assume that the items supplied by any

given supplier are different and varying in number. use

dynamic memory allocation in the constructor function to

achieve the solution. (13)

BTL -1

Remembering

4

i) Write a Program For Fibonacci Series using Loop In C++.

(7)

ii)Write a program to swap two numbers in C++using friend

function. (6)

BTL- 1

Remembering

5

i)Describe in detail about structure and compare the

members of structure and class with an example program.

(7)

ii) Examine member function and friend function to test the

product of two complex numbers in C++.

(6)

BTL -1

Remembering

6

Develop 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 functions

and data members. (13)

BTL-6

Creating

7

i) Assess the advantages of using default arguments

Explain with example program.(7)

ii)Write a member function and friend function to test the

subtraction of two complex numbers in C++.(6)

BTL -5

Evaluating

8

i) Express a C++ program to find the mean value of a given

number using friend function (7)

ii) Express a Program to Find Prime Number Using For Loop

in C++. (6)

BTL- 2

Understanding

9

What is a proxy class and identify container classes and

integrator with suitable code.(13)

BTL -1

Remembering

10

i)Demonstrate the ways in which member function of the class

can be derived and called using a suitable example

program.(7)

ii)Apply an example to static members.(6)

BTL- 3

Applying

11

Differentiate between pointer to constant and constant

pointers? Give an example program and explain it. (13)

BTL- 4

Analyzing

Page 4: EC6301-Object Oriented Programming Semester/EC6301-Object... · page 1 valliammai engineering college srm nagar, kattankulathur – 603203. department of electronics and communication

Page 4

12

i) Give a program to interpret how a static data is accessed

by a static member function. (7)

ii) Express a member function to extend the concept of matrix

addition, simple addition and string concatenation by

overloading + operator (6).

BTL-2

Understanding

13 Illustrate about Unary Operator and Binary Operator

overloading with program.(13)

BTL -3

Applying

14

i) Connect function overloading concept in finding the area of

rectangle and triangle with an example program.(7)

ii) Point out the concept of reference variables with example.

(6)

BTL -4

Analyzing

PART-C

1

Consider a book shop maintains the inventory

of books that are being sold at the shop. The list

includes details such as author, title, price, publisher

and stock position. Whenever a customer wants a

book, the sales person inputs the title and author and

the system searches the list and displays whether it is

available or not. If it is not, an appropriate message is

displayed. If it is, then the system displays the book

details and requests for the number of copies

required. If the requested copies are available, the

total cost of the requested copies is displayed;

otherwise the message “required copies not in stock”

is displayed.

Deduce a system using a class called books with

suitable member functions and constructors. Use

new operator in constructors to allocate memory

space required.(15)

BTL -5

Evaluating

2

Develop a program to find sum of n elements entered

by user. To perform this program, allocate memory

dynamically using malloc() function.(15)

BTL-6

Creating

3

Examine the concept of friend function and Write a

programme for Addition of members of two different

classes using friend function . (15)

BTL -4

Analyzing

4 Create a base class called shape. Use this class to

store to store two double type values that could be

used to compute the area of figures. Derive two

specific classes called triangle from the base shape.

Add to the base class, a member function get_data()

to initialize base class data members and another

Page 5: EC6301-Object Oriented Programming Semester/EC6301-Object... · page 1 valliammai engineering college srm nagar, kattankulathur – 603203. department of electronics and communication

Page 5

member function display_area() to compute and

display the area of figures. Make display_area() as a

virtual function and redefine this function in the

derived classes to suit their requirements. Using these

three classes, design a program that will accept

dimensions of a triangle or a rectangle interactively,

and display the area. Remember the two values given

as input will be treated as lengths of two sides in the

case of rectangles, and as base and height in the case

of triangles, and used as follows:

Area of rectangle = x * y

Area of triangle = ½ * x * y (15)

BTL-6

Creating

UNIT II INHERITANCE AND POLYMORPHISM

Base Classes and Derived Classes – Protected Members – Casting Class pointers and Member

Functions – Overriding – Public, Protected and Private Inheritance – Constructors and Destructors

in derived Classes – Implicit Derived – Class Object To Base – Class Object Conversion –

Composition Vs. Inheritance – Virtual functions – This Pointer – Abstract Base Classes and

Concrete Classes – Virtual Destructors – Dynamic Binding.

PART A

Q.No Questions BT

Level

Competence

1 Define Message Passing. BTL -1 Remembering

2 There are several restrictions in C++ while using static keyword. Support your views.

BTL -5 Evaluating

3 Create a c++ code to display area of square or rectangle using function overriding.

BTL -6 Creating

4 Demonstrate on how a private member be made inheritable? BTL -3 Applying

5 List out the types of inheritance. BTL -1 Remembering

6 Give the syntax for inheritance. BTL -2 Understanding

7 When is the protected access specifier used in a class? BTL -1 Remembering

8 Examine multiple inheritances. BTL -1 Remembering

Page 6: EC6301-Object Oriented Programming Semester/EC6301-Object... · page 1 valliammai engineering college srm nagar, kattankulathur – 603203. department of electronics and communication

Page 6

9 Infer concept of Hierarchical inheritance. BTL -4 Analyzing

10 Assess about Hybrid inheritance. BTL -5 Evaluating

11 Describe cross casting and down casting. BTL -1 Remembering

12 Illustrate the role of constructors and destructors in derived classes.

BTL -3 Applying

13 Identify the purpose of virtual base class. BTL -1 Remembering

14 Differentiate Compositions versus Inheritance. BTL-4 Analyzing

15 Discuss about virtual function. BTL -2 Understanding

16 Apply your understanding about ‘this’ pointer. Write a sample code to show the usage of ‘this’ pointer in C++.

BTL -3 Applying

17 Generalize the term Abstract base class. BTL -6 Creating

18 Extend your views about Abstract class and concrete class. BTL -2 Understanding

19 Compare virtual function and pure virtual function. BTL -4 Analyzing

20 Summarize the virtual destructor. BTL -2 Understanding

PART – B 1 Interpret the various types of Inheritance with suitable

example program. (13) BTL -2 Understanding

2

Develop a C++ code to construct classes of a person name and age as public properties, account details as private properties and percentage of mark as protected properties. Construct the class with sports details of the person. Construct a class to rank the based on the equal weightage to academic and sports details. Use inheritance concept.(13)

BTL -6

Creating

3

Infer 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 GLSStudentobject. Usedynamic_cast to check that NonMCA Students do not Show PracticalHours. (13)

BTL -4

Analyzing

4

List out the use of template? Write an overloaded function

template called max( ), which will find the maximum of any

two given integers. (13)

BTL -1

Remembering

Page 7: EC6301-Object Oriented Programming Semester/EC6301-Object... · page 1 valliammai engineering college srm nagar, kattankulathur – 603203. department of electronics and communication

Page 7

5 Discuss in detail about casting class pointers and member functions. (13)

BTL -2 Understanding

6

Explain the different forms of inheritance supported in C++? Discuss on the visibility of base class members in privately and publicly inherited classes (13)

BTL -1

Remembering

7

i) Criticize class object to Base and Base to class object conversions using C++ with suitable examples. (8)

ii) Evaluate the concept of polymorphism with example. (5)

BTL-5

Evaluating

8

i) Discover how a member function can find out the address of the object to which it belongs using ‘this’ pointer? (7)

ii)Show your understanding about concrete classes with

example. (6)

BTL- 3

Applying

9 Express the abstract classes? Give an example (with the

program) to illustrate the use of abstract class.(13)

BTL -2

Understanding

10

Explain virtual functions and pure virtual functions with

example. What are the rules associated with virtual functions? (13)

BTL -4

Analyzing

11

i) Describe in detail about the concept of composition with example.(7)

ii) Define virtual destructor? Explain the use of it with an

example.(6)

BTL -1

Remembering

12

i) When constructor overloading is used confer with example. (7)

ii) Identify Dynamic initialization through constructors.With

example. (6)

BTL- 1

Remembering

13 i)Apply your understanding about static binding and dynamic binding.(7)

ii)Demonstrate the order of invocation and execution of constructors and destructors in multilevel inheritance with an example.(6)

BTL- 3 Applying

14 Differentiate Overloading and Overriding with an example program. (13)

BTL- 4 Analyzing

Page 8: EC6301-Object Oriented Programming Semester/EC6301-Object... · page 1 valliammai engineering college srm nagar, kattankulathur – 603203. department of electronics and communication

Page 8

PART-C

1

Test the code and correct the errors. Write the corrected code and output.

#include<iostream.h>

class room

{

float mwidth; float mlength;

public:

room()

{

}

room(float w, float h)

:mwidth(w), mlength(h)

{

}

operator float()

{

return (float)mwidth * mlength;

}

float getwidth()

{

}

float getlength()

{

return mlength;

}

};

void main()

{

room objroom1(2.5, 2.5);

float ftotalarea; ftotalarea=objroom1;

cout << ftotalarea;

}

BTL-5

Evaluating

2. Develop a program to payroll system using single inheritance.

(15)

BTL -6

Creating

3 Assume that a bank maintains two kinds of accounts for customers, one called as savings account and the other as current account. The savings account provides compound interest and withdrawal facilities but no cheque book facility. The current account provides cheque book facility but no interest. Current account holders should also maintain a minimum balance and if the balance falls below this level, a service charge is

Page 9: EC6301-Object Oriented Programming Semester/EC6301-Object... · page 1 valliammai engineering college srm nagar, kattankulathur – 603203. department of electronics and communication

Page 9

imposed.Prepare a class account that stores customer name, account number and type of account. From this derive the classes cur_acct and sav_acct to make them more specific to their requirements. Include necessary member functions in order to achieve the following tasks:

a) Accept deposit from a customer and update the balance.

b) Display the balance.

c) Compute and deposit interest.

d) Permit withdrawal and update the balance.

e) Check for the minimum balance, impose penalty, necessary,

and update the balance.

Do not use any constructors. Use member functions to initialize the class

members. Rewrite the code with these

modifications.(15)

BTL -6

Creating

4 A book shop maintains the inventory of books that are being sold

at the shop. The list includes details such as author, title, price,

publisher and stock position. Whenever a customer wants a book,

the sales person inputs the title and author and the system searches

the list and displays whether it is available or not. If it is not, an

appropriate message is displayed. If it is, then the system displays

the book details and requests for the number of copies required. If

the requested copies are available, the total cost of the requested

copies is displayed; otherwise the message “required copies not in

stock” is displayed.Consider a system using a class called books with

suitable member functions and constructors. Use new operator in

constructors to allocate memory space required. (15)

BTL -6

Creating

Page 10: EC6301-Object Oriented Programming Semester/EC6301-Object... · page 1 valliammai engineering college srm nagar, kattankulathur – 603203. department of electronics and communication

Page 10

UNIT III LINEAR DATA STRUCTURES

Abstract Data Types (ADTs) – List ADT – array-based implementation – linked list

implementation –– singly linked lists –Polynomial Manipulation - Stack ADT – Queue ADT -

Evaluating arithmetic expressions

PART A

Q.No Questions BT Level Competence 1 Where do you use Data structure and how is it classified? BTL -1 Remembering

2 Name ADT (Abstract Data Type) operations. BTL -1 Remembering

3 Summarize linear data structure and Nonlinear data structure.

BTL -2 Understanding

4 List the different types and applications of Linked List. BTL -1 Remembering

5 Contrast between array and linked list BTL -2 Understanding

6 Explain the procedure to insert an element in the beginning of a list ADT implemented using a single linked list.

BTL -4 Analyzing

7 Show how to create a new node. BTL -3 Applying

8 Generalize the use of header pointer and Null pointer in a linked list.

BTL -6 Creating

9 Apply your understanding about dummy header. BTL -3 Applying

10 Illustrate about sentinel node ,header node and tail node. BTL -3 Applying

11 Define push and pop operations. BTL -1 Remembering

12 When did you use the stack in the computer system? BTL -1 Remembering

13 Write the advantages of linked list implementation of stack. BTL -5 Evaluating

14 Associate the conditions that are followed in the array implementation of queue.

BTL -2 Understanding

15 Differentiate between stack and queue and give its application.

BTL -2 Analyzing

16 Point out any two data structures used in Operating System. BTL -4 Analyzing

17 Tabulate prefix, infix and postfix notations. BTL -1 Remembering

18 Rewrite the following expression into postfix and prefix forms.

Page 11: EC6301-Object Oriented Programming Semester/EC6301-Object... · page 1 valliammai engineering college srm nagar, kattankulathur – 603203. department of electronics and communication

Page 11

A+B*(C-D)/(P-R) BTL -6 Creating

19 Evaluate the value of the expression ab+c*d- using stack. BTL -5 Evaluating

20 Give ADT representation used to evaluate arithmetic expressions?

BTL -2 Understanding

PART – B 1 Explain Array based implementation of list with an example

program. (13) BTL -4 Analyzing

2 Summarize in detail about insertion ,deletion and search operations in a singly linked list with suitable example.(13)

BTL -2 Understanding

3 Name the Queue ADT operation for insertion and deletion routine in linked lists. (13)

BTL -1 Remembering

4

i) Demonstrate the concept of pointer implementation and

cursor implementation. (7)

ii) Show a C++ function to test whether a linked list is empty using cursor implementation. (6)

BTL– 3

Applying

5 i) Point out the application of stack. (7)

ii) Infer in detail about Circular linked list.(6)

BTL– 4 Analyzing

6 Describe in detail about the implementing two stacks within a single array. (13)

BTL– 1 Remembering

7 Identify the ADT operation for insertion and deletion routine in stack using array implementation. (13)

BTL-1 Remembering

8 Explain the array and linked list implementation of queue operation. (13)

BTL -3 Applying

9

i) Write the applications of queue. (7)

ii) Differentiate between stack and queue. (6)

BTL– 2 Understanding

10 Evaluate the following postfix expression 2 4 + 3 * 1 5 - 8 3 + * -. (13)

BTL -5 Evaluating

11 Give a procedure to convert an infix expression a+b*c+(d*e+f)*g to postfix notation. (13)

BTL -2 Understanding

12

i) Tabulate the process of postfix valuation with an example. (7)

BTL -1 Remembering

Page 12: EC6301-Object Oriented Programming Semester/EC6301-Object... · page 1 valliammai engineering college srm nagar, kattankulathur – 603203. department of electronics and communication

Page 12

ii) Identify balancing symbols with example. (6)

13 Analyze the procedures to perform push and pop operations on an array implementation of stack and use the same to evaluate a postfix expression 123*-4+. (13)

BTL -4 Analyzing

14

Formulate an algorithm to add and subtract two polynomials

using singly linked list form of queue. (13)

BTL -6 Creating

PART-C

1 A deque is a data structure consisting of a list of items, on which the following operations are possible:

Push (X,D): Insert item X on the front end of deque D.

Pop(D): remove the front item from deque D and

return it.

Inject(x,D): Insert item X on the rear end of deque D. (15)

Eject(D): Remove the rear item from deque that take O(1) time per operation.

Combine the above mentioned operations and write a C++ code to formulate deque operations. (15)

BTL -6

Creating

2 Recommend a suitable C++ code to swap two adjacent elements by adjusting only the pointers using:

a. Singly linked lists.

b. Doubly linked lists. (15)

BTL -5

Evaluating

3 Design an algorithm to convert an infix expression to postfix expression using stacks and apply to the expression (a+b-d*e+(f*g+h)*i). (15)

BTL -6

Creating

4 Develop an algorithm to implement Queue ADT. Give relevant examples and diagrammatic representation. (15)

BTL -5 Evaluating

Page 13: EC6301-Object Oriented Programming Semester/EC6301-Object... · page 1 valliammai engineering college srm nagar, kattankulathur – 603203. department of electronics and communication

Page 13

UNIT IV NON-LINEAR DATA TRUCTURES

Trees – Binary Trees – Binary tree representation and traversals – Application of trees: Set

representation and Union-Find operations – Graph and its representations – Graph Traversals –

Representation of Graphs – Breadth-first search – Depth-first search - Connected components.

PART A

Q.

No

Questions BT Level Competence

1 Compose the term height and depth of the tree. BTL -6 Creating

2 Show the number of trees possible with 3 nodes? BTL -3 Applying

3 Define Binary tree and list its properties? BTL -1 Remembering

4 Describe the two methods of binary tree implementation? BTL -1 Remembering

5

Calculate the maximum number of nodes in a binary tree of Height H is 2 H+1- 1.

BTL -3 Applying

6 Point out the applications of binary tree. BTL -4 Analyzing

7 Grade the different type of tree traversal. BTL -5 Evaluating

8 When the inorder traversal of a binary tree resulted in E A C K F H D B G,what would its preorder traversal return?

BTL -1 Remembering

9 Generalize the term equivalence relation. BTL -6 Creating

10 Discuss about union operation. BTL -2 Understanding

11 Label the different types of union. BTL -1 Remembering

12 Tabulate Graph and Acyclic graph. BTL -1 Remembering

13 Compare and contrast in-degree and out degree of the graph. BTL -4 Analyzing

14 Demonstrate the representation of network of cities (Chennai, Delhi, Kolkata and Mumbai) as weighted graph.

BTL -3 Applying

15 Define articulation point. BTL -1 Remembering

16 Analyze the two traversal strategies used in traversing graph.

BTL -4 Analyzing

17 Differentiate path and cycle of the graph. BTL -2 Understanding

Page 14: EC6301-Object Oriented Programming Semester/EC6301-Object... · page 1 valliammai engineering college srm nagar, kattankulathur – 603203. department of electronics and communication

Page 14

18 Associate DFS and BFS. BTL -2 Understanding

19 Express how the tree and a graph are represented. BTL -2 Understanding

20 Summarize about connected components. BTL -5 Evaluating

PART – B

1 Write short note on the following terms related to tree:

i)Path (2)

ii)Degree (2)

iii)Level (3)

iv)Leaves (2)

v)Child (2)

vi)Height (2)

BTL -1

Remembering

2

Apply your understanding to explain about binary search tree and draw the binary search tree for the following input list 60, 25,75,15,50,66,33,44. Trace an algorithm to delete the nodes 25, 75,44 from the tree.

BTL -3

Applying

3 Infer the various tree traversal and predict a binary tree with Preorder:ABCDEFGHI and Inorder:BCAEDGHF

BTL -4 Analyzing

4 Summarize the two applications of tree with a neat example. (13)

BTL -2 Understanding

5

Explain C++ code for the implementation of different types

of Tree traversals. State few Tree applications. (13)

BTL -5

Evaluating

6

i) Express your understanding by finding the inorder, preorder and postorder form for the following graph: (10)

ii) Give some applications of trees. (3)

BTL - 2

Understanding

Page 15: EC6301-Object Oriented Programming Semester/EC6301-Object... · page 1 valliammai engineering college srm nagar, kattankulathur – 603203. department of electronics and communication

Page 15

7

Analyze in detail the implementation of Binary Search Tree

and perform its operations. (13)

BTL - 4

Analyzing

8

i) Point out and evaluate the dynamic equivalence problem. (7)

ii) Explain the path compression algorithm and analyze the Union/Find algorithm used. (6)

BTL -4

Analyzing

9 Describe in detail about the smart union algorithm. (13) BTL -1 Remembering

10 Define graph? List out the different ways for representing the graph and explain them with example? (13)

BTL -1 Remembering

11 i) Tabulate the following graph using breadth first search.(7)

(7)

ii) Examine BFS and DFS with suitable example. (6)

BTL - 1 Remembering

12 i) Illustrate the following graph using depth first search.(8)

ii) Demonstrate a C++ routine for BFS and DFS.(5)

BTL - 3

Applying

13 Interpret in detail about BFS and DFS with suitable examples. (13)

BTL -2 Understanding

14 Compose an example in detail about connected component. (13)

BTL -6 Creating

PART-C

1 Generalize the term binary search tree and do the following operations.

i) Show the result of inserting 3,1,4,6,9,2,5,7 into an initially

empty

binary search tree.

BTL -6

Creating

Page 16: EC6301-Object Oriented Programming Semester/EC6301-Object... · page 1 valliammai engineering college srm nagar, kattankulathur – 603203. department of electronics and communication

Page 16

ii) Show the result of deleting the root.

2 Consider the following graph:

i) Measure the shortest path from A to all other vertices for the following graph: (8)

ii) Evaluate the shortest unweighted path from B to all other vertices for the graph.(7)

BTL -5

Evaluating

3 Assess the algorithm used for union and find operations in disjoint sets. (15)

BTL -4

Analyzing

4 Create a binary search tree for the following input list 25,45,12,60,75,92,10. Trace an algorithm to delete the nodes 25,75,10 from the tree (15)

BTL -6

Creating

UNIT V SORTING and SEARCHING

Sorting algorithms: Insertion sort - Quick sort - Merge sort - Searching: Linear search –Binary

Search

PART A

Q. No Questions BT Level Competence 1 Express your views about sorting. BTL -2 Understanding

2 Label the two main classifications of sorting based on the source of data.

BTL -1 Remembering

3 Analyze the applications of external and internal sorting. BTL -4 Analyzing

4 Identify the purpose of quick sort. BTL -1 Remembering

Page 17: EC6301-Object Oriented Programming Semester/EC6301-Object... · page 1 valliammai engineering college srm nagar, kattankulathur – 603203. department of electronics and communication

Page 17

5 Assess the advantage of merge sort. BTL -5 Evaluating

6 Define median three partitioning. BTL -1 Remembering

7 Associate divide and conquer technique with merge sort. BTL -2 Understanding

8 Examine the algorithm to search an element in an array using linear search and write its time complexity.

BTL -1 Remembering

9 Summarize the sorting techniques which use the divide and conquer strategy.

BTL -2 Understanding

10 List out the advantages of merge sort. BTL -1 Remembering

11 Point out the key characteristics of binary search. BTL -4 Analyzing

12 Differentiate linear search and binary search. BTL -2 Understanding

13 Name the techniques used to choose the pivot element for quick sort.

BTL -1 Remembering

14 Infer why quick sort is more efficient than merge sort.

BTL -4 Analyzing

15 Illustrate which search is faster and why. BTL -3 Applying

16 Create algorithm for quick sort and insertion sort. BTL -6 Creating

17 Support your views about insertion sort with example and state its draw backs.

BTL -5 Evaluating

18

Trace the steps of insertion sort 12, 19, 33, 26, 29, 35, 22. Illustrate the total number of comparisons made during sorting.

BTL -3

Applying

19 Calculate the time complexity of quick sort and binary search.

BTL -3 Applying

20 Rearrange the following numbers 45,22,6,77,47,8 using insertion sort.

BTL -6 Creating

PART – B 1 Identify the correct sequence 3, 1, 4,7,5,9,2,6,5 using

Insertion sort with routine.(13) BTL -1 Remembering

2 Explain in detail about insertion sort with example and code. (13)

BTL -1 Remembering

3 Point out an algorithm for quick sort with example. (13)

BTL -4 Analyzing

Page 18: EC6301-Object Oriented Programming Semester/EC6301-Object... · page 1 valliammai engineering college srm nagar, kattankulathur – 603203. department of electronics and communication

Page 18

4 Summarize quick sort algorithm and trace the following list of numbers: 90,77,60,99,55,88,66, 10. (13)

BTL -2 Understanding

5 Examine Merge sort routine and trace the following numbers 1, 13, 24, 26, 2, 15, 27, 38. (13)

BTL -5 Evaluating

6 Associate an algorithm for merge sort and give its worst case, best case and average case analysis.(13)

BTL -2 Understanding

7 Demonstrate linear search & binary search algorithm in detail with an example for each.(13)

BTL -3 Applying

8 Differentiate linear search algorithm with binary search algorithm.(13)

BTL -4 Analyzing

9 Write C++ code and explain the implementation of linear search technique with an example.(13)

BTL -1 Remembering

10 Generalize your view about bubble sort technique with suitable example.(13)

BTL -6 Creating

11 Discuss Merge sort and quick sort with example. (13) BTL– 2 Understanding

12

Describe binary search algorithm and search the element 22 from the given list 2,7,14,4,17,5,19,8,22,9,25,12,27,14,28,33. (13)

BTL– 1

Remembering

13

Illustrate the technique insertion sort for the following 9,7, 6, 15, 16, 5, 10, 2 5 ,26,18, 11. (13)

BTL– 3

Applying

14

Analyze the algorithm for

i) Quick sort (7)

ii) Insertion sort (6)

BTL– 4

Analyzing

PART-C

1 i)Conclude how quick sort processes the input 142, 543, 123, 65, 453,

879, 572, 434, 111, 242, 811, 102.

ii) For the quicksort implementation, what is the running

time when all keys are equal?

(15)

BTL -5

Evaluating

2 Arrange the elements 12,3,2,26,5,21,18,25 and 50 using

merge sort and trace the output.and write C++ code to

BTL -4 Analyzing

Page 19: EC6301-Object Oriented Programming Semester/EC6301-Object... · page 1 valliammai engineering college srm nagar, kattankulathur – 603203. department of electronics and communication

Page 19

implement merge sort. (15)

3 Given an array containing only 0s and 1s in sorted order. Create a strategy

using any of the sorting techniques to do the following:

a. Find the first occurrence of 1 in array.

b. Find the last occurance of 0.

c. Find number of instances of 0s in sorted

array.(15)

BTL -6

Creating

4 Rearrange the sequence 4,7,2,0,-8,5 using insertion sort and write c++ code for insertion sort. (15)

BTL -6

Creating


Recommended