Q. In a weighted graph, if all edge weights are equal, which algorithm can be used instead of Dijkstra's?
A.
Depth-First Search
B.
Breadth-First Search
C.
A* Search
D.
Bellman-Ford Algorithm
Show solution
Solution
If all edge weights are equal, Breadth-First Search can be used to find the shortest path, as it explores all neighbors at the present depth prior to moving on.
Correct Answer:
B
— Breadth-First Search
Learn More →
Q. In which real-world application is Dijkstra's algorithm commonly used?
A.
Finding the shortest route in GPS navigation
B.
Sorting a list of names
C.
Searching for a book in a library
D.
Managing a queue of customers
Show solution
Solution
Dijkstra's algorithm is widely used in GPS navigation systems to calculate the shortest route between locations.
Correct Answer:
A
— Finding the shortest route in GPS navigation
Learn More →
Q. What data structure is typically used to implement Dijkstra's algorithm efficiently?
A.
Array
B.
Linked List
C.
Priority Queue
D.
Stack
Show solution
Solution
A priority queue is used in Dijkstra's algorithm to efficiently retrieve the next node with the smallest tentative distance.
Correct Answer:
C
— Priority Queue
Learn More →
Q. What is a limitation of Dijkstra's algorithm?
A.
It cannot find paths in directed graphs.
B.
It cannot handle graphs with negative weights.
C.
It is slower than breadth-first search.
D.
It requires a complete graph.
Show solution
Solution
Dijkstra's algorithm cannot handle graphs with negative weight edges, as it may produce incorrect results.
Correct Answer:
B
— It cannot handle graphs with negative weights.
Learn More →
Q. Which of the following is NOT a real-world application of shortest path algorithms?
A.
Network routing
B.
Urban traffic management
C.
Social network analysis
D.
Sorting data in a database
Show solution
Solution
Sorting data in a database is not a real-world application of shortest path algorithms; it is related to data organization rather than pathfinding.
Correct Answer:
D
— Sorting data in a database
Learn More →
Q. Which of the following statements about Dijkstra's algorithm is true?
A.
It can handle negative weight edges.
B.
It always finds the shortest path.
C.
It is a depth-first search algorithm.
D.
It can be used for unweighted graphs only.
Show solution
Solution
Dijkstra's algorithm always finds the shortest path in graphs with non-negative weights.
Correct Answer:
B
— It always finds the shortest path.
Learn More →
Showing 1 to 6 of 6 (1 Pages)