Graph Traversal: BFS and DFS - Applications - Case Studies

Download Q&A
Q. In a depth-first search, what happens when a node is visited?
  • A. It is added to the queue.
  • B. It is marked as visited and all its adjacent nodes are explored.
  • C. It is removed from the graph.
  • D. It is added to the stack.
Q. In which scenario is BFS preferred over DFS?
  • A. When the graph is very deep and solutions are rare.
  • B. When you need to find the shortest path in an unweighted graph.
  • C. When memory usage is a concern.
  • D. When the graph is sparse.
Q. What is a common application of DFS?
  • A. Finding the shortest path in a weighted graph.
  • B. Topological sorting of a directed acyclic graph.
  • C. Finding the minimum spanning tree.
  • D. Finding connected components in a graph.
Q. What is a disadvantage of using DFS compared to BFS?
  • A. DFS uses more memory than BFS.
  • B. DFS may not find the shortest path.
  • C. DFS is slower than BFS.
  • D. DFS cannot be implemented using recursion.
Q. What is the primary difference between BFS and DFS in graph traversal?
  • A. BFS uses a stack, while DFS uses a queue.
  • B. BFS explores all neighbors at the present depth before moving on, while DFS explores as far as possible along a branch.
  • C. BFS is faster than DFS in all cases.
  • D. DFS is used for finding the shortest path, while BFS is not.
Q. Which algorithm is typically used for finding connected components in a graph?
  • A. Dijkstra's Algorithm
  • B. Prim's Algorithm
  • C. BFS or DFS
  • D. Kruskal's Algorithm
Q. Which data structure is used to implement BFS?
  • A. Stack
  • B. Queue
  • C. Linked List
  • D. Array
Q. Which of the following statements about BFS is true?
  • A. BFS can be implemented recursively.
  • B. BFS is not suitable for large graphs.
  • C. BFS guarantees the shortest path in weighted graphs.
  • D. BFS explores nodes level by level.
Q. Which traversal method would you use to check if a graph is bipartite?
  • A. DFS
  • B. BFS
  • C. Both DFS and BFS
  • D. Neither DFS nor BFS
Showing 1 to 9 of 9 (1 Pages)
Soulshift Feedback ×

On a scale of 0–10, how likely are you to recommend The Soulshift Academy?

Not likely Very likely