

MCQOPTIONS
Saved Bookmarks
This section includes 15 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. |
Can a tree stored in an array using either one of inorder or post order or pre order traversals be again reformed? |
A. | Yes just traverse through the array and form the tree |
B. | No we need one more traversal to form a tree |
C. | No in case of sparse trees |
D. | Yes by using both inorder and array elements |
Answer» C. No in case of sparse trees | |
2. |
Why is heap implemented using array representations than tree(linked list) representations though both tree representations and heaps have same complexities? Then why go with array representation when both are having same values ? |
A. | arrays can store trees which are complete and heaps are not complete |
B. | lists representation takes more memory hence memory efficiency is less and go with arrays and arrays have better caching |
C. | lists have better caching |
D. | In lists insertion and deletion is difficultView Answer |
Answer» C. lists have better caching | |
3. |
Consider a situation of writing a binary tree into a file with memory storage efficiency in mind, is array representation of tree is good? |
A. | yes because we are overcoming the need of pointers and so space efficiency |
B. | yes because array values are indexable |
C. | No it is not efficient in case of sparse trees and remaning cases it is fine |
D. | No linked list representation of tree is only fine |
Answer» D. No linked list representation of tree is only fine | |
4. |
If the tree is not a complete binary tree then what changes can be made for easy access of children of a node in the array? |
A. | every node stores data saying which of its children exist in the array |
B. | no need of any changes continue with 2w and 2w+1, if node is at i |
C. | keep a seperate table telling children of a node |
D. | use another array parallel to the array with tree |
Answer» B. no need of any changes continue with 2w and 2w+1, if node is at i | |
5. |
What is the parent for a node ‘w’ of a complete binary tree in an array representation when w is not 0? |
A. | floor(w-1/2) |
B. | ceil(w-1/2) |
C. | w-1/2 |
D. | w/2 |
Answer» B. ceil(w-1/2) | |
6. |
What are the children for node ‘w’ of a complete-binary tree in an array representation? |
A. | 2w and 2w+1 |
B. | 2+w and 2-w |
C. | w+1/2 and w/2 |
D. | w-1/2 and w+1/2 |
Answer» B. 2+w and 2-w | |
7. |
What must be the ideal size of array if the height of tree is ‘l’? |
A. | 2l-1 |
B. | l-1 |
C. | l |
D. | 2l |
Answer» B. l-1 | |
8. |
What is/are the disadvantages of implementing tree using normal arrays? |
A. | difficulty in knowing children nodes of a node |
B. | difficult in finding the parent of a node |
C. | have to know the maximum number of nodes possible before creation of trees |
D. | difficult to implement |
Answer» D. difficult to implement | |
9. |
How many children does a binary tree have? |
A. | 2 |
B. | any number of children |
C. | 0 or 1 or 2 |
D. | 0 or 1 |
Answer» D. 0 or 1 | |
10. |
If the tree is not a complete binary tree then what changes can be made for easy access of children of a node in the array ? |
A. | every node stores data saying which of its children exist in the array |
B. | no need of any changes continue with 2w and 2w+1, if node is at i |
C. | keep a seperate table telling children of a node |
D. | use another array parallel to the array with tree |
Answer» B. no need of any changes continue with 2w and 2w+1, if node is at i | |
11. |
What is the parent for a node ‘w’ of a complete binary tree in an array representation when w is not 0?$ |
A. | floor(w-1/2) |
B. | ceil(w-1/2) |
C. | w-1/2 |
D. | w/2 |
Answer» B. ceil(w-1/2) | |
12. |
What are the children for node ‘w’ of a complete-binary tree in an array representation?$ |
A. | 2w and 2w+1 |
B. | 2+w and 2-w |
C. | w+1/2 and w/2 |
D. | w-1/2 and w+1/2 |
Answer» B. 2+w and 2-w | |
13. |
What must be the ideal size of array if the height of tree is ‘l’?$ |
A. | 2<sup>l</sup>-1 |
B. | l-1 |
C. | l |
D. | 2l |
Answer» B. l-1 | |
14. |
Disadvantage of using array representation for binary trees is? |
A. | difficulty in knowing children nodes of a node |
B. | difficult in finding the parent of a node |
C. | have to know the maximum number of nodes possible before creation of trees |
D. | difficult to implement |
Answer» D. difficult to implement | |
15. |
Binary trees can have how many children? |
A. | 2 |
B. | any number of children |
C. | 0 or 1 or 2 |
D. | 0 or 1 |
Answer» D. 0 or 1 | |