Dsa Question Bank Unit 5
Dsa Question Bank Unit 5
Graph Terminology, Graph Traversal Topological sorting, Minimum spanning tree – Prims
Algorithm Minimum Spanning Tree - Kruskal’s Algorithm, Network flow problem Shortest
Path Algorithm- Introduction,Shortest Path Algorithm: Dijkstra’s Algorithm Hashing: Hash
functions – Introduction, Hashing: Hash functions Hashing: Collision avoidance, Hashing:
Separate chaining Open Addressing, Linear Probing Quadratic probing, Double Hashing
Rehashing, Extensible Hashing
PART-A (Multiple Choice Questions)
Q. Questions Course Competen
No Outcom ce
e BT Level
1 Other name for directed graph is .......... CO5 BT2
a) Direct graph
b) Digraph
c) Dir-graph
d) Digraph
Ans:D
2 Graph G is .............. (V,E) whereV(G) represents set of vertices and CO5 BT2
E(G) represents setoff edges.
a) Leterally connected
b) Widely Connected
c) Ordered set
d) Literally connected
Ans:C
3 The vertex with zero degree........ CO5 BT2
a) Isolated vertex
b) no cycle graph
c) non cycle graph
d) circular graph
Ans:A
8 Topological sorting for Directed Acyclic Graph (DAG) is a ______ CO5 BT2
ordering of vertices
a) Ascending
b) Decending
c) Linear
d) Non Linear
Ans:B
9 Topological Sorting for a graph is not possible if the graph is not a CO5 BT2
_____
a) Directed Acyclic Graph (DAG)
b) Directed Graph
c) Linear
d) Non Linear
Ans:A
10 Which of the following is/are the operations performed by kruskal’s CO5 BT1
algorithm?
i)sort the edges of G in increasing order by length
ii)keep a subgraph S of G initially empty
iii)builds a tree one vertex at a time
a) i, and ii only
b) ii and iii only
c) i and iii only
d) All i, ii and iii
Ans:A
11 .……………… is known as a greedy algorithm, because it chooses CO5 BT2
at each step the cheapest edge to add to subgraph S.
a) Kruskal’s algorithm
b) Prim’s algorithm
c) Dijkstra algorithm
d) Bellman ford algorithm
Ans :A
12 Dijkstra’s Algorithm cannot be applied on ______________ CO5 BT4
a) A Directed and weighted graphs
b) Graphs having negative weight function
c) Unweighted graphs
d) Undirected and unweighted graphs
ANS:B
13 How many priority queue operations are involved in Dijkstra’s CO5 BT1
Algorithm?
a) 1
b) 3
c) 2
d) 4
Ans:b
14 The maximum number of times the decrease key operation CO5 BT4
performed in Dijkstra’s algorithm will be equal to ___________
a) Total number of vertices
b) Total number of edges
c) Number of vertices – 1
d) Number of edges – 1
Ans:b
Ans: b
20 A hash table can store a maximum of 10 records, currently there are CO5,CO6 BT5
records in location 1, 3,4,7,8,9,10. The probability of a new record
going into location 2, with hash functions resolving collisions by
linear probing is
a) 0.1
b) 0.6
c) 0.2
d) 0.5
Answer: b
21 If several elements are competing for the same bucket in the hash CO5 BT2
table, what is it called?
a) Diffusion
b) Replication
c) Collision
d) Duplication
Answer: b
Answer: a
a)O(n)
b)O (logn)
c)O(nlogn)
d)O(1)
Answer: d
24 In simple uniform hashing, what is the search complexity? CO5 BT1
a)O(n)
b)O(logn)
c)O(nlogn)
d)O(1)
Answer: d
Answer: b
PART B (4 Marks)
1 Define Graph? CO5 BT1
2 Write short notes on adjacent nodes. CO5 BT4
3 What is the use of Kruskal’s algorithm and who discovered it? CO5 BT1
4 Compare indegree and out degree of a graph. CO5,CO6 BT4
5 What is an undirected graph? CO5 BT1
6 What is a directed graph? CO5 BT1
7 What is meant by strongly connected in a graph? CO5 BT1
8 Discuss in detail about depth of the tree CO5 BT6
PART C (12 Marks)
1 Explain the various representation of graph with example in detail? CO5 BT2
2 What is topological sort? Write an algorithm to perform topological CO5 BT1
sort?
3 Construct the steps for implementing Dijkstra's algorithm with an CO5 BT3
example.
4 Explain Extendible hashing in detail. CO5 BT2
5 Explain Rehashing in detail CO5 BT2