Practise 34 Data Structures and Algorithms questions asked in UGC NET Computer Science from 2020–2025. Questions cover Arrays, Trees, Graphs, Hashing, Sorting and searching algorithms with complexity analysis and Asymptotic notation and solving recurrence relations. Every question is shown with its options and the correct answer, free to read.
Practise Data Structures and Algorithms as timed sets
Focused 10-question sets with instant scoring, explanations, and weak-area analysis.
Ordered newest exam first. Each question links back to the full paper it came from.
Which of the following uses only increment operations for adding and removing elements at either end?
Answer: (D) Deques
Explanation
Match List-I with List-II.
| List-I | List-II |
|---|---|
| A. Breadth-first search B. Depth-first search C. Prefix D. Infix | I. LISP II. Syntax tree III. Stack IV. Queue |
Answer: (D) A-IV, B-III, C-I, D-II
Explanation
Which descriptions are true?
A. Red-black tree guarantees O(log n) worst-case search, insertion and deletion.
B. Trie supports efficient prefix-based searches.
C. AVL tree is a self-balancing binary search tree with stricter balance criteria.
D. B-tree supports efficient disk-based search, insertion and deletion.
Answer: (D) A, B and D only
Explanation
Which of the following is not a divide-and-conquer method?
Answer: (D) Heap sort
Explanation
Match List-I with List-II.
| List-I | List-II |
|---|---|
| A. Insertion sort B. Binary search C. Quick sort D. Selection sort | I. O(log n) II. O(n²) III. O(n−1) IV. O(n log n) |
Answer: (A) A-III, B-I, C-IV, D-II
Explanation
Considering the binary tree shown, what will be the inorder traversal?
| Node | Left child | Right child |
|---|---|---|
| A | B | C |
| C | D | E |
| E | — | F |
| F | G | H |
Answer: (A) B A D C E G F H
Explanation
Which of the following is the solution of the recurrence relation T(n) = T(2n/3) + 1?
Answer: (B) Θ(log n)
Explanation
Arrange the steps of inorder traversal of a binary tree.
A. Visit the left subtree.
B. Visit the root node.
C. Visit the right subtree.
D. Start traversing by visiting nodes in the rooted tree.
E. Repeat the above three steps.
Answer: (C) D, A, B, C, E
Explanation
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 algorithm
E. Dynamic programming
Answer: (D) A and C only
Explanation
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:
Answer: (B) (A), (E), (D), (B), (C)
Explanation
Match List-I with List-II.
| List-I (Algorithms) | List-II (Characteristics) |
|---|---|
| (A) First Come First Served (FCFS) | (I) Each process is assigned a priority. |
| (B) Shortest Job First (SJF) | (II) Ensures fair allocation of CPU time by assigning time slice. |
| (C) Round Robin (RR) | (III) Processes are executed in the order they arrive. |
| (D) Priority Scheduling | (IV) Select the process for execution with smallest next Burst time. |
Answer: (C) (A)-(III), (B)-(IV), (C)-(II), (D)-(I)
Explanation
Select the Sorting Algorithms that are stable.
A. Quick Sort
B. Bubble Sort
C. Insertion Sort
D. Merge Sort
E. Shell Sort
Answer: (D) (B), (C) and (D) Only
Explanation
___________is a Self Balancing binary search
tree, where the path from the root to the furthest
leaf is no more than twice as long as the path
from the root to nearest leaf.
Answer: (C) Red-Black tree
Explanation
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 (0) 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 0
C. Identify subproblems and their dependencies
based on items 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
Answer: (C) (A), (C), (D), (E), (B)
Explanation
Which of the following is not a palindromic subsequence of the string "ababcdabba" ?
Answer: (D) adba
Explanation
Which of the following is TRUE ?
Answer: (A) The cost of searching an AVL tree is @ (log n) but that of binary search is 0(n)
Explanation
What is the result of evaluating the postfix expression "4325+b—" ?
Answer: (A) 8
Explanation
Which data structure is typically used to implement hash table ?
Answer: (B) Array
Explanation
Which collision resolution technique involves maintaining a linked list of collided keys ?
Answer: (C) Chaining
Explanation
Consider the following functions : f(n) = anv g(n) = 2" log? h(n) =n! Which of the following is true ?
Answer: (D) £(m) is 0 (g(m))
Explanation
2-3-4 trees are B - trees of order 4. They are isometric of trees.
Answer: (D) Red-Black
Explanation
Which of the following graphs are trees ? bs b @ d
A. e f a b c d
B. e f a b é d (9) e f a b c d
D. e f Choose the correct answer from the options given below :
Answer: (A) (A) and (B) Only
Explanation
Arrange the following steps in the correct sequence for applying an unsupervised learning technique such as K-means clustering is to a data set :
A. Randomly initialize cluster centroids
B. Assign each data point to nearest cluster centroid
C. Update the cluster centroids based on the mean of data points assigned to each cluster
D. Specify the number of clusters (K) to partation the data into
E. Repeat steps B and C until convergence criteria are met Choose the correct answer from the options given below : @) (©),
A. , ©, ©
Answer: (A) D, A, B, C, E
Explanation
Consider the pseudocode with integers a and b, where a > 1 and a < b:
int x = 0; int p = 1;
while (p < b) { p = p * a; x = x + 1; }
When the loop terminates, what is x in terms of a and b?
Answer: (B) ⌈logₐ b⌉
Explanation
A complete n-ary tree has either n children or no children at each node. If it has I = 10 internal nodes and L = 41 leaves, what is n?
Answer: (C) 5
Explanation
In a binary max heap containing n numbers, the smallest element can be found in what time?
Answer: (A) O(n)
Explanation
Algorithm A takes log₂(n) microseconds and algorithm B takes √n microseconds. What are the largest problem sizes they can solve in one second?
Answer: (B) 2¹⁰⁰⁰⁰⁰⁰ and 10¹²
Explanation
Let G be a directed graph on vertices 1 through 100. There is an edge i → j exactly when j = i + 1 or j = 3i. What is the minimum number of edges in a path from 1 to 100?
Answer: (D) 7
Explanation
The running time of an algorithm is O(g(n)) if and only if
Answer: (A) its worst-case running time is O(g(n)) and its best-case running time is Ω(g(n)).
Explanation
Which statements are incorrect?
A. Every tree is 2-colourable.
B. A bipartite graph has no even-length cycles.
C. A graph is 2-colourable if it is bipartite.
D. A graph of maximum degree d can be coloured with d + 1 colours.
E. A graph with O(|V|) edges can be coloured with O(log |V|) colours.
Answer: (C) (B) and (E)
Explanation
Match List I with List IT
A. B. C. D. List I
Topological sort of DAG
Kruskal's MST algorithm
Bellman-Ford's single-source shortest
path algorithm
Floyd-Warshall's all-pair shortest
path algorithm
List II
@M owv+e)
(d) O(VvE)
dl) av +B)
av) av?)
| List I | List II |
|---|---|
| Items are listed in the question stem. | Match each item to its stated description or complexity. |
Answer: (A) OCR review required
Explanation
Find the lexicographic ordering of the bit strings given below based on the ordering 0 < 1.
A. 001
B. 010
(Cc) O11
D. 0001
E. 0101
Answer: (B) OCR review required
Explanation
Consider the undirected graph below:
Using Prim's algorithm to construct a minimum spanning tree starting with node a. which
one of the following sequences of edges represents a possible order in which the edges would
be added to construct the minimum spanning tree?
() (a.b). (a.h). (g.h). (fg). (c.f). (c.i), (¢.d). (de)
Answer: (A) OCR review required
Explanation
Let G be a simple undirected graph, Tp be a DFS tree on G. and T, be the BFS tree on G,
Consider the following statements.
Statement I: No edge of Gis a cross with respect to Tp
Statement II: For every edge (u,v) of G. if u is at depth i and v is at depth jin T; then
li-—jl=1.
In the light of the above statements, choose the correct answer from the options given below
Answer: (C) Statement I is correct but Statement II is false
Explanation
34 Data Structures and Algorithms questions appear in the UGC NET Computer Science papers held between 2020–2025, and all of them are on this page with their answer key.
Yes. Every question, its options, and the correct answer are free to read with no account. Signing in additionally unlocks the detailed explanation under each question.
Data Structures and Algorithms appears in every recent UGC NET Computer Science paper, across all 4 sittings covered here. Its share of the paper makes it worth revising thoroughly rather than sampling.
Attempt the Data Structures and Algorithms topic-wise sets, which put the same questions into a timed interface with instant scoring and weak-area analysis afterwards.
Ready for a full paper?
Attempt Paper 1 + Paper 2 (Computer Science) together in a single timed session.