Question 1
Which of the following ways is preferred to represent a graph for its efficient BFS and DFS traversals for a general graph which may not be very well connected?
Adjacency Matrix
Adjacency List
Both are same efficiency wise
None of the two are efficient
Question 2
For a given graph G having v vertices and e edges which is connected and has no cycles, which of the following statements is true?
v = e
v = e+1
v + 1 = e
v = e-1
Question 3
Which of the following is true about BFS traversal (from a given source) of an unweighted, connected and undirected graph?
The paths found in the BFS traversal are the shortest paths from source to every other vertex
The BFS traversal find transitive closure of the graph
The sequences of vertices explored by BFS and DFS are always same
A recursive BFS traversal would perform better than the iterative BFS.
Question 4
What is the time complexity of DFS traversal of a graph represented as adjacency list. The graph has V vertices and E edges.
O(V + E)
O(V)
O(E)
O(V*E)
Question 5
How do we detect cycle in an udirected graph using DFS?
If current vertex has an adjacent that is already visited, then there is a cycle
If current vertex has an adjacent that is already visited and is not parent (in DFS Tree) of the current vertex, then there is a cycle.
We cannot use DFS to detect cycle
If we make a recursive call for the same vertex again, then there is a cycle.
Question 6
What is the time complexity of complete BFS traversal of a graph which may be disconencted?
You may assume that the graph is represented as adjacency list and you need to tick the tightest bound on time.
O(V + E)
O(V*E)
O(V * (V+E))
O(E * E)
Question 7
Which of the following is the most commonly used data structure for implementing Dijkstra’s Algorithm?
Max priority queue
Stack
Circular queue
Min priority queue
Question 8
What is the time complexity of Dijkstra’s algorithm for adjacency list representation of a graph?
O(E Log V)
O(V Log V)
O(V*E)
O(V*V)
Question 9
In most of the cases, topological sort starts from a node which has __________
Maximum Degree
Minimum Degree
Any degree
Zero Degree
Question 10
Topological sort can be implemented using?
Using Depth First Search Only
Using Breadth First Search Only
Using Depth or Breadth First Search
Neither Depth First nor Breadth First
There are 10 questions to complete.