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 2023)

11 questions · answer key at the end · updated 11 Oct 2026
Q2. Consider the following statements about the heap sort algorithm:
A. The MAX-HEAPIFY procedure, which runs in O(lg n) time, is the key to maintaining the max-heap property.
B. The BUILD-MAX-HEAP procedure, which runs in O(lg n) time, produces a max-heap from an unordered input array.
C. The MAX-HEAP-INSERT procedure, which runs in O(lg n) time, implements the insertion operation.
D. The HEAP-INCREASE-KEY procedure runs in O(n lg n) time to set the key of a new node to its correct value.
Choose the correct answer from the options given below:
  1. A, B only
  2. A, C only
  3. B, D only
  4. A, B, C, D
Answer & explanation →
Q10. Match List I with List II
List IList II
A. Parallel FFTI. Θ(n²)
B. Iterative FFTII. Θ(n)
C. Evaluation of polynomial at n points by Horner methodIII. Θ(lg n)
D. Product of two polynomials represented in point-value formIV. Θ(n lg n)
  1. A-III, B-I, C-II, D-III
  2. A-II, B-I, C-III, D-IV
  3. A-III, B-IV, C-I, D-II
  4. A-II, B-III, C-IV, D-I
Answer & explanation →
Q12. Let f(n) and g(n) be asymptotically positive functions.
Statement I: f(n) ≥ 1 and f(n) = O(g(n)) ⇒ g(n) = Ω(f(n)).
Statement II: f(n) = O(g(n)) ⇒ lg(f(n)) = O(lg(g(n))), where lg(g(n)) ≥ 1 and f(n) ≥ 1 for all sufficiently large n.
  1. Both Statement I and Statement II are correct
  2. Both Statement I and Statement II are incorrect
  3. Statement I is correct but Statement II is incorrect
  4. Statement I is incorrect but Statement II is correct
Answer & explanation →
Q16. Consider the following statements:
A. If some NP-complete problem is in P, then P = NP.
B. TSP is in NP.
C. SAT is in NP.
D. The Hamiltonian circuit problem is not NP-complete.
Choose the correct answer from the options given below:
  1. A, B and C only
  2. B, C and D only
  3. C, D and A only
  4. D, A and B only
Answer & explanation →
Q17. A B-tree used as an index for a large database table has four levels including the root node. If a new key is inserted into this index, the maximum number of nodes that could be newly created in the process is
  1. 5
  2. 4
  3. 3
  4. 2
Answer & explanation →
Q18. Suppose a circular queue of capacity n − 1 elements is implemented with an array of n elements. Insertion and deletion use REAR and FRONT as array index variables respectively. Initially REAR = FRONT = 0. The conditions to detect queue empty and queue full are
  1. EMPTY: REAR == FRONT; FULL: (REAR + 1) mod n == FRONT
  2. EMPTY: (FRONT + 1) mod n == REAR; FULL: (REAR + 1) mod n == FRONT
  3. EMPTY: (REAR + 1) mod n == FRONT; FULL: REAR == FRONT
  4. EMPTY: REAR == FRONT; FULL: (FRONT + 1) mod n == REAR
Answer & explanation →
Q21. Given below are two statements: one is labelled as Assertion A and the other is labelled as Reason R.
Assertion A: AVL trees are more balanced than red-black trees, but they may cause more rotations during insertion and deletion.
Reason R: A red-black tree with n nodes has height greater than 2 log₂(n + 1), and an AVL tree with n nodes has height less than log_φ(√5 (n + 2)) − 2 (where φ is the golden ratio).
  1. Both A and R are true and R is the correct explanation of A
  2. Both A and R are true but R is NOT the correct explanation of A
  3. A is true but R is false
  4. A is false but R is true
Answer & explanation →
Q44. Consider a hash table of size 7 with starting index 0 and hash function (6x + 3) mod 4. Assuming the table is initially empty, which of the following is the content of the table when the sequence 1, 3, 8, 10, 5 is inserted using closed hashing (linear probing)? Here '_' denotes an empty location.
  1. 1, 3, 8, 10, 5, _, _
  2. 3, 8, 1, _, 10, _, 5
  3. _, 3, 8, 1, _, 10, 5
  4. _, 1, 3, 8, 10, 5, _
Answer & explanation →
Q85. Match List I with List II
List IList II
A. Running time of a straightforward recursive method to compute the nth Fibonacci number FₙI. O(n²)
B. Running time to compute Fₙ using memoizationII. O(log n)
C. Running time to compute Fₙ using only integer addition and multiplicationIII. O(n)
D. Running time to determine an optimal bitonic tourIV. Θ(φⁿ)
  1. A-I, B-III, C-IV, D-II
  2. A-IV, B-III, C-II, D-I
  3. A-I, B-II, C-IV, D-III
  4. A-IV, B-II, C-III, D-I
Answer & explanation →
Q86. Statement I: If f and g are two functions and f = O(g) but g ≠ o(f), we say that the growth rate of g is smaller than that of f.
Statement II: The class of all decision problems decided by a TM in exponential time is O(2ᵏ), k being a constant.
  1. Both Statement I and Statement II are correct
  2. Both Statement I and Statement II are incorrect
  3. Statement I is correct but Statement II is incorrect
  4. Statement I is incorrect but Statement II is correct
Answer & explanation →
Q89. Given below are two statements: one is labelled as Assertion A and the other is labelled as Reason R.
Assertion A: It is possible to create a doubly linked list using only one pointer field in every node.
Reason R: By storing the XOR of the addresses of the previous and next nodes.
  1. Both A and R are true and R is the correct explanation of A
  2. Both A and R are true but R is NOT the correct explanation of A
  3. A is true but R is false
  4. A is false but R is true
Answer & explanation →

Answer key

  1. 2 – B
  2. 10 – C
  3. 12 – A
  4. 16 – A
  5. 17 – A
  6. 18 – A
  7. 21 – C
  8. 44 – D
  9. 85 – B
  10. 86 – B
  11. 89 – A