Practice Library
All MCQs
Browse exam-wise, subject-wise, and country-wise MCQs with 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.
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.
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.
Path Compression
B.
Separate Chaining
C.
Bloom Filter
D.
B-Tree
Show Answer
Correct Answer: A. Path Compression
Explanation:
Path Compression is an optimization that makes nodes on a find path point closer to the set representative.
This description distinguishes it from the other choices.
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.
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.
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.
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.
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.
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.
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.
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.