valliammai engineering college semester... · illustrate the mechanism of unary operator ... write...
TRANSCRIPT
VALLIAMMAI ENGINEERING COLLEGE
SRM Nagar, Kattankulathur – 603 203
DEPARTMENT OF
COMPUTER SCIENCE AND ENGINEERING
QUESTION BANK
III SEMESTER
CS6301 – PROGRAMMING AND DATA STRUCTURES - II
Regulation – 2013
Academic Year 2017 – 18
Prepared by
Dr. A. Samydurai, Associate Professor
Ms.R.Anitha, Assistant Professor
Prepared By: Dr.A.Samydurai & Ms. R. Anitha
UNIT I OBJECT ORIENTED PROGRAMMING FUNDAMENTALS
C++ Programming features - Data Abstraction - Encapsulation - class - object - constructors - static
members – constant members – member functions – pointers – references - Role of this pointer – Storage
classes – function as arguments.
PART - A
Q.No Questions BT Level Competence
1 Describe static member. BTL -1 Remember
2 How the C string differs from a C++ type string? BTL -4 Analyze
3 Differentiate class and object. BTL -2 Understand
4 Which is used for achieving data hiding in C++? List its types. BTL -1 Remember
5 Can you list the advantages of using storage classes? BTL -1 Remember
6 In what way would you summarize abstraction and encapsulation? BTL -5 Evaluate
7 Define this pointer. BTL -1 Remember
8 Compare and contrast procedural programming and OO
programming. BTL -4 Analyze
9 With which concept, visibility and lifetime of a variables differ in
C++? List its types. BTL -1 Remember
10 Can you interpret what is happening while using destructor? BTL -2 Understand
11 How would you describe Data Abstraction? BTL -1 Remember
12 When will the destructor be called? Analyze whether it is explicit or
implicit? BTL -4 Analyze
13 Show the use of scope resolution operator. BTL -3 Apply
14 Discuss about constant data members and member functions. BTL -2 Understand
15 Write a member function to find the greatest of 2 numbers using ‘this’
pointer? BTL -6 Create
16 Illustrate about dynamic constructor. BTL -3 Apply
17 Demonstrate your understanding of reference variables? BTL -3 Apply
18 How would you generalize the member function in C++? BTL -6 Create
19 How would you summarize the function as arguments? BTL -2 Understand
20 Give the significance of declaring a member of a class static. BTL -5 Evaluate
PART-B
Q.No Questions BT Level Competence
1
i) How would you specify a class? (6)
ii) Describe the different mechanisms of accessing data members
and member functions in a class with a suitable example. (7)
BTL -2 Understand
Prepared By: Dr.A.Samydurai & Ms. R. Anitha
2
i) Explain the different types of constructors with suitable
examples. (7)
ii) Describe the types of storage classes. (6) BTL -4 Analyze
3
i) List the C++ programming features and explain in brief, how
each of those are achieved. (7)
ii) What do you understand by static member and member
function? How to declare them? Illustrate with an example
program. (6)
BTL -1 Remember
4
i) Evaluate and explain the role of ‘this’ pointer. (6)
ii) Write a member function and friend function to subtract two
complex numbers in C++. (7)
BTL -5 Evaluate
5
i) Summarize about function prototyping? (7)
ii) Describe in detail about inline functions with an example
program. (6)
BTL -2 Understand
6
i) Will you state and describe in your own words about call by
reference and return by reference? (7)
ii) Describe about arrays of objects. Write a program to narrate the
same. (6)
BTL -1 Remember
7
i) Based on what you learn generalize your opinion about friend
function. Integrate the special characteristics of friend function
along with an example program. (7)
ii) Compose your views about dynamic initialization of objects.
Narrate with an example program. (6)
BTL -6 Create
8
i) How would you illustrate your view about dynamic constructor?
Explain with an example program. (7)
ii) How would you illustrate your view about constructing two-
dimensional arrays? Explain with an example program. (6)
BTL -3 Apply
9 i) Explain in detail about pointers to objects. (7)
ii) Write a C++ program to describe array of pointers to objects. (6) BTL -4 Analyze
10
i) Describe in detail about dynamic memory allocation in C++
with examples. (7)
ii) Describe in detail about accessing class members with an
example program. (6)
BTL -1 Remember
11
i) How would you illustrate your view about function as
arguments? Explain with an example program. (7)
ii) Apply your understanding about C++ manipulators and type
cast operators. Explain with an example program. (6)
BTL -3 Apply
12
i) Will you state and describe in your own words about operators
in C++? (7)
ii) Describeabout scope resolution operator. Write a program to
narrate the same. (6)
BTL -1 Remember
Prepared By: Dr.A.Samydurai & Ms. R. Anitha
13 Explain in detail about control structures in C++. (13) BTL -4 Analyze
14 i) Summarize about memory management operators in C++. (7)
ii) Extend your views about C++ data types with examples. (6) BTL -2 Understand
PART – C
Q.No Questions BT Level Competence
1
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 5 Evaluate
2
Develop two classes DM and DB which store the value of
distances. DM stores distances in meters and centimeters and DB in
feet and inches. Write a program that can read values for the class
objects and add one object of DM with another object of DB. Use a
friend function to carry out the addition operation. The object that
stores the results may be a DM object or DB object, depending on the
units in which the results are required. The display should be in the
format of feet and inches or meters and centimeters depending on the
object on display.(15)
BTL 6 Create
3 Explain the different mechanism for accessing data members and
member functions in a class with a suitable mechanism.(15) BTL4 Analyze
4 Compose the differences between pointer to constant and constant
pointer. Give an example program and explain it.(15) BTL 6 Create
Prepared by: Dr. A. Samydurai & Ms. R. Anitha Page 5
UNIT II OBJECT ORIENTED PROGRAMMING CONCEPTS
String Handling – Copy Constructor - Polymorphism – compile time and run time polymorphisms –
function overloading – operators overloading – dynamic memory allocation - Nested classes - Inheritance –
virtual functions.
PART - A
Q.No Questions BT Level Competence
1 Describe the operations carried out using string object? BTL -1 Remember
2 How would you describe dynamic initialization of variables? BTL -1 Remember
3 How will you summarize important functions supported by string
class? BTL -5 Understand
4 Define copy constructor and its use. BTL -1 Remember
5 Define polymorphism. BTL -1 Remember
6 Can you classify there rational operators used in string manipulation? BTL -4 Analyze
7 Can you explain what is function overloading? BTL -4 Understand
8 List out the characteristics of C++ string objects. BTL -1 Remember
9 Differentiate overloading and overriding. BTL -2 Analyze
10 Can you explain the types of operator overloading? BTL -4 Analyze
11 Illustrate the mechanism of unary operator overloading with an
example? BTL -3 Apply
12 How will you create a string object? BTL -6 Create
13 What examples can you find to illustrate binary operator overloading? BTL -3 Apply
14 Show your understanding about nested classes? BTL -3 Apply
15 How would you design a C++ code to display as area of square or
rectangle using function overriding? BTL -6 Create
16 How does compile time polymorphism differs from run time
polymorphism? BTL -2 Understand
17 Give the special properties of virtual function. BTL -2 Evaluate
18 Summarize the types of inheritance. BTL -5 Evaluate
19 List any four operators that cannot be overloaded in C++. BTL -1 Remember
20 How the C string differs from C++ type string? BTL -2 Understand
Prepared by: Dr. A. Samydurai & Ms. R. Anitha Page 6
PART-B
Q.No Questions BT Level Competence
1
i) Interpret a C++ program to overload increment operator with
prefix and postfix form. (7)
ii) Distinguish the term overloading and overriding. (6)
BTL -2 Understand
2
i) Write a C++ program to explain how the run time polymorphism
is achieved. (7)
ii) Demonstrate single inheritance and multiple inheritance in C++
with suitable examples. (6)
BTL -3 Apply
3 With suitable C++ program explain how the polymorphism is achieved
at compile time and run time. (13) BTL -4 Analyze
4
i) How would you describe about function overloading and explain
with an example program? (7)
ii) Define copy constructor. Write a C++ program to find factorial of
a number using copy constructor. (6)
BTL -1 Remember
5
Describe and analyze a class by the name 'Box’ with a constructor
method and volume method. The Constructor is initialized with the
length, breath and height of the box objects. Volume method computes
the volume of the box using the formula length*breath*height. Create
three box objects and compute their volume by declaring a pointer to
the box.(13)
BTL -1 Remember
6
i) Explain in detail about polymorphism and its advantages (7)
ii) Explain in detail about a function that computes and displays the
area of a rectangle and the area of a square. Declare this function
as friend function in Rectangle and square classes and compute
the area of a rectangle and square objects from the main function.
(6)
BTL -4 Analyze
7
i) List the various types of constructor with a programming
example.(7)
ii) Describe the concept of destructor function with a programming
example(6)
BTL -1 Understand
8 Will you state and summarize in your own words about virtual base
class in C++ with an appropriate example? (13) BTL -2 Understand
9
i) Write a program to evaluate string copy operation using dynamic
constructor. (7)
ii) 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. (6)
BTL -5 Evaluate
10 Develop a C++ code to construct classes of a person with name and BTL -6 Create
Prepared by: Dr. A. Samydurai & Ms. R. Anitha Page 7
age as public properties, account details as private properties and
percentage of mark as protected property. Construct a class with sports
details of person. Construct a class to rank person based on the equal
weight age to academic and sports details. Use inheritance concept.
11
i) Explain how memory is dynamically allocated and recovered in
C++? Illustrate with an example program.(7)
ii) Demonstrate multi-level inheritance and hierarchical inheritance
in C++ with suitable examples. (6)
BTL -3 Apply
12
i) List the rules associated with operator overloading. What are the
operators that cannot be overloaded? Write a program to overload
any one of the binary operators. (7)
ii) Demonstrate hybrid inheritance in C++ with suitable examples.
(6)
BTL -1 Remember
13 Explain the use of virtual function with an example program. (13) BTL -4 Analyze
14
i) Give a C++ program to overload “+” operator to perform string
concatenation operation.(7)
ii) Discuss a C++ program to overload “+” operator to perform
polynomial addition operation.(6)
BTL -2 Understand
PART-C
Q.No Questions BT Level Competence
1
Given a sting s(“123456789”);
Design a program that displays the following(15)
1
2 3 2
3 4 5 4 3
4 5 6 7 6 5 4
5 6 7 8 9 8 7 6 5
BTL6 Create
2
Create a base class called shape. Use this class to store to store two
doubletype values that could be used to compute the area of figures.
Derive two specific classes called trianglefrom the base shape. Add to
the base class, a member function get_data() to initialize base class data
members and another member function display_area() to compute and
display the area of figures. Compute 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 5 Evaluate
Prepared by: Dr. A. Samydurai & Ms. R. Anitha Page 8
3
Create a class Shape with Constructor, destructor and pure virtual
function getArea(),getPerim() and draw().Derive classes Circle and
Rectangle from Shape.Derive another class square from Rectangle.
Implement this hierarchy with essential functions and write a main.(15)
BTL6 Create
4 Explain any four types of inheritance supported in C++ with suitable
examples.(15) BTL -4 Analyze
UNIT III C++ PROGRAMMING ADVANCED FEATURES
Abstract class – Exception handling - Standard libraries - Generic Programming - templates – class template
- function template – STL – containers – iterators – function adaptors – allocators - Parameterizing the class
- File handling concepts.
PART - A
Q.No Questions BT Level Competence
1 Discuss the significance of Iterators. BTL -2 Understand
2 What is a function adaptor? BTL -1 Remember
3 Can you differentiate overloaded functions versus function templates? BTL -4 Analyze
4 How would you describe an I/O stream? BTL -1 Remember
5 In what way would you compare throw and throws in C++? BTL -5 Evaluate
6 Define abstract class. BTL -1 Remember
7 Give the various file stream classes needed for file manipulation. BTL -2 Understand
8 List out any four containers supportedby Standard Template Library. BTL -1 Remember
9 Discuss about File pointer and its types.. BTL -2 Understand
10 Define Exception and list out any four examples of Exception. BTL -1 Remember
11 Is abstract base class, used to create objects? Justify your answer in
brief.
BTL -4 Analyze
12 Give an example of function template. BTL -2 Understand
13 Define containers and list out its types. BTL -1 Remember
14 Point out the reason templates used in C++. BTL -4 Analyze
15 Illustrate about exception handling mechanism. BTL -3 Apply
16 Rewrite in your own words about rethrowing an exception? BTL -6 Create
17 Can you compare class template and function template. BTL -5 Evaluate
18 How would you classify the components of STL? BTL -3 Apply
19 Demonstrate the classes which are available in” iostream.h”? BTL -3 Apply
20 Based on what you know, design a small code using try, catch and
throw keywords?
BTL -6 Create
Prepared by: Dr. A. Samydurai & Ms. R. Anitha Page 9
PART-B
Q.No Questions BT Level Competence
1
i) Describe in detail about 4 functions Seekg, Seekp, tellg, tellp
used for setting pointers during file operation and show how
they are derived from fstream class. (7)
ii) Examine a program that demonstrates several exception
types being caught with the catch (...) exception handler. (6)
BTL -1 Remember
2
i) Test a program to implement stack operation using class
template. (5)
ii) Assess a template function to sort the elements of an array. (4)
iii) What is an exception? Explain how the control is transferred and
handled in C++ programs. (4)
BTL -5 Evaluate
3
i) Apply your understanding about function template for finding a
maximum value in an array. Write a C++ program to implement
the same. (7)
ii) Illustrate divide by zero exception with a suitable example
program. (6)
BTL -3 Apply
4
i) Describe the components of STL. (7)
ii) Give a class template to represent a stack of any possible data
type. (6)
BTL -2 Understand
5
Write a program to write the text in a file. Read the text from the file,
from end of the file. Display the contents of file in reverse order.
Append the contents to the existing file. (13)
BTL -1 Remember
6
i) Can you discuss in detail about class template and function
template? (7)
ii) Discuss about pure virtual function. (6)
BTL -2 Understand
7
i) Write a program to illustrate the concept of re-throwing an
exception. (7)
ii) Apply string handling concept and 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. (6)
BTL -3 Apply
8
i) Write a class template to point out a queue of any possible data
type. (7)
ii) Analyze about how exceptions are handled using multiple catch
handlers. (6)
BTL -4 Analyze
9
Describe in detail about template function. Design and implement a
template version functions min() and max() for finding minimum and
maximum values of a given set of elements in list T represented by a
seqList<T> object(13)
BTL -1 Remember
10 Generalize and explain the exception handling mechanism available
in C++ with suitable examples.(13) BTL -6 Create
Prepared by: Dr. A. Samydurai & Ms. R. Anitha Page 10
11
Write a program to find the factorial value of any number entered
through the keyboard. Analyze and Include any two exceptional
handling in the program and explain how the exceptions are handled.
(13)
BTL -4 Analyze
12
i) List out the C++ classes associated with streams and I/O
operations. Write a simple C++ program to copy one file
contents into another file. (7)
ii) Create a user defined class called String and include methods
that implement all the standard string operations. (6)
BTL -1 Remember
13 i) Explain the various file mode operations available in C++. (7)
ii) Explain about exception handling with an example program. (6) BTL -4 Analyze
14
Write a program that merges lined alternately from two files and
writes the results to new file. If one file has less number of lines than
the other, the remaining lines from the larger file should be simply
copied into the target file. (13)
BTL -2 Understand
PART-C
Q.No Questions BT Level Competence
1
Compose a program with the following(15)
a) A function to read two double type numbers from keyboard
b) A function to calculate the division of these two numbers
c) A try block to throw an exception when a wrong type of data is
keyed in
d) A try block to detect and throw an exception if the condition
“divide-by-zero” occurs
e) Appropriate catch block to handle the exceptions thrown
BTL6 Create
2
Write and Explain a program that reads a text file and creates another
file that is identical except that every sequence of consecutive
black spaces is replaced by a single space.(15)
BTL5 Evaluate
3 Create a C++ program to overload the decrement operator with prefix
and postfix form(15) BTL6 Create
4 Explain a program to illustrate the concept of re-throwing an
exception.(15) BTL -4 Analyze
Prepared by: Dr. A. Samydurai & Ms. R. Anitha Page 11
UNIT IV ADVANCED NON-LINEAR DATA STRUCTURES
AVL trees – B-Trees – Red-Black trees – Splay trees - Binomial Heaps – Fibonacci Heaps – Disjoint Sets –
Amortized Analysis – accounting method – potential method – aggregate analysis.
PART - A
Q.No Questions BT Level Competence
1 How would you describe the balance factor in AVL tree? BTL -1 Remember
2 What did you infer from the term amortized analysis? Show that the
stack operation MULTIPOP costs O(1) amortized time.
BTL -4 Analyze
3 Differentiate Fibonacci heap and binomial heaps. BTL -2 Understand
4 How would you describe splay trees? BTL -1 Remember
5 Can you list the various operations that can be performed on B-tree? BTL -1 Remember
6 Criticize on the procedure for insertion in Fibonacci heap. BTL -5 Evaluate
7 Define Fibonacci heaps. BTL -1 Remember
8 What would you infer from the term splay? BTL -4 Analyze
9 Define AVL tree. BTL -1 Remember
10 Summarize the structural property of a B-tree. BTL -2 Understand
11 List the 4 cases for insertion of new node in an AVL tree. BTL -1 Remember
12 Analyze the value or importance of aggregate analysis. BTL -4 Analyze
13 Modify the routine for insertion in Fibonacci heap. BTL -3 Apply
14 Give the properties of Red-Black tree. BTL -2 Understand
15 Combine your opinion about splitting of a node in B-tree. BTL -6 Create
16 What examples can you find to demonstrate the representation of
binomial heap?
BTL -3 Apply
17 How would you show your understanding about the properties of
heap?
BTL -3 Apply
18 Based on what you know, generalize the operations involved in
binomial heap.
BTL -6 Create
19 Discuss about the definition of Binomial heap. BTL -2 Understand
20 Deduce an example for potential method. BTL -5 Evaluate
PART-B
Q.No Questions BT Level Competence
1
i) Perform the splaying operation on a binary search tree obtained
by inserting the key values 15, 22, 18,12,4,16,56,48 in this order
into an initially empty tree. Write the code to do the same (splay
BTL -1 Remember
Prepared by: Dr. A. Samydurai & Ms. R. Anitha Page 12
& insert). (7)
ii) On an initially empty binomial heap, carry out the following
sequence of operations: insert (27), insert (17), insert (19), insert
(20), insert (24), insert (12), insert (11), insert (10), insert (14),
insert (18), deletemin. After each operation draw the resulting
structure of the binomial heap (6)
2
Construct an AVL tree with the values 1,2,3,…10 into an initially
empty tree. After inserting all the nodes delete 6 from this tree. Write
the code for inserting and deleting into an AVL tree. (13)
BTL -4 Analyze
3
i) What is a Red-Black tree? Mention the properties that a Red-
Black tree holds. (7)
ii) Show the result of inserting 43,11,69,72 and 30 into an initially
empty AVL tree. Show the result of deleting the nodes 11 and 72
one after the other of the constructed tree. (6)
BTL -1 Remember
4
i) Summarize about B-tree? Mention the properties that a B-tree
holds. (7)
ii) Give a binary search tree by inserting 30,10,4,19,62,35,28,and 73
into an initially empty tree. Show the result of splaying the nodes
4 and 62 one after the other of the constructed tree. (6)
BTL -2 Understand
5
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 (7)
ii) Describe AVL rotations with a suitable example. (6)
BTL- 1 Remember
6 Describe in detail about amortized analysis with appropriate
examples. (13) BTL -2 Understand
7
Illustrate the representation of Fibonacci heap. Consider the
following Fibonacci heap
Insert 38 and delete 15. Write a suitable routine for insertion and
deletion. (13)
BTL -3 Apply
8
Explain in detail about the following with at least 2 example.
i) Accounting method (7)
ii) Potential method (6)
BTL -4 Analyze
9 Construct a B-Tree with order m=5 for the key values C N G A H E K
Q M F W L T Z D P R X Y S and delete the values H and T. Show the BTL -5 Evaluate
Prepared by: Dr. A. Samydurai & Ms. R. Anitha Page 13
tree in performing all operations. (13)
10
Create a B- Tree of order 5 for the following nodes:
22,56,18,12,36,48,2,96,78,44,91,16,14,66,11,38,52,75. Write insertion
algorithm.(13)
BTL -6 Create
11
i) Apply your understanding about disjoint sets. Explain with an
example. (7)
ii) Show your understanding about aggregate analysis with a suitable
example. (6)
BTL -3 Apply
12
Describe in detail about binomial heaps. How will you represent a
binomial heap? Explain the routine for finding the minimum key and
union properties in a binomial heap. (13)
BTL -1 Remember
13
Explain in detail about splay tree, and the 2 special cases involved in
restructuring the splay tree after insertion. Construct a binary search
tree for the values 1, 2, 3….7 and splay at the node 1. Explain the
splaying operation step by step. (13)
BTL -4 Analyze
14
i) Differentiate binomial heap and Fibonacci heap with your own
example. (7)
ii) How potential method differs from accounting method? Explain
with an example. (6)
BTL -2 Understand
PART-C
Q.No Questions BT Level Competence
1.
Develop an AVL tree with the following values:
15, 20, 24, 10, 13, 7, 30, 36, 25. Remove 24 and 20 from the AVL tree
and insert 50,18 into the AVL tree.(15)
BTL 6 Create
2
A majority element in an array, A, of size N is an element that
appears more than N/2 times. For example, the array 3,3,4,2,4,4,2,4,4
has a majority element (4), whereas the array 3,3,4,2,4,4,2, does not.
If there is no majority element, your program should indicate this. Here
is a sketch of an algorithm to solve the problem. (15)
(First, a candidate majority element is found. This candidate is the
only element that could possibly be the majority element. The second
step determines if this candidate is actually the majority. This is just a
sequeitial search through the array. To find a candidate in the array, A,
form a secondary array, B. Then compare A1 and A2. If they are equal,
add one of these to B; otherwise do nothing. Then compare A3 and A4.
Again if they are equal, add one of these to B; otherwise do nothing.
Continue in this fashion until the entire array is read. Then recursively
evaluate a candidate for B; this is the candidate for A (why?).
i) How does the recursive terminate?
ii) How the case is where N is odd handled?
BTL 5 Evaluate
Prepared by: Dr. A. Samydurai & Ms. R. Anitha Page 14
iii) What is the running time of the algorithm?
iv) How can we avoid using an extra array B?
v) Write a program to compute the majority element.
3 Create an AVL tree with the values 3,1,4,5,9,2,8,7,0 into an initially
empty tree. Write code for inserting into an AVL tree. BTL -6 Create
4
Arrange a B-tree with order m=3 for the key values 2,3,7,9,5,6,4,8,1
and delete the values 4 and 6.Show the tree in performing all
operations.
BTL4 Analyze
UNIT V GRAPHS
Representation of Graphs – Breadth-first search – Depth-first search – Topological sort – Minimum
Spanning Trees – Kruskal and Prim algorithm – Shortest path algorithm – Dijkstra‟s algorithm – Bellman-
Ford algorithm – Floyd-Warshall algorithm
PART - A
Q.No Questions BT Level Competence
1 What is the minimum number of spanning trees possible for a complete
graph with n vertices? BTL -1 Remember
2 List the drawbacks of Floyd-Warshall algorithm. BTL -1 Analyze
3 How would you rank the hierarchy of name servers? BTL -5 Evaluate
4 Point out the principle behind Bellman-Ford algorithm to detect the
negative weight cycles. BTL -4 Analyze
5 Can you list the 2 algorithms to create minimum spanning tree? BTL -1 Remember
6 Can you interpret the algorithm for topological sort? BTL -2 Understand
7 Differentiate BFS and DFS. BTL -2 Understand
8
Design the weighted matrix for the following graph:
BTL -5 Evaluate
9 Compare and contrast Bellman ford and Floyd Warshall algorithm. BTL -2 Understand
10 What are the different ways to represent the graph? Explain each of
them. BTL -4 Remember
11 Define topological sort. BTL -1 Remember
12 Give the ways in which a graph can be represented with an example. BTL -2 Understand
13 How would you apply your understanding about DAG? BTL -3 Apply
14 What information would you use to generalize the initial configuration
of prim’s table? BTL -6 Create
Prepared by: Dr. A. Samydurai & Ms. R. Anitha Page 15
15 Define minimum spanning tree. BTL -1 Remember
16 Illustrate the properties of graph. BTL -3 Apply
17 Can you list the applications of breadth-first search? BTL -1 Remember
18 Compare Prim’s and Kruskal’s algorithm. BTL -4 Analyze
19
Show the adjacency matrix for the following graph:
BTL -3 Apply
20 Based on what you know, generalize the term shortest path algorithm. BTL -6 Create
PART-B
Q.No Questions BT Level Competence
1
Describe in detail about Prim’s and Kruskal’s algorithm. Find the
minimum spanning tree for the following graph using any one of
the algorithm. (13)
BTL -1 Remember
2
For the given graph apply the shortest path algorithm,
i) Find the shortest path from vertex 1 to all other vertices. (7)
ii) Find the shortest path from each vertex to all other vertices.
Mention and use the appropriate algorithms. (6)
BTL -3 Apply
Prepared by: Dr. A. Samydurai & Ms. R. Anitha Page 16
3
i) Test an algorithm for breadth first search on a graph and give
the nodes of the graph ‘G’ given in the figure based on the
algorithm. (7)
ii) Using Dijkstra’s algorithm, assesthe shortest path from the
source to all other nodes of the graph ‘G’ given in the figure.
(6)
BTL -5 Create
4
i) Summarize the working of Warshall’s algorithm. (6)
ii) Express and sort the nodes of ‘D’ by applying topological
sort on ‘D’. (7)
BTL -2 Understand
Prepared by: Dr. A. Samydurai & Ms. R. Anitha Page 17
5
i) Discuss in detail aboutDijkstra’s algorithm for finding the
shortest path with the following graph. (8)
ii) Differentiate Floyd’s algorithm and Dijkstra’s algorithm (5)
BTL -2 Understand
6
Analyze and find the minimum spanning tree for the given graph
using both Prim’s and Kruskal’s algorithm and write the
algorithms. (13)
BTL -4 Analyze
7
i) Describe in detail about depth first search algorithm on a
graph and give the nodes of the graph ‘G’ given in the figure
based on the algorithm. (7)
BTL -1 Remember
Prepared by: Dr. A. Samydurai & Ms. R. Anitha Page 18
ii) Identify the differences between breadth first search and
depth first search algorithm and explain with an example for
each of them. (6)
8
i) Analyze a directed acyclic graph given in the figure. Sort the
nodes by applying topological sort. (7)
ii) Explain in detail about Floyd’s Algorithm with a suitable
example(6)
BTL -4 Analyze
9
Generalize the method of constructing minimum cost spanning
tree using Kruskal’s algorithm with appropriate example and write
the code for the same.(13)
BTL -6 Evaluate
10
Discuss in detail about Dijkstra’s algorithm for finding the
shortest path with the following graph.(13)
BTL -1 Remember
11
i) Illustrate the various methods for finding the minimum
spanning tree and give the algorithm for each of them.(7)
ii) Apply and solve using Kruskal’s algorithm for the following
graph (6)
BTL -3 Apply
Prepared by: Dr. A. Samydurai & Ms. R. Anitha Page 19
12
i) How do you identify the transitive closure of a graph(7)
ii) Examine and solve the following graph using Warshall
algorithm (6)
BTL -1 Remember
13
i) Explain about the traversals of a graph and also give it’s
analysis.(7)
ii) Point out the linked list representation of graph with a
suitable example.(6)
BTL -4 Analyze
14 i) Summarize ADT operation for Prim’s algorithm.(7)
ii) Discuss in detail about the topological sort algorithm.(6) BTL -2 Understand
PART-C
Q.No Question Level Competence
1
Summarize an example where Dijkstra’s algorithm gives the
wrong answer in the presence of a negative edge but nonnegative-
cost cycle.(15)
BTL 6 Create
2
Consider a minimum spanning tree for the graph using both
Prim’s and Kruskal’s algorithms. Is this minimum spanning tree
unique? Why?(15)
BTL 5 Evaluate
3 Explain briefly about all pairs shortest path algorithm(15) BTL -4 Analyze
4 Generalize any two applications of depth-first search.(15) BTL -6 Create