Explore topic-wise MCQs in Data Structures and Algorithms.

This section includes 22 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.

In Depth First Search, how many times a node is visited?

A. Once
B. Twice
C. Equivalent to number of indegree of the node
D. None of the mentioned
Answer» D. None of the mentioned
2.

Time Complexity of Breadth First Search is? (V – number of vertices, E – number of edges)

A. O(V + E)
B. O(V)
C. O(E)
D. None of the mentioned
Answer» B. O(V)
3.

In BFS, how many times a node is visited?

A. Once
B. Twice
C. equivalent to number of indegree of the node
D. None of the mentioned
Answer» D. None of the mentioned
4.

Time Complexity of DFS is? (V - number of vertices, E - number of edges)

A. O(V + E)
B. O(V)
C. O(E)
D. None of the mentioned
Answer» B. O(V)
5.

Regarding implementation of Depth First Search using stacks, what is the maximum distance between two nodes present in the stack? (considering each edge length 1)

A. Can be anything
B. 0
C. At most 1
D. Insufficient Information
Answer» B. 0
6.

What will be the result of depth first traversal in the following tree?

A. 4 2 5 1 3
B. 1 2 4 5 3
C. 4 5 2 3 1
D. 1 2 3 4 5
Answer» C. 4 5 2 3 1
7.

Regarding implementation of Breadth First Search using queues, what is the maximum distance between two nodes present in the queue? (considering each edge length 1)

A. Can be anything
B. 0
C. At most 1
D. Insufficient Information
Answer» D. Insufficient Information
8.

What is the space complexity of standard DFS(V: no. of vertices E: no. of edges)?

A. O(V+E)
B. O(V)
C. O(E)
D. O(V*E)
Answer» C. O(E)
9.

Choose the incorrect statement about DFS and BFS from the following?

A. BFS is equivalent to level order traversal in trees
B. DFS is equivalent to post order traversal in trees
C. DFS and BFS code has the same time complexity
D. BFS is implemented using queue
Answer» C. DFS and BFS code has the same time complexity
10.

Which of the following is a possible result of depth first traversal of the given graph(consider 1 to be source element)?

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

What will be the time complexity of the iterative depth first traversal code(V=no. of vertices E=no.of edges)?

A. O(V+E)
B. O(V)
C. O(E)
D. O(V*E)
Answer» B. O(V)
12.

Which of the following data structure is used to implement BFS?

A. linked list
B. tree
C. stack
D. queue
Answer» E.
13.

Which type of best first search algorithm was used to predict the closeness of the end of path and its solution?

A. Greedy BFS
B. Divide and Conquer
C. Heuristic BFS
D. Combinatorial
Answer» B. Divide and Conquer
14.

Who published the first A* search algorithm?

A. Peter Hart
B. Nils Nilsson
C. Bertram Raphael
D. Hans Berliner
Answer» E.
15.

Which algorithm is used in graph traversal and path finding?

A. A*
B. C*
C. D*
D. E*
Answer» B. C*
16.

Which of the following is an example of Best First Search algorithm?

A. A*
B. B*
C. C*
D. Both A* and B*
Answer» E.
17.

Which of the following is the greedy best first search?

A. Pure Heuristic Search
B. A*
C. B*
D. Both A* and B*
Answer» B. A*
18.

Is Best First Search a searching algorithm used in graphs.

A. True
B. False
Answer» B. False
19.

What is the other name of the greedy best first search?

A. Heuristic Search
B. Pure Heuristic Search
C. Combinatorial Search
D. Divide and Conquer Search
Answer» B. Pure Heuristic Search
20.

Who published the B* search algorithm?

A. Peter Hart
B. Nils Nilsson
C. Bertram Raphael
D. Hans Berliner
Answer» E.
21.

Which algorithm is used to find the least cost path from source node to destination node?

A. A* BFS
B. C* BFS
C. D* BFS
D. B* BFS
Answer» E.
22.

Who described this Best First Search algorithm using heuristic evaluation rule?

A. Judea Pearl
B. Max Bezzel
C. Franz Nauck
D. Alan Turing
Answer» B. Max Bezzel