Vidyalelo
Data Structure · all questions

Graph Algorithms (DFS, BFS, Dijkstras, etc)
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

167

Questions

1/9

Page

Pick an option on a question to see the right answer and solution.

Which algorithm is used to find the shortest path from a source node to all other nodes in a graph with non-negative weights?

Select an option to see the answer and solution.

What is the time complexity of Breadth-First Search (BFS) on a graph with V vertices and E edges?

Select an option to see the answer and solution.

In Depth-First Search (DFS), what is the order of visiting nodes?

Select an option to see the answer and solution.

Which algorithm can be used to detect negative weight cycles in a graph?

Select an option to see the answer and solution.

What is the primary difference between BFS and DFS?

Select an option to see the answer and solution.

What data structure is commonly used to implement BFS?

Select an option to see the answer and solution.

Which of the following is not a property of Dijkstra's algorithm?

Select an option to see the answer and solution.

What type of graph traversal does Depth-First Search (DFS) utilize?

Select an option to see the answer and solution.

In which of the following scenarios is the Bellman-Ford algorithm preferred over Dijkstra's algorithm?

Select an option to see the answer and solution.

What is the time complexity of Dijkstra's algorithm using a binary heap priority queue?

Select an option to see the answer and solution.

What is the main purpose of a Minimum Spanning Tree (MST) algorithm like Prim's or Kruskal's?

Select an option to see the answer and solution.

Which traversal algorithm uses a stack as its primary data structure?

Select an option to see the answer and solution.

In BFS, how do you keep track of the nodes to be visited?

Select an option to see the answer and solution.

What is the role of the 'parent' array in the implementation of Dijkstra's algorithm?

Select an option to see the answer and solution.

In which case is the BFS traversal algorithm particularly useful?

Select an option to see the answer and solution.

What is the primary use of the Depth-First Search (DFS) algorithm in graph theory?

Select an option to see the answer and solution.

Which algorithm is used for finding the shortest path in a graph with all edges having the same weight?

Select an option to see the answer and solution.

What is the space complexity of storing an adjacency matrix for a graph with V vertices?

Select an option to see the answer and solution.

Which of the following algorithms can be used to find the Minimum Spanning Tree (MST) of a graph?

Select an option to see the answer and solution.

What is the primary characteristic of a graph traversal algorithm like BFS or DFS?

Select an option to see the answer and solution.