All mock tests are FREE till 31 December — register to save your progress
Paper 2 CS · UNIT 07 · MOCK TEST

Mock 3 – Trees, Heaps & Hashing (Part 2)

Unit 7: Data Structures and Algorithms · 21 questions · about 25 minutes. Press End Mock any time to see your score and the correct answers.

All 11 topic-wise mocks in this unit
0 / 21 answered 00:00
Q1. Which of the following are true for a complete (full) binary tree?
A. It always has an odd number of vertices.
B. With i internal vertices, it has i + 1 leaves.
C. With l leaves, it has 2l − 1 vertices.
D. With 2n − 1 vertices, it has n leaves.
Choose the correct answer from the options given below:
Q2. In a ______ the left and right subtrees of some node differ in height by more than one.
Q3. Given six weights 4, 15, 25, 5, 8, 16, construct a 2-tree (extended binary tree) with minimum weighted path length. What is the minimum weighted path length?
Q4. Suppose we store n keys in a hash table of size m = n² using a hash function h chosen randomly from a universal class of hash functions. Then the probability that there are any collisions is ______
Q5. Which of the following rotations are correctly explained in the context of an AVL tree?
A. LL rotation: the new node is inserted in the left subtree of the left subtree of the critical node.
B. RR rotation: the new node is inserted in the right subtree of the right subtree of the critical node.
C. LR rotation: the new node is inserted in the right subtree of the left subtree of the critical node.
D. RL rotation: the new node is inserted in the left subtree of the right subtree of the critical node.
Choose the correct answer from the options given below:
Q6. Match List I with List II
List IList II
A. Linear ProgramI. Prim's Algorithm
B. Predicate LogicII. In order
C. Tree TraversalIII. Simplex Algorithm
D. Minimum Spanning Tree ProblemIV. First order logic
Q7. How many different binary trees are possible with n nodes?
Q8. The number of nodes of height h in any n-element heap is at most
Q9. Consider a B-tree of height h and minimum degree t ≥ 2 that contains n keys, n ≥ 1. Which of the following is correct?
Q10. Consider a hash table of size 11 that uses open addressing with linear probing, with h(k) = k mod 11. Records with keys 43, 36, 92, 87, 11, 47, 11, 13, 14 are inserted into an initially empty table with bins 0–10. What is the index of the bin into which the last record is inserted?
Q11. Consider the traversals of a tree:
Preorder → ABCEIFJDGHKL
Inorder → EICFJBGDKHLA
Which of the following is the correct postorder traversal?
Q12. How many rotations are required during the construction of an AVL tree if the following elements are inserted in the given sequence?
35, 50, 40, 25, 30, 60, 78, 20, 28
Q13.

Which of the following trees are height balanced?

A. Binary Search Tree

B. AVL Tree

C. Red-Black Tree

D. B Tree

Q14.

Match List I with List II

Figure
Q15.

Considering the binary tree shown (A has children B and C; C has children D and E; E has right child F; F has children G and H), what will be the inorder traversal?

Figure
Q16.

The height of a binary search tree for the words banana, peach, apple, pear, coconut, mango and papaya using alphabetical order is :

Q17.

Which of the following are true for a complete binary tree?

A. It has always odd number of vertices.

B. With i internal vertices, it has i+1 leaves.

C. With l leaves, it has 2l-1 vertices.

D. With 2 n-1 vertices, it has n leaves.

Q18.

Which of the following is TRUE?

Q19.

2-3-4 trees are B - trees of order 4. They are isometric of trees.

Q20.

Given below are two statements: one is labelled as Assertion A and the other is labelled as

Reason R.

Assertion A: The AVL trees are more balanced as compared to Red Black trees, but they may cause more rotations during insertion and deletion

Reason R: A Red Black tree with n nodes has 2 log (n + 1) height that is greater than 2 and the AVL tree with n nodes has height less than – log (√5(n + 2)) − 2( Φ Φ where is golden ratio) In the light of the above statements, choose the correct answer from the options given below.

Q21.

Consider a hash table of size seven with starting (6x + 3) mod 4 index zero and a hash function . Assuming the hash table is initially empty. Which of the following is the content of the table when 1, 3, 8, 10, 5 the sequence , is inserted into the table using closed hashing? Here "__ " denotes an empty location in the table.