Explore topic-wise MCQs in Data Structures and Algorithms.

This section includes 6 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 a binary search tree, which of the following traversals would print the numbers in the ascending order?

A. Level-order traversal
B. Pre-order traversal
C. Post-order traversal
D. In-order traversal
Answer» E.
2.

Which of the following graph traversals closely imitates level order traversal of a binary tree?

A. Depth First Search
B. Breadth First Search
C. Depth & Breadth First Search
D. Binary Search
Answer» C. Depth & Breadth First Search
3.

What is the time complexity of level order traversal?

A. O(1)
B. O(n)
C. O(logn)
D. O(nlogn)
Answer» C. O(logn)
4.

What is the space complexity of the in-order traversal in the recursive fashion? (d is the tree depth and n is the number of nodes)

A. O(1)
B. O(nlogd)
C. O(logd)d) O(
D. O(logd)d) O(d)
Answer» E.
5.

For the tree below, write the level-order traversal.

A. 2, 7, 2, 6, 5, 11, 5, 9, 4
B. 2, 7, 5, 2, 6, 9, 5, 11, 4
C. 2, 5, 11, 6, 7, 4, 9, 5, 2
D. 2, 7, 5, 6, 11, 2, 5, 4, 9
Answer» C. 2, 5, 11, 6, 7, 4, 9, 5, 2
6.

For the tree below, write the in-order traversal.

A. 2, 7, 2, 6, 5, 11, 5, 9, 4
B. 2, 7, 5, 2, 6, 9, 5, 11, 4
C. 2, 5, 11, 6, 7, 4, 9, 5, 2
D. 2, 7, 5, 6, 11, 2, 5, 4, 9
Answer» E.