MCQ Collection
Data Structures 300 Unique MCQs
Practice Data Structures 300 Unique questions with answers and explanations.
Choose an option to check your answer.
A.
algorithms with many decrease-key operations
B.
accelerating repeated disjoint-set queries
C.
sliding-window algorithms
D.
finding an item in sorted random-access data
Show Answer
Correct Answer: B. accelerating repeated disjoint-set queries
Explanation:
Path Compression is commonly used for accelerating repeated disjoint-set queries.
Its design supports this task efficiently or naturally.
Choose an option to check your answer.
A.
it can support pattern search in time proportional to the pattern length
B.
it exists only for directed acyclic graphs
C.
it flattens the parent structure over time
D.
it bounds a function from below for sufficiently large inputs
Show Answer
Correct Answer: C. it flattens the parent structure over time
Explanation:
The defining property is that it flattens the parent structure over time.
The other statements describe different structures or concepts.
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.
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.
Choose an option to check your answer.
A.
ordered searching and dynamic set operations
B.
cycle detection, topological reasoning, and connectivity
C.
stable sorting with guaranteed O(n log n) time
D.
implementing ordered maps and sets
Show Answer
Correct Answer: B. cycle detection, topological reasoning, and connectivity
Explanation:
Depth-First Search is commonly used for cycle detection, topological reasoning, and connectivity.
Its design supports this task efficiently or naturally.
Choose an option to check your answer.
A.
poor pivot choices can produce quadratic time
B.
constant factors and lower-order terms are ignored asymptotically
C.
it typically uses recursion or a stack
D.
it reuses blocks instead of requesting each one separately from the system
Show Answer
Correct Answer: C. it typically uses recursion or a stack
Explanation:
The defining property is that it typically uses recursion or a stack.
The other statements describe different structures or concepts.
Choose an option to check your answer.
A.
Breadth-First Search
B.
Selection Sort
C.
Stable Sorting
D.
Depth-First Search
Show Answer
Correct Answer: D. Depth-First Search
Explanation:
Depth-First Search fits because it supports cycle detection, topological reasoning, and connectivity and it typically uses recursion or a stack.
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.