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 11–15 of 16

Q11GATE 20061 markMCQ−0.33 if wrong
Consider the depth-first-search of an undirected graph with 3 vertices P, Q, and R. Let discovery time d(u) represent the time instant when the vertex u is first visited, and finish time f(u) represent the time instant when the vertex u is last visited. Given that
d(P)=5 units  f(P)=12 units d(Q)=6 units f(Q)=10 unitsd(R)=14 unitf(R)=18 units\begin{array}{l|l}\hline \text{$d(P) = 5$ units } & \text{ $f(P) = 12$ units } \\\hline \text{$d(Q) = 6$ units} & \text{ $f(Q) = 10$ units} \\\hline \text{$d(R) = 14$ unit} & \text{$f(R) = 18$ units} \\\hline \end{array}
Which one of the following statements is TRUE about the graph?

Q12GATE 20061 markMCQ−0.33 if wrong
Let T be a depth first search tree in a undirected graph G Vertices u and v are leaves of this tree T. The degrees of both u and v in G are at least 2. Which one of the following statements is true?

Q13GATE 20051 markMCQ−0.33 if wrong
In a depth-first traversal of a graph G with n vertices, k edges are marked as tree edges. The number of connected components in G is

Q14GATE 20031 markMCQ−0.33 if wrong
Consider the following graph
a e b f h g
Among the following sequences
(I) a b e g h f
(II) a b f e h g
(III) a b f h g e
(IV) a f g h b e
Which are depth first traversals of the above graph?

Q15GATE 20011 markMCQ−0.33 if wrong
Consider the undirected unweighted graph G. Let a breadth-first traversal of G be done starting from a node r . Let d(r,u) and d(r,v) be the lengths of the shortest paths form r to u and v respectively in G. If u is visited before v during the breadth-first traversal, which of the following statements is correct ?

Keep practising

Topics in Algorithms

All CS topics ›