WGU C949 DATA STRUCTURES AND ALGORITHMS EXAM |
QUESTIONS AND ANSWERS (VERIFIED ANSWERS) | EXAM
PREP PRACTICE QUESTIONS AND ANSWERS | LATEST EXAM
GUIDE 2026&2027
1. Which data structure is most appropriate when elements must be accessed directly by
their position in constant time?
A. Linked list
B. Array
C. Stack
D. Binary tree
Answer: B
An array provides direct indexed access, making retrieval by position an O(1) operation when
the index is known.
2. A program needs to process customers in the same order they arrive. Which data
structure should be used?
A. Stack
B. Binary search tree
C. Queue
D. Hash table
Answer: C
A queue follows the FIFO principle, so the first customer added is the first customer processed.
3. Which operation on a stack removes the element most recently added?
A. Push
B. Enqueue
C. Peek
D. Pop
Answer: D
Pop removes the item at the top of a stack, following the LIFO principle.
4. A developer needs to insert and remove elements frequently from both ends of a
collection. Which structure is most suitable?
,A. Deque
B. Binary heap
C. Hash table
D. Singly linked list
Answer: A
A deque, or double-ended queue, supports insertion and removal at both the front and rear.
5. Which Big-O notation represents constant-time complexity?
A. O(log n)
B. O(n)
C. O(1)
D. O(n²)
Answer: C
O(1) means the operation requires a constant amount of work regardless of the input size.
6. An algorithm examines every element in an unsorted list once. What is its worst-case
time complexity?
A. O(log n)
B. O(n)
C. O(n log n)
D. O(n²)
Answer: B
Examining each of n elements once results in linear time, represented as O(n).
7. Which structure consists of nodes connected through references or pointers?
A. Linked list
B. Array
C. Matrix
D. Hash table
Answer: A
A linked list stores elements in nodes where each node contains data and one or more links to
other nodes.
8. A binary tree node can have at most how many children?
,A. One
B. Two
C. Three
D. Unlimited
Answer: B
By definition, a binary tree allows each node to have no more than two children.
9. In a binary search tree, where are values smaller than a node's value normally stored?
A. Root only
B. Right subtree
C. Left subtree
D. Parent node
Answer: C
The binary search tree ordering property places smaller values in the left subtree and larger
values in the right subtree.
10. Which traversal visits a binary tree in the order left subtree, root, right subtree?
A. Preorder
B. Postorder
C. Level-order
D. Inorder
Answer: D
Inorder traversal processes the left subtree, then the current node, and finally the right
subtree.
11. Which traversal is particularly useful for processing a binary search tree in ascending
order?
A. Inorder
B. Preorder
C. Postorder
D. Reverse-level traversal
Answer: A
An inorder traversal of a valid binary search tree visits keys in sorted ascending order.
, 12. A graph contains vertices connected by edges. Which structure is commonly used to
represent the graph efficiently when the graph is sparse?
A. Adjacency matrix
B. Adjacency list
C. Stack only
D. Sorted array
Answer: B
An adjacency list stores only existing edges, making it space-efficient for sparse graphs.
13. Which graph traversal uses a queue to explore vertices level by level?
A. DFS
B. Inorder
C. BFS
D. Binary search
Answer: C
Breadth-first search uses a queue and explores neighboring vertices before moving to deeper
levels.
14. Which graph traversal normally uses a stack or recursive function calls?
A. DFS
B. BFS
C. Hashing
D. Heap sort
Answer: A
Depth-first search explores as far as possible along a branch before backtracking and can be
implemented using a stack or recursion.
15. A sorted array contains 1,024 elements. Approximately how many comparisons might
binary search require in the worst case?
A. 10
B. 32
C. 512
D. 1,024
Answer: A
QUESTIONS AND ANSWERS (VERIFIED ANSWERS) | EXAM
PREP PRACTICE QUESTIONS AND ANSWERS | LATEST EXAM
GUIDE 2026&2027
1. Which data structure is most appropriate when elements must be accessed directly by
their position in constant time?
A. Linked list
B. Array
C. Stack
D. Binary tree
Answer: B
An array provides direct indexed access, making retrieval by position an O(1) operation when
the index is known.
2. A program needs to process customers in the same order they arrive. Which data
structure should be used?
A. Stack
B. Binary search tree
C. Queue
D. Hash table
Answer: C
A queue follows the FIFO principle, so the first customer added is the first customer processed.
3. Which operation on a stack removes the element most recently added?
A. Push
B. Enqueue
C. Peek
D. Pop
Answer: D
Pop removes the item at the top of a stack, following the LIFO principle.
4. A developer needs to insert and remove elements frequently from both ends of a
collection. Which structure is most suitable?
,A. Deque
B. Binary heap
C. Hash table
D. Singly linked list
Answer: A
A deque, or double-ended queue, supports insertion and removal at both the front and rear.
5. Which Big-O notation represents constant-time complexity?
A. O(log n)
B. O(n)
C. O(1)
D. O(n²)
Answer: C
O(1) means the operation requires a constant amount of work regardless of the input size.
6. An algorithm examines every element in an unsorted list once. What is its worst-case
time complexity?
A. O(log n)
B. O(n)
C. O(n log n)
D. O(n²)
Answer: B
Examining each of n elements once results in linear time, represented as O(n).
7. Which structure consists of nodes connected through references or pointers?
A. Linked list
B. Array
C. Matrix
D. Hash table
Answer: A
A linked list stores elements in nodes where each node contains data and one or more links to
other nodes.
8. A binary tree node can have at most how many children?
,A. One
B. Two
C. Three
D. Unlimited
Answer: B
By definition, a binary tree allows each node to have no more than two children.
9. In a binary search tree, where are values smaller than a node's value normally stored?
A. Root only
B. Right subtree
C. Left subtree
D. Parent node
Answer: C
The binary search tree ordering property places smaller values in the left subtree and larger
values in the right subtree.
10. Which traversal visits a binary tree in the order left subtree, root, right subtree?
A. Preorder
B. Postorder
C. Level-order
D. Inorder
Answer: D
Inorder traversal processes the left subtree, then the current node, and finally the right
subtree.
11. Which traversal is particularly useful for processing a binary search tree in ascending
order?
A. Inorder
B. Preorder
C. Postorder
D. Reverse-level traversal
Answer: A
An inorder traversal of a valid binary search tree visits keys in sorted ascending order.
, 12. A graph contains vertices connected by edges. Which structure is commonly used to
represent the graph efficiently when the graph is sparse?
A. Adjacency matrix
B. Adjacency list
C. Stack only
D. Sorted array
Answer: B
An adjacency list stores only existing edges, making it space-efficient for sparse graphs.
13. Which graph traversal uses a queue to explore vertices level by level?
A. DFS
B. Inorder
C. BFS
D. Binary search
Answer: C
Breadth-first search uses a queue and explores neighboring vertices before moving to deeper
levels.
14. Which graph traversal normally uses a stack or recursive function calls?
A. DFS
B. BFS
C. Hashing
D. Heap sort
Answer: A
Depth-first search explores as far as possible along a branch before backtracking and can be
implemented using a stack or recursion.
15. A sorted array contains 1,024 elements. Approximately how many comparisons might
binary search require in the worst case?
A. 10
B. 32
C. 512
D. 1,024
Answer: A