Data Structure MCQs (201-300)
201. An AVL tree is a type of:
A) Self-balancing binary search tree
B) Complete binary tree
C) Threaded binary tree
D) None
Answer: A
202. The balance factor of an AVL tree node is calculated as:
A) Height(left) – Height(right)
B) Height(right) – Height(left)
C) Left nodes – Right nodes
D) None
Answer: A
203. In an AVL tree, the balance factor can be:
A) -1, 0, or +1
B) -2, 0, or +2
C) 0 only
D) None
Answer: A
204. A single rotation in AVL tree is used to:
A) Restore balance after insertion
B) Delete a node
C) Traverse nodes
D) None
Answer: A
205. Double rotation in AVL tree is required when:
A) Insertion causes imbalance in opposite subtree
B) Tree is empty
C) No rotation needed
D) None
Answer: A
206. Which of the following rotations fixes Left-Right imbalance in AVL tree?
A) Left rotation followed by right rotation
B) Right rotation followed by left rotation
C) Double right rotation
D) None
Answer: A
207. Which tree is used in database indexing?
A) B-Tree
B) Binary Tree
C) AVL Tree
D) None
Answer: A
208. A B-Tree of order m can have at most:
A) m children
B) m – 1 children
C) 2m children
D) None
Answer: A
209. A B-Tree of order m can have a maximum of how many keys?
A) m – 1
B) m
C) 2m
D) None
Answer: A
210. B-Trees are generally used in:
A) Databases and file systems
B) Graph traversal
C) Sorting algorithms
D) None
Answer: A
211. The minimum number of keys in a non-root B-Tree node is:
A) ⌈m/2⌉ – 1
B) ⌊m/2⌋
C) m
D) None
Answer: A
212. B+ Trees differ from B-Trees in that:
A) Data is stored only in leaf nodes
B) Data is stored in all nodes
C) Keys are not sorted
D) None
Answer: A
213. In B+ Trees, leaf nodes are linked to provide:
A) Sequential access
B) Random access
C) Direct hashing
D) None
Answer: A
214. The height of a B-Tree with n keys and order m is:
A) O(logₘ n)
B) O(n)
C) O(1)
D) None
Answer: A
215. The time complexity of search in B-Tree is:
A) O(log n)
B) O(n)
C) O(1)
D) None
Answer: A
216. A Red-Black Tree is a type of:
A) Self-balancing binary search tree
B) Binary heap
C) B-Tree
D) None
Answer: A
217. In a Red-Black Tree, the root node is always:
A) Black
B) Red
C) Any color
D) None
Answer: A
218. Every leaf in a Red-Black Tree is considered:
A) Black and NIL
B) Red and NIL
C) Null
D) None
Answer: A
219. The maximum height of a Red-Black Tree with n nodes is:
A) 2 log₂(n + 1)
B) n
C) log₂n
D) None
Answer: A
220. Red-Black Trees are used to maintain:
A) Logarithmic height after insertions/deletions
B) Constant height
C) Linear height
D) None
Answer: A
221. Which of the following is true about Trie data structures?
A) Used for storing strings efficiently
B) Used for sorting numbers
C) Used for matrix storage
D) None
Answer: A
222. Each node in a Trie represents:
A) A prefix of a string
B) A whole word
C) A sentence
D) None
Answer: A
223. The time complexity of inserting a word of length L into a Trie is:
A) O(L)
B) O(log L)
C) O(1)
D) None
Answer: A
224. Tries are commonly used for:
A) Auto-completion and spell checking
B) Sorting
C) Searching integers
D) None
Answer: A
225. In a Trie, if every node has only one child, it degenerates into a:
A) Linked List
B) Stack
C) Queue
D) None
Answer: A
226. Which of the following trees ensures O(log n) time for search, insert, and delete?
A) AVL Tree
B) Red-Black Tree
C) B-Tree
D) All of the above
Answer: D
227. Which traversal is used to print the contents of a BST in sorted order?
A) Inorder
B) Preorder
C) Postorder
D) Level order
Answer: A
228. In a Red-Black Tree, a red node cannot have:
A) A red child
B) A black child
C) Both children
D) None
Answer: A
229. Which data structure is used in implementing compilers for symbol tables?
A) Hash Table
B) Queue
C) Heap
D) None
Answer: A
230. Hash tables can achieve an average time complexity of:
A) O(1) for search and insertion
B) O(log n)
C) O(n)
D) None
Answer: A
231. Open addressing is a method of:
A) Collision resolution in hashing
B) Tree traversal
C) Searching
D) None
Answer: A
232. The height of a complete binary tree with n nodes is approximately:
A) log₂n
B) n
C) √n
D) None
Answer: A
233. The number of nodes at the last level of a complete binary tree is about:
A) n/2
B) log₂n
C) n²
D) None
Answer: A
234. In a binary heap, children of node at index i are at:
A) 2i and 2i + 1
B) i + 1 and i + 2
C) i/2 and i + 1
D) None
Answer: A
235. The parent of node at index i in a heap is at:
A) ⌊i/2⌋
B) i – 1
C) i + 1
D) None
Answer: A
236. A heap can be used to implement:
A) Priority Queue
B) Stack
C) Queue
D) None
Answer: A
237. Which algorithm uses heap data structure for efficient sorting?
A) Heap Sort
B) Merge Sort
C) Quick Sort
D) None
Answer: A
238. Heap insertion is done at:
A) The last position followed by heapify
B) Root position
C) Random node
D) None
Answer: A
239. The graph that can be drawn without crossing edges is called:
A) Planar graph
B) Bipartite graph
C) Directed graph
D) None
Answer: A
240. A bipartite graph can be colored using how many colors?
A) 2
B) 3
C) 4
D) None
Answer: A
241. A graph that has edges with directions is called:
A) Directed graph
B) Undirected graph
C) Mixed graph
D) None
Answer: A
242. The in-degree of a node in a directed graph is:
A) Number of incoming edges
B) Number of outgoing edges
C) Sum of both
D) None
Answer: A
243. The out-degree of a node in a directed graph is:
A) Number of outgoing edges
B) Number of incoming edges
C) Difference between both
D) None
Answer: A
244. The sum of in-degrees in a directed graph equals:
A) Number of edges
B) Twice the number of edges
C) Number of vertices
D) None
Answer: A
245. Adjacency lists are efficient for:
A) Sparse graphs
B) Dense graphs
C) Complete graphs
D) None
Answer: A
246. The time complexity for traversing all vertices in a graph using DFS is:
A) O(V + E)
B) O(V²)
C) O(E²)
D) None
Answer: A
247. The Bellman-Ford algorithm is used to find:
A) Shortest path allowing negative weights
B) Minimum spanning tree
C) Topological order
D) None
Answer: A
248. Floyd-Warshall algorithm finds:
A) All-pairs shortest path
B) Single-source shortest path
C) MST
D) None
Answer: A
249. Memory fragmentation occurs in:
A) Dynamic memory allocation
B) Static arrays
C) Stack memory
D) None
Answer: A
250. Garbage collection is used to:
A) Automatically free unused memory
B) Increase CPU usage
C) Store data
D) None
Answer: A
Data Structures MCQs – Set 6 (251–300)
251. Hashing is mainly used to:
A) Search elements in constant time
B) Sort elements
C) Traverse a list
D) Manage memory
Answer: A
252. Which of the following is not a collision resolution technique in hashing?
A) Chaining
B) Linear probing
C) Quadratic probing
D) Merge sorting
Answer: D
253. In linear probing, the next position is found by:
A) (h(key) + i) mod m
B) (h(key) × i) mod m
C) (h(key) – i) mod m
D) (h(key) / i) mod m
Answer: A
254. The primary disadvantage of open addressing is:
A) Clustering
B) Requires extra space
C) Slower than chaining
D) None
Answer: A
255. Chaining in hashing uses:
A) Linked lists
B) Arrays
C) Stacks
D) Queues
Answer: A
256. Load factor in hashing is defined as:
A) α = n/m
B) α = m/n
C) α = n × m
D) α = n + m
Answer: A
257. If a hash table has 10 slots and 7 elements, the load factor is:
A) 0.7
B) 1.0
C) 1.4
D) 0.3
Answer: A
258. Rehashing means:
A) Creating a larger hash table and re-inserting existing elements
B) Deleting hash table
C) Recomputing hash key only
D) None
Answer: A
259. Which hashing technique reduces clustering problems?
A) Double hashing
B) Linear probing
C) Quadratic probing
D) None
Answer: A
260. The best case time complexity for searching in hashing is:
A) O(1)
B) O(log n)
C) O(n)
D) O(n log n)
Answer: A
261. In a graph with V vertices and E edges, the adjacency matrix requires:
A) O(V²) space
B) O(V + E) space
C) O(E²) space
D) O(VE) space
Answer: A
262. The adjacency list representation of a graph requires:
A) O(V + E) space
B) O(V²) space
C) O(E²) space
D) None
Answer: A
263. BFS (Breadth-First Search) uses which data structure?
A) Queue
B) Stack
C) Heap
D) Array
Answer: A
264. DFS (Depth-First Search) uses which data structure?
A) Stack
B) Queue
C) Tree
D) None
Answer: A
265. Topological sorting applies to:
A) Directed acyclic graphs (DAGs)
B) Undirected graphs
C) Cyclic graphs
D) None
Answer: A
266. Which algorithm is used for finding minimum spanning tree?
A) Kruskal’s algorithm
B) Dijkstra’s algorithm
C) Floyd-Warshall algorithm
D) Bellman-Ford algorithm
Answer: A
267. Prim’s algorithm also finds:
A) Minimum spanning tree
B) Shortest path
C) Maximum flow
D) None
Answer: A
268. The time complexity of Kruskal’s algorithm is:
A) O(E log E)
B) O(V²)
C) O(E²)
D) None
Answer: A
269. Dijkstra’s algorithm cannot handle:
A) Negative edge weights
B) Positive edge weights
C) Directed edges
D) Weighted graphs
Answer: A
270. A spanning tree of a graph with V vertices has:
A) V – 1 edges
B) V edges
C) E – 1 edges
D) None
Answer: A
271. The base condition in recursion is used to:
A) Terminate the recursion
B) Increase recursion depth
C) Repeat function infinitely
D) None
Answer: A
272. Every recursive function can be converted to:
A) An iterative function
B) A random function
C) A stack
D) None
Answer: A
273. The data structure used to implement recursion is:
A) Stack
B) Queue
C) Tree
D) None
Answer: A
274. Tail recursion occurs when:
A) Recursive call is the last statement in function
B) Recursive call occurs in the middle
C) Recursive call is absent
D) None
Answer: A
275. Which recursion uses more stack memory?
A) Non-tail recursion
B) Tail recursion
C) Iteration
D) None
Answer: A
276. Recursion is better suited for:
A) Tree traversal
B) Sorting
C) Searching
D) None
Answer: A
277. Factorial of a number using recursion has a time complexity of:
A) O(n)
B) O(log n)
C) O(n²)
D) O(1)
Answer: A
278. Fibonacci using naive recursion has time complexity:
A) O(2ⁿ)
B) O(n)
C) O(n²)
D) None
Answer: A
279. Recursive functions are stored in:
A) Call stack
B) Heap
C) Queue
D) None
Answer: A
280. Excessive recursion can lead to:
A) Stack overflow
B) Infinite loop
C) Heap corruption
D) None
Answer: A
281. Time complexity measures:
A) The amount of time an algorithm takes as input size grows
B) Space used by algorithm
C) CPU frequency
D) None
Answer: A
282. Space complexity refers to:
A) Memory used by algorithm
B) Execution time
C) Disk usage
D) None
Answer: A
283. The Big-O of constant time algorithm is:
A) O(1)
B) O(n)
C) O(log n)
D) None
Answer: A
284. Binary search has time complexity:
A) O(log n)
B) O(n)
C) O(1)
D) O(n²)
Answer: A
285. Linear search has time complexity:
A) O(n)
B) O(log n)
C) O(1)
D) O(n log n)
Answer: A
286. Time complexity of bubble sort is:
A) O(n²)
B) O(log n)
C) O(n log n)
D) O(n)
Answer: A
287. Best case time for insertion sort:
A) O(n)
B) O(n²)
C) O(n log n)
D) O(1)
Answer: A
288. Merge sort’s time complexity is:
A) O(n log n)
B) O(n²)
C) O(log n)
D) None
Answer: A
289. Quick sort average case time complexity is:
A) O(n log n)
B) O(n²)
C) O(log n)
D) None
Answer: A
290. Worst case of quick sort occurs when:
A) Pivot is smallest or largest element
B) Pivot is middle
C) Array is random
D) None
Answer: A
291. Time complexity of heap sort is:
A) O(n log n)
B) O(n²)
C) O(n)
D) None
Answer: A
292. Counting sort works best when:
A) Range of elements is small
B) Elements are large
C) Elements are unsorted
D) None
Answer: A
293. Which sorting algorithm is not comparison-based?
A) Counting sort
B) Merge sort
C) Quick sort
D) Heap sort
Answer: A
294. Radix sort works by:
A) Sorting digits from least to most significant
B) Sorting by swapping elements
C) Using recursion
D) None
Answer: A
295. The auxiliary space of merge sort is:
A) O(n)
B) O(1)
C) O(n log n)
D) None
Answer: A
296. Heap sort is an example of:
A) In-place sorting
B) Non-in-place sorting
C) Recursive sorting
D) None
Answer: A
297. Which sorting algorithm is stable?
A) Merge sort
B) Quick sort
C) Heap sort
D) Selection sort
Answer: A
298. A stable sort maintains:
A) Relative order of equal elements
B) Heap property
C) Constant space
D) None
Answer: A
299. Which algorithm is best for large datasets stored on disk?
A) Merge sort
B) Bubble sort
C) Quick sort
D) Insertion sort
Answer: A
300. The asymptotic notation that gives the lower bound of an algorithm is:
A) Ω (Omega)
B) O (Big O)
C) Θ (Theta)
D) None
Answer: A