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

Data Structures and Algorithms – Previous Year Questions

215 questions from past UGC NET Paper 2 – Computer Science papers, each with the correct answer. Open any question for its explanation.

  1. Match List - I with List - II. List - I List - II A. Merge sort I. n² B. Binary search II. nlogn C. Quick sort III. n D. Search in an unsorted array IV. logn Choose the correct answer from the options given below:
    Answer: D. A-II, B-IV, C-I, D-III Paper 2 CS · 22 June 2026
  2. 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 follow…
    Answer: C. 3 Paper 2 CS · 22 June 2026
  3. In the worst case, the smallest number of comparisons required by any sorting algorithm, which does only binary comparisons, is
    Answer: B. ⌈log n!⌉ Paper 2 CS · 22 June 2026
  4. 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?
    Answer: B. 3.16×10⁴ Paper 2 CS · 22 June 2026
  5. If f(n) = θ(g(n)) and g(n) = O(h(n)), then which of the following is true?
    Answer: A. f(n) = O(h(n)) Paper 2 CS · 22 June 2026
  6. The number of leaf nodes in a full 4-ary rooted tree of n nodes is
    Answer: D. (3n + 1) / 4 Paper 2 CS · 22 June 2026
  7. Which of the following statements maybe false for a decision problem X ∈ NP?
    Answer: D. X can be solved in deterministic polynomial time Paper 2 CS · 22 June 2026
  8. 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 th…
    Answer: C. A, D, B, C Paper 2 CS · 22 June 2026
  9. In open addressing, how are collisions typically resolved?
    Answer: A. By probing and finding the next available slot in the table Paper 2 CS · 22 June 2026
  10. 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
    Answer: B. 3 Paper 2 CS · 22 June 2026
  11. Match the LIST-I with LIST-II. LIST-I (Data structure) LIST-II (Characteristics) A. Stack I. First-In-First-Out (FIFO) order B. Queue II. Last-In-First-Out (LIFO) order C. Linked list III. Nodes with two children ordere…
    Answer: B. A-II, B-I, C-IV, D-III Paper 2 CS · 22 June 2026
  12. 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 a…
    Answer: B. After insertion the heap is re-arranged so that 10's children become 32 and 30,… Paper 2 CS · 22 June 2026
  13. Consider the infix expression Q : ((A + B) ∗ D) ↑ (E − F). The equivalent postfix expression of Q is
    Answer: D. AB + D ∗ EF − ↑ Paper 2 CS · June 2025
  14. 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:
    Answer: D. B, C and D Only Paper 2 CS · June 2025
  15. 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:
    Answer: B. A, B and C Only Paper 2 CS · June 2025
  16. The longest common subsequence of {1,2,3,2,4,1,2} and {2,4,3,1,2,1} is
    Answer: C. 2,3,2,1 Paper 2 CS · June 2025
  17. Match List I (Hashing Collision Handling Method) with List II (Strategy)List I List II A. Chaining I. Check next slot B. Linear Probing II. Use the second hash function C. Quadratic Probing III. Linked list at index D.…
    Answer: C. A-III, B-I, C-IV, D-II Paper 2 CS · June 2025
  18. Maintaining a graph in memory by means of its adjacency matrix is known as
    Answer: D. Sequential Representation Paper 2 CS · June 2025
  19. Match List I with List IIList I List II A. Circular Queue I. Print Queue B. Priority Queue II. CPU Scheduling C. Double Ended Queue III. Dijkstra algorithm D. Simple Queue IV. Palindrome checking
    Answer: B. A-II, B-III, C-IV, D-I Paper 2 CS · June 2025
  20. The tight asymptotic bound for the recurrence T(n) = 2T(n/4) + √n is
    Answer: C. Θ(√n log n) Paper 2 CS · June 2025
  21. 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…
    Answer: D. C, B, D, A Paper 2 CS · June 2025
  22. 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:
    Answer: C. B, C, D, A Paper 2 CS · June 2025
  23. 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-compl…
    Answer: D. A, B, C, D Paper 2 CS · December 2024
  24. 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?
    Answer: A. BADCEGFH Paper 2 CS · December 2024
  25. Which of the following uses only increment operations for adding and removing elements at either end?
    Answer: D. Deques Paper 2 CS · December 2024
  26. Match List I with List IIList I List II A. Breadth First Search I. LISP B. Depth First Search II. Syntax tree C. Prefix III. Stack D. Infix IV. Queue
    Answer: D. A-IV, B-III, C-I, D-II Paper 2 CS · December 2024
  27. Which of the following is NOT a divide and conquer method?
    Answer: D. Heap Sort Paper 2 CS · December 2024
  28. Arrange the following steps of the inorder traversal of a binary tree in the correct order. A. Visit the left subtree B. Visit the root node C. Visit the right subtree D. Start traversing by visiting the nodes in the ro…
    Answer: C. D, A, B, C, E Paper 2 CS · December 2024
  29. Which of the following algorithms are based on Breadth First Search (BFS)? A. Prim's algorithm B. Kruskal's algorithm C. Dijkstra's algorithm D. Greedy algorithms E. Dynamic Programming Choose the correct answer from th…
    Answer: D. A & C only Paper 2 CS · December 2024
  30. Which of the following is the solution of the recurrence relation T(n) = T(2n/3) + 1?
    Answer: B. Θ(log n) Paper 2 CS · December 2024