MCQ Collection
Data Structures MCQs
Practice Data Structures questions with answers and explanations.
Choose an option to check your answer.
A.
Weighted Graph
B.
Garbage Collection
C.
Adjacency List
D.
Suffix Array
Show Answer
Correct Answer: A. Weighted Graph
Explanation:
Weighted Graph is a graph whose edges or vertices carry numeric costs or values.
This description distinguishes it from the other choices.
Choose an option to check your answer.
A.
tracking return addresses and local state
B.
shortest-path and network optimization problems
C.
fast random access when the index is known
D.
sparse graphs
Show Answer
Correct Answer: B. shortest-path and network optimization problems
Explanation:
Weighted Graph is commonly used for shortest-path and network optimization problems.
Its design supports this task efficiently or naturally.
Choose an option to check your answer.
A.
each edge connects two vertices bidirectionally
B.
there is at most one binomial tree of each degree
C.
path quality can depend on the sum of weights
D.
after each full pass, an extreme element reaches its final region
Show Answer
Correct Answer: C. path quality can depend on the sum of weights
Explanation:
The defining property is that path quality can depend on the sum of weights.
The other statements describe different structures or concepts.
Choose an option to check your answer.
A.
Topological Sort
B.
Quick Sort
C.
Selection Sort
D.
Weighted Graph
Show Answer
Correct Answer: D. Weighted Graph
Explanation:
Weighted Graph fits because it supports shortest-path and network optimization problems and path quality can depend on the sum of weights.
Both clues point to this choice.
Choose an option to check your answer.
A.
Adjacency Matrix
B.
Selection Sort
C.
Fibonacci Heap
D.
In-Place Algorithm
Show Answer
Correct Answer: A. Adjacency Matrix
Explanation:
Adjacency Matrix is a square matrix indicating which vertex pairs are connected.
This description distinguishes it from the other choices.
Choose an option to check your answer.
A.
in-place sorting with O(n log n) worst-case time
B.
dense graphs and constant-time edge-existence tests
C.
prefix search and autocomplete
D.
representing hierarchical binary relationships
Show Answer
Correct Answer: B. dense graphs and constant-time edge-existence tests
Explanation:
Adjacency Matrix is commonly used for dense graphs and constant-time edge-existence tests.
Its design supports this task efficiently or naturally.
Choose an option to check your answer.
A.
each edge connects two vertices bidirectionally
B.
it avoids allocating an auxiliary structure proportional to input size
C.
its space usage is quadratic in the number of vertices
D.
its main operations are find and union
Show Answer
Correct Answer: C. its space usage is quadratic in the number of vertices
Explanation:
The defining property is that its space usage is quadratic in the number of vertices.
The other statements describe different structures or concepts.
Choose an option to check your answer.
A.
Full Binary Tree
B.
Open Addressing
C.
Breadth-First Search
D.
Adjacency Matrix
Show Answer
Correct Answer: D. Adjacency Matrix
Explanation:
Adjacency Matrix fits because it supports dense graphs and constant-time edge-existence tests and its space usage is quadratic in the number of vertices.
Both clues point to this choice.
Choose an option to check your answer.
A.
Depth-First Search
B.
Binary Search Tree
C.
Adjacency List
D.
Directed Graph
Show Answer
Correct Answer: D. Directed Graph
Explanation:
Directed Graph fits because it supports modeling one-way relationships and an edge from u to v need not imply an edge from v to u.
Both clues point to this choice.
Choose an option to check your answer.
A.
Undirected Graph
B.
Stable Sorting
C.
Breadth-First Search
D.
Suffix Tree
Show Answer
Correct Answer: A. Undirected Graph
Explanation:
Undirected Graph is a graph whose edges have no direction.
This description distinguishes it from the other choices.
Choose an option to check your answer.
A.
scheduling tasks with dependencies
B.
modeling symmetric relationships
C.
substring search and text indexing
D.
dense graphs and constant-time edge-existence tests
Show Answer
Correct Answer: B. modeling symmetric relationships
Explanation:
Undirected Graph is commonly used for modeling symmetric relationships.
Its design supports this task efficiently or naturally.
Choose an option to check your answer.
A.
very deep recursion can cause stack overflow
B.
each node's balance factor is typically -1, 0, or 1
C.
each edge connects two vertices bidirectionally
D.
the minimum element is stored at the root
Show Answer
Correct Answer: C. each edge connects two vertices bidirectionally
Explanation:
The defining property is that each edge connects two vertices bidirectionally.
The other statements describe different structures or concepts.