MCQ Collection
Data Structures MCQs
Practice Data Structures questions with answers and explanations.
Choose an option to check your answer.
A.
Quick Sort
B.
Binary Search
C.
Circular Queue
D.
Path Compression
Show Answer
Correct Answer: D. Path Compression
Explanation:
Path Compression fits because it supports accelerating repeated disjoint-set queries and it flattens the parent structure over time.
Both clues point to this choice.
Choose an option to check your answer.
A.
Union by Rank
B.
Binomial Heap
C.
Binary Search
D.
Bloom Filter
Show Answer
Correct Answer: A. Union by Rank
Explanation:
Union by Rank is a disjoint-set optimization that attaches the shallower tree under the deeper tree.
This description distinguishes it from the other choices.
Choose an option to check your answer.
A.
frequent insertions at the head
B.
keeping union-find trees short
C.
immediate reclamation when the count reaches zero
D.
ordered dictionary operations with expected logarithmic time
Show Answer
Correct Answer: B. keeping union-find trees short
Explanation:
Union by Rank is commonly used for keeping union-find trees short.
Its design supports this task efficiently or naturally.
Choose an option to check your answer.
A.
its running time depends on both item count and key range
B.
elements are typically stored in adjacent memory locations
C.
rank approximates tree height
D.
a query can combine results from a logarithmic number of nodes
Show Answer
Correct Answer: C. rank approximates tree height
Explanation:
The defining property is that rank approximates tree height.
The other statements describe different structures or concepts.
Choose an option to check your answer.
A.
Binary Tree
B.
Red-Black Tree
C.
B-Tree
D.
Disjoint Set Union
Show Answer
Correct Answer: D. Disjoint Set Union
Explanation:
Disjoint Set Union fits because it supports connectivity queries and Kruskal's algorithm and its main operations are find and union.
Both clues point to this choice.
Choose an option to check your answer.
A.
Topological Sort
B.
Linear Search
C.
Recursion Stack
D.
Insertion Sort
Show Answer
Correct Answer: A. Topological Sort
Explanation:
Topological Sort is a linear ordering of vertices that respects all directed precedence edges.
This description distinguishes it from the other choices.
Choose an option to check your answer.
A.
database range queries
B.
scheduling tasks with dependencies
C.
in-place sorting with O(n log n) worst-case time
D.
small or nearly sorted datasets
Show Answer
Correct Answer: B. scheduling tasks with dependencies
Explanation:
Topological Sort is commonly used for scheduling tasks with dependencies.
Its design supports this task efficiently or naturally.
Choose an option to check your answer.
A.
the probe sequence depends on two hash functions
B.
it can suffer from primary clustering
C.
it exists only for directed acyclic graphs
D.
an edge from u to v need not imply an edge from v to u
Show Answer
Correct Answer: C. it exists only for directed acyclic graphs
Explanation:
The defining property is that it exists only for directed acyclic graphs.
The other statements describe different structures or concepts.
Choose an option to check your answer.
A.
Amortized Analysis
B.
Radix Sort
C.
Open Addressing
D.
Topological Sort
Show Answer
Correct Answer: D. Topological Sort
Explanation:
Topological Sort fits because it supports scheduling tasks with dependencies and it exists only for directed acyclic graphs.
Both clues point to this choice.
Choose an option to check your answer.
A.
Disjoint Set Union
B.
Directed Graph
C.
Selection Sort
D.
Priority Queue
Show Answer
Correct Answer: A. Disjoint Set Union
Explanation:
Disjoint Set Union is a structure that maintains a partition of elements into disjoint sets.
This description distinguishes it from the other choices.
Choose an option to check your answer.
A.
modeling symmetric relationships
B.
connectivity queries and Kruskal's algorithm
C.
cache-friendly hash tables
D.
modeling networks, routes, and relationships
Show Answer
Correct Answer: B. connectivity queries and Kruskal's algorithm
Explanation:
Disjoint Set Union is commonly used for connectivity queries and Kruskal's algorithm.
Its design supports this task efficiently or naturally.
Choose an option to check your answer.
A.
it exists only for directed acyclic graphs
B.
it typically uses a queue
C.
its main operations are find and union
D.
it bounds a function from below for sufficiently large inputs
Show Answer
Correct Answer: C. its main operations are find and union
Explanation:
The defining property is that its main operations are find and union.
The other statements describe different structures or concepts.