YOU CAN DOWNLOAD 200+ SUBJECTS PDF BOOK FOR COMPETITIVE EXAMINATIONS CLICK HERE TO DOWNLOAD

Data Structure Questions and Answers-Binary Trees using Array

 Question 1 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Binary trees can have how many children?
 A 2 B any number of children C 0 or 1 or 2 D 0 or 1
Question 1 Explanation:
Can have atmost 2 nodes.

 Question 2 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
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
Question 2 Explanation:
The array is fixed size (may be dynamic array or static array) but size is fixed.

 Question 3 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
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
Question 3 Explanation:
Since maximum elements in a tree (complete binary tree) of height l will be 2l-1 so a good array size must be that (since a binary tree node may not always have 2 children but for safety a is correct).

 Question 4 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
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
Question 4 Explanation:
Since each node has 2 children and so counting from beginning, a particular node will have children as option a.

 Question 5 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
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
Question 5 Explanation:
Floor of w-1/2 because we can't miss a node.

There are 5 questions to complete.