# Take This Data Structure - Binary Trees Quiz

30 Questions | Attempts: 3556
Share  Settings  Have you got knowledge about the binary trees in data structure? To test your knowledge, take this tree data structure quiz. We have got simple as well complex questions for your practice. You can take up the quiz and pick the maximum correct answers to get a good score. Don't feel bad even if you miss out on some questions, as you will get the correct one there and then. This quiz will not only test your knowledge but enhance it too. All the best!

• 1.
A full binary tree with 6 non-leaf nodes contains a maximum of
• A.

13 nodes

• B.

6 nodes

• C.

9 nodes

• D.

11 nodes

• 2.
A binary search tree is generated by inserting in order the following integers: 50, 15, 12, 25, 40, 58, 81, 31, 18, 37, 60, 24 The number of the node in the left sub-tree and right sub-tree of the root, respectively, is
• A.

(4, 7)

• B.

(7,4)

• C.

(8, 3)

• D.

(3,8)

• 3.
The following routine displays the ………….. element in a binary search tree. public void BST(Tree root) {         while(root.left() != null)         {                root = root.left();         }         System.out.println(root.data()); }
• 4.
If this tree is used for sorting, then new no 8 should be placed as the
• A.

Left child of the node labeled 6

• B.

Right child of the node labeled 14

• C.

Right child of the node labeled 6

• D.

Left child of the node labeled 9

• 5.
When you construct a BST with the preorder traversal of a binary search tree 10, 4, 3, 5, 11, 12,21,36, then which of the following are leaf nodes?
• A.

5,3,4

• B.

5,3,12

• C.

3,5,12

• D.

3,5,36

• 6.
Suppose the numbers 7, 5, 1, 8, 3, 6, 0, 9, 4, 2 are inserted in that order into an initially empty binary search tree. The binary search tree uses the usual ordering of natural numbers. Will the in-order traversal sequence of the resultant tree be the same for the numbers in the sequence9,7, 5, 1, 8, 3, 2,6, 0, 4  (Yes / No)
• A.

Yes

• B.

No

• 7.
The following numbers are inserted into an empty binary tree and binary search tree in the given order: 20,10, 1, 3, 5, 15, 12, 16,34,87,35. The height of the binary tree and binary search tree, respectively, is.
• A.

4,4

• B.

3,3

• C.

3,4

• D.

4,3

• 8.
The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42. Which one of the following is the postorder traversal sequence of the same tree?
• A.

10, 20, 15, 23, 25, 35, 42, 39, 30

• B.

15, 10, 25, 23, 20, 42, 35, 39, 30

• C.

15, 20, 10, 23, 25, 42, 35, 39, 30

• D.

15, 10, 23, 25, 20, 35, 42, 39, 30

• 9.
Construct a binary tree by using inorder and preorder sequences given below. Inorder:  D,B,H,E,I,A,F,C,G Preorder:  A,B,D,E,H,I,C,F,G Find the postorder traversal
• A.

D,H,E,I,B,F,G,C,A

• B.

A,C,G,F,B,I,E,H,D

• C.

D,H,I,E, B,F,G,C ,A

• D.

D,H,I,E,G,F,B,C,A

• 10.
Which of the two key sequences construct the same BSTs? Select the ones you like
• A.

A1[ ]  = {8, 3, 6, 1, 4, 7, 10, 14, 13} A2[ ] = {8, 10, 14, 3, 6, 4, 1, 7, 13}

• B.

B1[ ]= {15, 10, 25, 23, 20, 42, 35, 39, 30} B2[ ] ={15, 20, 10, 23, 25, 42, 35, 39, 30}

• C.

C1[ ]={7, 5, 1, 8, 3, 6, 9, 4, 2} C2[ ]={ 9,7, 5, 1, 8, 3, 2,6,  4}

• D.

D1[ ]={15, 10, 25, 23, 20, 42, 35, 39, 30} D2[ ]={ 15,35,39,10,25,20,23,42,30}

• 11.
Which of the following is AVL Tree?
• A.

Only A

• B.

A and C

• C.

A, B, and C

• D.

Only B

• 12.
Consider the given AVL Tree. If node 2 is added to this, then the parent node of 5 in a balanced tree is
• A.

8

• B.

4

• C.

11

• D.

12

• 13.
What is the maximum height of any AVL tree with 7 nodes? Assume that the height of a tree with a single node is 0.
• A.

2

• B.

3

• C.

4

• D.

5

• 14.
Insert the following sequence of elements into an AVL tree, starting with an empty tree:  10, 20, 15, 25, 30, 16, 18, 19 after deleting node 30 from the AVL tree then the root node of the resultant tree is
• A.

18

• B.

20

• C.

30

• D.

15

• 15.
Show the result when an initially empty AVL tree has keys 1 through 8 inserted in order. Then the node in the last level will be
• A.

8

• B.

7,8

• C.

7

• D.

6,7

• 16.
AVL tree of height 4 contains ……………. minimum possible number of nodes
• A.

11

• B.

12

• C.

14

• D.

10

• 17.
To restore the AVL property after inserting an element, we start at the insertion point and move towards the root of that tree. Is this statement true?
• A.

True

• B.

False

• 18.
Given an empty AVL tree, how would you construct an AVL tree when a set of numbers are given without performing any rotations?
• A.

Just build the tree with the given input

• B.

Find the median of the set of elements given, make it a root

• C.

Use trial and error

• D.

Use dynamic programming to build the tree

• 19.
The balance factor of node A was 0 and, a node was inserted to the left of node A then
• A.

It is required to balance Node A

• B.

It is required to balance the Right child of A

• C.

It is required to balance the Parent of node A

• D.

Balancing may or may not be required for A

• 20.
AVL is traversed in the following order recursively: Right, root, left. The output sequence will be in
• A.

Descending order

• B.

Ascending order

• C.

Level-wise order

• D.

No specific order

• 21.
Given the code, choose the correct option that is consistent with the code. (Here A is the heap)    build(A,i)      left-> 2*i      right->2*i +1      temp- > i             if(left<= heap_length[A] and A[left] >A[temp])         temp -> left             if (right = heap_length[A] and A[right] > A[temp])         temp->right             if temp!= i         swap(A[i],A[temp])         build(A,temp)
• A.

Build function of max heap

• B.

Build function of min heap

• C.

Build function of any heap

• D.

Search element in any heap

• 22.
State the complexity of the algorithm given below.         int function(vector<int> arr)         int len=arr.length();         if(len==0)         return;         temp=arr[len-1];         arr.pop_back();         return temp;
• A.

O(n)

• B.

O(logn)

• C.

O(1)

• D.

O(n logn)

• 23.
An array consists of n elements. We want to create a heap using the elements. The time complexity of building a heap will be in the order of
• A.

O(n*n*logn)

• B.

O(n*logn)

• C.

O(n*n)

• D.

O(n *logn *logn)

• 24.
If we implement heap as a maximum heap, adding a new node of value 15 into it. What value will be at leaf nodes of the left subtree of the heap?
• A.

2

• B.

7

• C.

3

• D.

15

• 25.
What will be the position of 65 when a max heap is constructed on the input elements 5, 70, 45, 7, 12, 15, 13, 65, 30, 25?
• A.

Root

• B.

Last level

• C.

Second level

• D.

Anywhere in heap

## Related Topics Back to top
×

Wait!
Here's an interesting quiz for you.