Explore topic-wise MCQs in Data Structures and Algorithms.

This section includes 12 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. Thrice
Answer» D. Thrice
2.

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
3.

Which of the following is not an application of Depth First Search?

A. For generating topological sort of a graph
B. For generating Strongly Connected Components of a directed graph
C. Detecting cycles in the graph
D. Peer to Peer Networks
Answer» E.
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. O(V*E)
Answer» B. O(V)
5.

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
6.

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
7.

When the Depth First Search of a graph is unique?

A. When the graph is a Binary Tree
B. When the graph is a Linked List
C. When the graph is a n-ary Tree
D. None of the mentioned
Answer» C. When the graph is a n-ary Tree
8.

What can be the applications of Depth First Search?

A. For generating topological sort of a graph
B. For generating Strongly Connected Components of a directed graph
C. Detecting cycles in the graph
D. All of the mentioned
Answer» E.
9.

A person wants to visit some places. He starts from a vertex and then wants to visit every vertex till it finishes from one vertex, backtracks and then explore other vertex from same vertex. What algorithm he should use?

A. Depth First Search
B. Breadth First Search
C. Trim’s algorithm
D. None of the mentioned
Answer» B. Breadth First Search
10.

The Depth First Search traversal of a graph will result into?

A. Linked List
B. Tree
C. Graph with back edges
D. None of the mentioned
Answer» C. Graph with back edges
11.

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)
12.

Depth First Search is equivalent to which of the traversal in the Binary Trees?

A. Pre-order Traversal
B. Post-order Traversal
C. Level-order Traversal
D. In-order Traversal
Answer» B. Post-order Traversal