Graph Traversal (BFS and DFS): GATE CS Previous Year Questions

Graph Traversal (BFS and DFS) · Algorithms

16 questions · asked in 11 of 27 years (2000–2026)

MCQ 12 · MSQ 2 · NAT 21-mark 12 · 2-mark 4

2000Questions per year2026

Questions 6–10 of 16

Q6GATE 20082 marksMCQ−0.67 if wrong
Consider the following sequence of nodes for the undirected graph given below:
1.a b e f d g c
2.a b e f c g d
3.a d g e b c f
4.a d b c g e f
A Depth First Search (DFS) is started at node a. The nodes are listed in the order they are first visited. Which of the above is/are possible output(s)?
c b a e f d g

Q7GATE 20081 markMCQ−0.33 if wrong
The Breadth First Search algorithm has been implemented using the queue data structure. One possible order of visiting the nodes of the following graph is
MNO RQP

Q8GATE 20081 markMCQ−0.33 if wrong
The most efficient algorithm for finding the number of connected components in an undirected graph on n vertices and m edges has time complexity

Q9GATE 20071 markMCQ−0.33 if wrong
A depth-first search is performed on a directed acyclic graph. Let d[u] denote the time at which vertex u is visited for the first time and f[u] the time at which the DFS call to the vertex u terminates. Which of the following statements is always TRUE for all edges (u, v) in the graph ?

Q10GATE 20071 markMCQ−0.33 if wrong
Consider the DAG with V = {1,2,3,4,5,6}, shown below.
1 2 5 4 3 6
Which of the following is NOT a topological ordering?

Keep practising

Topics in Algorithms

All CS topics ›