

MCQOPTIONS
Saved Bookmarks
This section includes 7 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. |
Consider the following data and specify which one is Preorder Traversal Sequence, Inorder and Postorder sequences.S1: N, M, P, O, QS2: N, P, Q, O, MS3: M, N, O, P, Q |
A. | S1 is preorder, S2 is inorder and S3 is postorder |
B. | S1 is inorder, S2 is preorder and S3 is postorder |
C. | S1 is inorder, S2 is postorder and S3 is preorder |
D. | S1 is postorder, S2 is inorder and S3 is preorder |
Answer» D. S1 is postorder, S2 is inorder and S3 is preorder | |
2. |
Consider the following data. The pre order traversal of a binary tree is A, B, E, C, D. The in order traversal of the same binary tree is B, E, A, D, C. The level order sequence for the binary tree is _________ |
A. | A, C, D, B, E |
B. | A, B, C, D, E |
C. | A, B, C, E, D |
D. | D, B, E, A, C |
Answer» C. A, B, C, E, D | |
3. |
To obtain a prefix expression, which of the tree traversals is used? |
A. | Level-order traversal |
B. | Pre-order traversal |
C. | Post-order traversal |
D. | In-order traversal |
Answer» C. Post-order traversal | |
4. |
What is the space complexity of the post-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. |
What is the time complexity of pre-order traversal in the iterative fashion? |
A. | O(1) |
B. | O(n) |
C. | O(logn) |
D. | O(nlogn) |
Answer» C. O(logn) | |
6. |
For the tree below, write the post-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» D. 2, 7, 5, 6, 11, 2, 5, 4, 9 | |
7. |
For the tree below, write the pre-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» B. 2, 7, 5, 2, 6, 9, 5, 11, 4 | |