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

Data Structures and Algorithms — Mock Test 1

25 questions · about 30 minutes. Press End Mock any time to see your score and the correct answers.

0 / 25 answered 00:00
Q1. Match List - I with List - II.
List - IList - II
A. Merge sortI. n²
B. Binary searchII. nlogn
C. Quick sortIII. n
D. Search in an unsorted arrayIV. logn
Choose the correct answer from the options given below:
Q2. Consider the following AVL tree: root = 60; left child of 60 = 50; right child of 60 = 70; right child of 70 = 80 (a balanced AVL tree of height 2).
What is the maximum number of nodes that can be inserted in the following AVL tree without changing its height?
Q3. In the worst case, the smallest number of comparisons required by any sorting algorithm, which does only binary comparisons, is
Q4. A problem of size n requires n² bit operations. What is the largest size instance that can be solved in 1 second, if each bit operation is carried out in 10⁻⁹ second?
Q5. If f(n) = θ(g(n)) and g(n) = O(h(n)), then which of the following is true?
Q6. The number of leaf nodes in a full 4-ary rooted tree of n nodes is
Q7. Which of the following statements maybe false for a decision problem X ∈ NP?
Q8. A binary search tree is obtained by inserting the words "Mathematics", "Physics", "Geography", "Zoology", "Metrology", "Geology", "Psychology" and "Chemistry" in order. Words are compared by dictionary order. Arrange the following words in increasing order of their level in the tree.
A. Mathematics
B. Zoology
C. Psychology
D. Physics
Choose the correct answer from the options given below:
Q9. In open addressing, how are collisions typically resolved?
Q10. What is the height of the binary search tree obtained by inserting the numbers 40, 60, 50, 37, 52, 15, 8, 22 in the given order
Q11. Match the LIST-I with LIST-II.
LIST-I (Data structure)LIST-II (Characteristics)
A. StackI. First-In-First-Out (FIFO) order
B. QueueII. Last-In-First-Out (LIFO) order
C. Linked listIII. Nodes with two children ordered
D. Binary search treeIV. Dynamic size, nodes linked sequentially
Choose the correct answer from the options given below:
Q12. How will the following min-heap appear on inserting the key 32?
Original min-heap (level order): 5, 10, 25, 30, 40, 50, 60, 70, 80, 90 (root 5; children of 5 are 10 and 25; children of 10 are 30 and 40; children of 25 are 50 and 60; children of 30 are 70 and 80; the only child of 40 is 90).
Q13. Consider the infix expression Q : ((A + B) ∗ D) ↑ (E − F). The equivalent postfix expression of Q is
Q14. Which of the following trees are height balanced?
A. Binary Search Tree
B. AVL Tree
C. Red-Black Tree
D. B Tree
Choose the correct answer from the options given below:
Q15. Which of the following algorithms use the Greedy strategy?
A. Dijkstra's algorithm
B. Kruskal's algorithm
C. Huffman coding
D. Bellman-Ford algorithm
Choose the correct answer from the options given below:
Q16. The longest common subsequence of {1,2,3,2,4,1,2} and {2,4,3,1,2,1} is
Q17. Match List I (Hashing Collision Handling Method) with List II (Strategy)
List IList II
A. ChainingI. Check next slot
B. Linear ProbingII. Use the second hash function
C. Quadratic ProbingIII. Linked list at index
D. Double HashingIV. Skip slots using quadratic step
Q18. Maintaining a graph in memory by means of its adjacency matrix is known as
Q19. Match List I with List II
List IList II
A. Circular QueueI. Print Queue
B. Priority QueueII. CPU Scheduling
C. Double Ended QueueIII. Dijkstra algorithm
D. Simple QueueIV. Palindrome checking
Q20. The tight asymptotic bound for the recurrence T(n) = 2T(n/4) + √n is
Q21. When developing a dynamic programming algorithm, the sequence of steps followed is:
A. Construct an optimal solution from computed information.
B. Recursively define the value of an optimal solution.
C. Characterize the structure of an optimal solution.
D. Compute the value of an optimal solution, typically in a bottom-up fashion.
Choose the correct answer from the options given below:
Q22. The correct sequence of constructing a Huffman tree is
A. Repeat until root formed
B. Create leaf nodes
C. Build priority queue
D. Combine lowest frequency nodes
Choose the correct answer from the options given below:
Q23. Choose the correct statement(s)
A. A problem which is NP-Complete will have the property that it can be solved in polynomial time iff all other NP-complete problems can also be solved in polynomial time.
B. All NP-complete problems are NP-hard problems.
C. If an NP-hard problem can be solved in polynomial time, then all NP-complete problems can be solved in polynomial time.
D. All NP-hard problems are not NP-complete.
Choose the correct answer from the options given below:
Q24. Consider the binary tree: A is the root with left child B and right child C; C has left child D and right child E; E has right child F; F has left child G and right child H. What will be the inorder traversal?
Q25. Which of the following uses only increment operations for adding and removing elements at either end?