# Dijkstra’s Algorithm Multiple choice Questions and Answers (MCQs)

## Click on any option to know the CORRECT ANSWERS

 Question 1
Dijkstra's Algorithm is used to solve ..... problems.
 A All pair shortest path B Single source shortest path C Network flow D Sorting

Question 1 Explanation:
Dijkstra's Algorithm is used for solving single source shortest path problems. In this algorithm, a single node is fixed as a source node and shortest paths from this node to all other nodes in graph is found.

 Question 2
Which of the following is the most commonly used data structure for implementing Dijkstra's Algorithm?
 A Max priority queue B Stack C Circular queue D Min priority queue

Question 2 Explanation:
Minimum priority queue is the most commonly used data structure for implementing Dijkstra's Algorithm because the required operations to be performed in Dijkstra's Algorithm match with specialty of a minimum priority queue.

 Question 3
What is the time complexity of Dijikstra's algorithm?
 A O(N) B O(N3) C O(N2) D O(logN)

Question 3 Explanation:
Time complexity of Dijkstra's algorithm is O(N2) because of the use of doubly nested for loops. It depends on how the table is manipulated.

 Question 4
Dijkstra's Algorithm cannot be applied on .....
 A Directed and weighted graphs B Graphs having negative weight function C Unweighted graphs D Undirected and unweighted graphs

Question 4 Explanation:
Dijkstra's Algorithm cannot be applied on graphs having negative weight function because calculation of cost to reach a destination node from the source node becomes complex.

 Question 5
What is the pseudo code to compute the shortest path in Dijkstra's algorithm?
 A if(!T[w].Known) if(T[v].Dist + C(v, w) < T[w].Dist) { Decrease(T[w].Dist to B if(T[w].Known) if(T[v].Dist + C(v, w) < T[w].Dist) { Increase (T[w].Dist to T[ C if(!T[w].Known) if(T[v].Dist + C(v, w) > T[w].Dist) { Decrease(T[w].Dis D if(T[w].Known) if(T[v].Dist + C(v, w) < T[w].Dist) { Increase(T[w].Dist to T[v