Aspire's Library

A Place for Latest Exam wise Questions, Videos, Previous Year Papers,
Study Stuff for MCA Examinations

UGC NET Computer Science Previous Year Questions (PYQs)

UGC NET Computer Science Data Structures PYQ


UGC NET Computer Science PYQ
Maintaining a graph in memory by means of its adjacency matrix is known as





Go to Discussion

UGC NET Computer Science UGC NET PYQ UGC NET Computer Science UGC NET Computer Science 26 June 2025 (Paper II) PYQ

Solution

  • An adjacency matrix represents a graph using a 2D array (matrix).
  • This type of storage uses sequential memory allocation — rows and columns are stored in contiguous memory.
  • Hence, this method is called a Sequential Representation of a graph.

UGC NET Computer Science PYQ
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 below:

  1. A and D only
  2. A, B and D only
  3. C and D only
  4. B and C only





Go to Discussion

UGC NET Computer Science UGC NET PYQ UGC NET Computer Science UGC NET Computer Science 26 June 2025 (Paper II) PYQ

Solution

Answer: 4) B and C only

  • Binary Search Tree (BST): Not necessarily balanced; height can degrade to O(n).
  • AVL Tree: Height-balanced by definition (balance factor −1, 0, +1); height is O(log n).
  • Red-Black Tree: Enforces black-height properties that keep height O(log n); treated as a height-balanced binary tree.
  • B-Tree: Balanced (all leaves at the same level) but not a binary tree; the term “height-balanced tree” typically refers to binary trees. Hence excluded here.

UGC NET Computer Science PYQ

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:

  1. B, C, A, D
  2. B, A, C, D
  3. C, B, A, D
  4. C, B, D, A





Go to Discussion

UGC NET Computer Science UGC NET PYQ UGC NET Computer Science UGC NET Computer Science 26 June 2025 (Paper II) PYQ

Solution

Answer: (4) C, B, D, A

Explanation:
The standard steps for designing a dynamic programming algorithm are:

  1. (C) Characterize the structure of an optimal solution.
  2. (B) Recursively define the value of an optimal solution.
  3. (D) Compute the value of an optimal solution (usually bottom-up).
  4. (A) Construct the optimal solution from the computed information.

Hence, the correct order is C → B → D → A.


UGC NET Computer Science PYQ
The correct sequence of constructing 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:





Go to Discussion

UGC NET Computer Science UGC NET PYQ UGC NET Computer Science UGC NET Computer Science 26 June 2025 (Paper II) PYQ

Solution

Create leaf nodes (B) for each character with their frequency. Build a priority queue (C) (min-heap) based on frequency. Combine lowest frequency nodes (D) repeatedly to form new internal nodes. Repeat until root formed (A) — the final remaining node is the root of the Huffman tree. Hence, the correct order is B → C → D → A.

UGC NET Computer Science PYQ
The longest common subsequence of $\{1,2,3,2,4,1,2\}$ and $\{2,4,3,1,2,1\}$ is





Go to Discussion

UGC NET Computer Science UGC NET PYQ UGC NET Computer Science UGC NET Computer Science 26 June 2025 (Paper II) PYQ

Solution

Why: The LCS length for the two sequences is $4$. $2,3,2,1$ is a subsequence of both: $\{1,\underline{2},3,\underline{2},4,1,\underline{2}\}$ and $\{\underline{2},4,\underline{3},1,\underline{2},\underline{1}\}$. Option (4) has length $5$ (too long), and (1), (2) are not subsequences of both.


UGC NET Computer Science PYQ
List I List II
A. Circular Queue III. Dijkstra algorithm
B. Priority Queue II. CPU Scheduling
C. Double Ended Queue I. Print Queue
D. Simple Queue IV. Palindrome checking

Choose the correct answer from the options given below:






Go to Discussion

UGC NET Computer Science UGC NET PYQ UGC NET Computer Science UGC NET Computer Science 26 June 2025 (Paper II) PYQ

Solution



UGC NET Computer Science PYQ
Consider the following infix expression: Q = ((A + B) * D) ↑ (E − F) The equivalent postfix expression of Q is:





Go to Discussion

UGC NET Computer Science UGC NET PYQ UGC NET Computer Science UGC NET Computer Science 26 June 2025 (Paper II) PYQ

Solution

Step-by-step conversion:
Infix: ((A + B) * D) ↑ (E − F)
(A + B) → AB+
((A + B) * D) → AB+D*
(E − F) → EF−
Combine with ↑ → AB+D*EF−↑

UGC NET Computer Science PYQ
Match List I with List II
List I (Hashing Collision Handling Method)List II (Strategy)
A. ChainingI. Check next slot
B. Linear ProbingII. Use second hash function
C. Quadratic ProbingIII. Linked list at index
D. Double HashingIV. Skip slots using quadratic step





Go to Discussion

UGC NET Computer Science UGC NET PYQ UGC NET Computer Science UGC NET Computer Science 26 June 2025 (Paper II) PYQ

Solution

Chaining → Linked list at index (III)
Linear probing → Check next slot (I)
Quadratic probing → Skip slots using quadratic step (IV)
Double hashing → Use second hash function (II)

UGC NET Computer Science PYQ
Which of the following algorithms use the Greedy strategy?
A. Dijkstra’s algorithm
B. Kruskal’s algorithm
C. Huffman coding
D. Bellman-Ford algorithm





Go to Discussion

UGC NET Computer Science UGC NET PYQ UGC NET Computer Science UGC NET Computer Science 26 June 2025 (Paper II) PYQ

Solution

Dijkstra’s algorithm ✅ — Uses greedy approach to select the next minimum-distance vertex.
Kruskal’s algorithm ✅ — Uses greedy strategy to build Minimum Spanning Tree (MST).
Huffman coding ✅ — Greedy algorithm for constructing optimal prefix codes.
Bellman-Ford algorithm ❌ — Uses dynamic programming, not greedy.


UGC NET Computer Science


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

UGC NET Computer Science


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

Ask Your Question or Put Your Review.

loading...