Explore topic-wise MCQs in Data Structures and Algorithms.

This section includes 40 Mcqs, each offering curated multiple-choice questions to sharpen your Data Structures and Algorithms knowledge and support exam preparation. Choose a topic below to get started.

1.

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
Answer» C. Unweighted graphs
2.

Dijkstra's Algorithm is the prime example for ___________

A. Greedy algorithm
B. Branch and bound
C. Back tracking
D. Dynamic programming
Answer» B. Branch and bound
3.

Dijkstra's Algorithm run on a weighted, directed graph G={V,E} with non-negative weight function w and source s, terminates with d[u]=delta(s,u) for all vertices u in V.

A. True
B. False
Answer» B. False
4.

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
Answer» E.
5.

Floyd Warshall's Algorithm is used for solving ____________

A. All pair shortest path problems
B. Single Source shortest path problems
C. Network flow problems
D. Sorting problems
Answer» B. Single Source shortest path problems
6.

Dijikstra's Algorithm is more efficient than Bellmann Ford Algorithm.

A. True
B. False
Answer» B. False
7.

Using logical operator's instead arithmetic operators saves time and space.

A. True
B. False
Answer» B. False
8.

Dijkstra's Algorithm is used to solve _____________ problems.

A. All pair shortest path
B. Single source shortest path
C. Network flow
D. Sorting
Answer» C. Network flow
9.

What is running time of Dijkstra's algorithm using Binary min- heap method?

A. O(V)
B. O(VlogV)
C. O(E)
D. O(ElogV)
Answer» E.
10.

Consider the following graph: What is the minimum cost to travel from node A to node C

A. 5
B. 2
C. 1
D. 3
Answer» C. 1
11.

Bellmann Ford Algorithm can be applied for _____________

A. Undirected and weighted graphs
B. Undirected and unweighted graphs
C. Directed and weighted graphs
D. All directed graphs
Answer» D. All directed graphs
12.

What is the running time of the Floyd Warshall Algorithm?

A. Big-oh(V)
B. Theta(V2)
C. Big-Oh(VE)
D. Theta(V3)
Answer» E.
13.

How many times the for loop in the Bellmann Ford Algorithm gets executed?

A. V times
B. V-1
C. E
D. E-1
Answer» C. E
14.

Bellmann Ford algorithm was first proposed by ________

A. Richard Bellmann
B. Alfonso Shimbe
C. Lester Ford Jr
D. Edward F. Moore
Answer» C. Lester Ford Jr
15.

Bellmann Ford Algorithm is an example for ____________

A. Dynamic Programming
B. Greedy Algorithms
C. Linear Programming
D. Branch and Bound
Answer» B. Greedy Algorithms
16.

A graph is said to have a negative weight cycle when?

A. The graph has 1 negative weighted edge
B. The graph has a cycle
C. The total weight of the graph is negative
D. The graph has 1 or more negative weighted edges
Answer» D. The graph has 1 or more negative weighted edges
17.

The maximum number of times the decrease key operation performed in Dijkstra's algorithm will be equal to ___________

A. Total number of vertices
B. Total number of edges
C. Number of vertices - 1
D. Number of edges - 1
Answer» C. Number of vertices - 1
18.

Floyd Warshall's Algorithm can be applied on __________

A. Undirected and unweighted graphs
B. Undirected graphs
C. Directed graphs
D. Acyclic graphs
Answer» D. Acyclic graphs
19.

What approach is being followed in Floyd Warshall Algorithm?

A. Greedy technique
B. Dynamic Programming
C. Linear Programming
D. Backtracking
Answer» C. Linear Programming
20.

The running time of Bellmann Ford algorithm is lower than that of Dijkstra's Algorithm.

A. True
B. False
Answer» C.
21.

What is the time complexity of Dijikstra's algorithm?

A. O(N)
B. O(N3)
C. O(N2)
D. O(logN)
Answer» D. O(logN)
22.

What is the basic principle behind Bellmann Ford Algorithm?

A. Interpolation
B. Extrapolation
C. Regression
D. Relaxation
Answer» E.
23.

Consider the following graph. If b is the source vertex, what is the minimum cost to reach f vertex?

A. 8
B. 9
C. 4
D. 6
Answer» E.
24.

How many times the insert and extract min operations are invoked per vertex?

A. 1
B. 2
C. 3
D. 0
Answer» B. 2
25.

What is the running time of Bellmann Ford Algorithm?

A. O(V)
B. O(V2)
C. O(ElogV)
D. O(VE)
Answer» E.
26.

Bellmann ford algorithm provides solution for ____________ problems.

A. All pair shortest path
B. Sorting
C. Network flow
D. Single source shortest path
Answer» E.
27.

How many solution/solutions are available for a graph having negative weight cycle?

A. One solution
B. Two solutions
C. No solution
D. Infinite solutions
Answer» D. Infinite solutions
28.

How many priority queue operations are involved in Dijkstra's Algorithm?

A. 1
B. 3
C. 2
D. 4
Answer» C. 2
29.

In the given graph:Identify the shortest path having minimum cost to reach vertex E if A is the source vertex

A. a-b-e
B. a-c-e
C. a-c-d-e
D. a-c-d-b-e
Answer» C. a-c-d-e
30.

Bellmann Ford algorithm is used to indicate whether the graph has negative weight cycles or not.

A. True
B. False
Answer» B. False
31.

The Bellmann Ford algorithm returns _______ value.

A. Boolean
B. Integer
C. String
D. Double
Answer» B. Integer
32.

Floyd- Warshall algorithm was proposed by ____________

A. Robert Floyd and Stephen Warshall
B. Stephen Floyd and Robert Warshall
C. Bernad Floyd and Robert Warshall
D. Robert Floyd and Bernad Warshall
Answer» B. Stephen Floyd and Robert Warshall
33.

Floyd Warshall Algorithm can be used for finding _____________

A. Single source shortest path
B. Topological sort
C. Minimum spanning tree
D. Transitive closure
Answer» E.
34.

What procedure is being followed in Floyd Warshall Algorithm?

A. Top down
B. Bottom up
C. Big bang
D. Sandwich
Answer» C. Big bang
35.

Who proposed the modern formulation of Floyd-Warshall Algorithm as three nested loops?

A. Robert Floyd
B. Stephen Warshall
C. Bernard Roy
D. Peter Ingerman
Answer» E.
36.

The time taken to compute the transitive closure of a graph is Theta(n2).

A. True
B. False
Answer» C.
37.

In the given graphHow many intermediate vertices are required to travel from node a to node e at a minimum cost?

A. 2
B. 0
C. 1
D. 3
Answer» D. 3
38.

What is the formula to compute the transitive closure of a graph?

A. tij(k) = tij(k-1) AND (tik(k-1) OR tkj(k-1))
B. tij(k) = tij(k-1) OR (tik(k-1) AND tkj(k-1))
C. tij(k) = tij(k-1) AND (tik(k-1) AND tkj(k-1))
D. tij(k) = tij(k-1) OR (tik(k-1) OR tkj(k-1))
Answer» C. tij(k) = tij(k-1) AND (tik(k-1) AND tkj(k-1))
39.

In the given graph What is the minimum cost to travel from vertex 1 to vertex 3?

A. 3
B. 2
C. 10
D. -3
Answer» E.
40.

What happens when the value of k is 0 in the Floyd Warshall Algorithm?

A. 1 intermediate vertex
B. 0 intermediate vertex
C. N intermediate vertices
D. N-1 intermediate vertices
Answer» C. N intermediate vertices