All mock tests are FREE till 31 December — register to save your progress
UGC NET · PAPER 2

UGC NET Paper 2 Computer Science – Unit 7: Data Structures and Algorithms PYQ (June 2024 Re-Exam)

6 questions · answer key at the end · updated 11 Oct 2026
Q30. Arrange the following recurrence relations in increasing order of their time complexity:
(A) T(n) = T(n/2) + 1
(B) T(n) = 2T(n/2) + n
(C) T(n) = 3T(n/3) + n
(D) T(n) = 2T(n/2) + √n
(E) T(n) = T(n−1) + 1
Choose the correct answer from the options given below:
  1. (E), (A), (B), (D), (C)
  2. (A), (E), (D), (B), (C)
  3. (E), (A), (D), (B), (C)
  4. (A), (B), (D), (E), (C)
Answer & explanation →
Q59. Select the sorting algorithms that are stable.
(A) Quick Sort
(B) Bubble Sort
(C) Insertion Sort
(D) Merge Sort
(E) Shell Sort
Choose the correct answer from the options given below:
  1. (A), (B), (C) and (E) Only
  2. (A), (D) and (E) Only
  3. (B) and (C) Only
  4. (B), (C) and (D) Only
Answer & explanation →
Q60. ______ is a self-balancing binary search tree where the path from the root to the farthest leaf is no more than twice as long as the path from the root to the nearest leaf.
  1. Expression tree
  2. Game tree
  3. Red-Black tree
  4. Threaded tree
Answer & explanation →
Q74. Match List I with List II
List IList II
(A) Dijkstra's Algorithm(I) Finds the shortest path between all pairs of vertices in a graph with positive or negative edge weights.
(B) Floyd-Warshall Algorithm(II) Finds the shortest path in a weighted graph with non-negative edge weights.
(C) Bellman-Ford Algorithm(III) Finds single-source shortest paths with possible negative weights.
(D) Prim's Algorithm(IV) Finds the Minimum Spanning Tree (MST).
  1. (A)-(I), (B)-(II), (C)-(III), (D)-(IV)
  2. (A)-(II), (B)-(I), (C)-(III), (D)-(IV)
  3. (A)-(I), (B)-(II), (C)-(IV), (D)-(III)
  4. (A)-(III), (B)-(II), (C)-(IV), (D)-(I)
Answer & explanation →
Q83. Arrange the following steps in the correct order to solve the Knapsack problem using Dynamic Programming.
(A) Define the base case when the capacity is zero or no items are left to consider
(B) Compute the maximum value that can be obtained using items up to the i-th item and a knapsack capacity of W
(C) Identify subproblems and their dependencies based on item weights and values
(D) Initialize a table to store results of subproblems
(E) Iterate through each item and each possible capacity to fill the table
Choose the correct answer from the options given below:
  1. (C), (D), (A), (E), (B)
  2. (D), (C), (A), (E), (B)
  3. (A), (C), (D), (E), (B)
  4. (D), (A), (C), (E), (B)
Answer & explanation →
Q86. Match List I (Recurrence Relation) with List II (Complexity)
List IList II
(A) T(n) = 2T(n/2) + n(I) T(n) = Θ(n log n) {exact solution}
(B) T(n) = T(n/2) + 1(II) O(n²)
(C) T(n) = 2T(n/2) + 1(III) T(n) = Θ(n) {exact solution}
(D) T(n) = T(n−1) + n(IV) O(n)
  1. (A)-(I), (B)-(IV), (C)-(III), (D)-(II)
  2. (A)-(IV), (B)-(II), (C)-(I), (D)-(III)
  3. (A)-(I), (B)-(III), (C)-(IV), (D)-(II)
  4. (A)-(III), (B)-(I), (C)-(IV), (D)-(II)
Answer & explanation →

Answer key

  1. 30 – B
  2. 59 – D
  3. 60 – C
  4. 74 – B
  5. 83 – C
  6. 86 – A