WGU C949 — Data Structures and
Algorithms I — 250 Original Practice
Questions
1. What is the primary function of an abstract data type (ADT)?
A. To specify the exact memory layout of data
B. To define behavior through operations without specifying implementation
C. To provide hardware-level data access
D. To replace all primitive data types
B. To define behavior through operations without specifying implementation
An ADT describes what operations can be performed (e.g., push, pop) without indicating
how they are implemented. This separation of interface from implementation is the
foundation of data abstraction .
2. Which of the following is an example of a primitive data type?
A. Stack
B. Integer
C. Queue
D. Binary tree
B. Integer
Integers, floats, characters, and booleans are primitive types built into most languages.
Stacks, queues, and trees are abstract data types .
3. Which data structure follows First-In, First-Out (FIFO) ordering?
A. Stack
B. Queue
C. Priority queue
D. Binary search tree
B. Queue
,A queue inserts at the rear and removes from the front, so the earliest inserted item is
removed first. A stack is LIFO .
4. What operation adds an element to the top of a stack?
A. Enqueue
B. Dequeue
C. Push
D. Pop
C. Push
Push adds an element to the top of a stack. Pop removes the top element. Enqueue and
dequeue are queue operations .
5. A stack is used to evaluate which type of expression?
A. Infix
B. Postfix
C. Prefix only
D. SQL
B. Postfix
Stacks are used to convert infix to postfix and to evaluate postfix (reverse Polish)
expressions by pushing operands and applying operators .
6. Which ADT allows insertion and removal at both ends?
A. Stack
B. Queue
C. Deque
D. Set
C. Deque
A deque (double-ended queue) supports insertion and removal at both the front and the
back, combining stack and queue capabilities .
7. Which ADT stores unordered items with no duplicates allowed?
A. Bag
B. List
,C. Set
D. Dictionary
C. Set
A set stores distinct items with no duplicates and no defined order. A bag allows
duplicates. A list maintains order. A dictionary stores key-value pairs .
8. What is the primary advantage of a linked list over an array?
A. Faster random access
B. Faster insertion at arbitrary positions
C. Lower memory usage
D. Built-in sorting
B. Faster insertion at arbitrary positions
Inserting into a linked list only requires updating pointers, whereas an array requires
shifting elements. Arrays have faster random access by index .
9. What is the time complexity of accessing an element by index in a linked list?
A. O(1)
B. O(log n)
C. O(n)
D. O(n²)
C. O(n)
Linked lists have no direct index access. You must traverse from the head node, potentially
visiting all n nodes .
10. What is the time complexity of appending to a dynamic array (amortized)?
A. O(1)
B. O(log n)
C. O(n)
D. O(n²)
A. O(1)
Although resizing occasionally costs O(n), the cost is spread across many constant-time
appends, yielding amortized O(1) .
, 11. In a singly-linked list, what is the last node called?
A. Head
B. Tail
C. Root
D. Leaf
B. Tail
The first node is the head; the last node is the tail. The tail's next pointer is null (or points
to the head in a circular list) .
12. What makes a circular linked list different from a standard linked list?
A. It stores two values per node
B. The tail node references the head
C. It cannot be traversed
D. It requires no pointers
B. The tail node references the head
In a circular linked list, the tail's next reference points back to the head, allowing
continuous traversal .
13. What is a binary search tree's defining property?
A. Every node has exactly two children
B. Left subtree keys < node key < right subtree keys
C. All leaves are at the same level
D. It is always balanced
B. Left subtree keys < node key < right subtree keys
This ordering property enables efficient search: compare the target with the node and
eliminate half the remaining tree .
14. What traversal of a binary search tree produces sorted output?
A. Preorder
B. Inorder
C. Postorder
D. Level-order
B. Inorder
Algorithms I — 250 Original Practice
Questions
1. What is the primary function of an abstract data type (ADT)?
A. To specify the exact memory layout of data
B. To define behavior through operations without specifying implementation
C. To provide hardware-level data access
D. To replace all primitive data types
B. To define behavior through operations without specifying implementation
An ADT describes what operations can be performed (e.g., push, pop) without indicating
how they are implemented. This separation of interface from implementation is the
foundation of data abstraction .
2. Which of the following is an example of a primitive data type?
A. Stack
B. Integer
C. Queue
D. Binary tree
B. Integer
Integers, floats, characters, and booleans are primitive types built into most languages.
Stacks, queues, and trees are abstract data types .
3. Which data structure follows First-In, First-Out (FIFO) ordering?
A. Stack
B. Queue
C. Priority queue
D. Binary search tree
B. Queue
,A queue inserts at the rear and removes from the front, so the earliest inserted item is
removed first. A stack is LIFO .
4. What operation adds an element to the top of a stack?
A. Enqueue
B. Dequeue
C. Push
D. Pop
C. Push
Push adds an element to the top of a stack. Pop removes the top element. Enqueue and
dequeue are queue operations .
5. A stack is used to evaluate which type of expression?
A. Infix
B. Postfix
C. Prefix only
D. SQL
B. Postfix
Stacks are used to convert infix to postfix and to evaluate postfix (reverse Polish)
expressions by pushing operands and applying operators .
6. Which ADT allows insertion and removal at both ends?
A. Stack
B. Queue
C. Deque
D. Set
C. Deque
A deque (double-ended queue) supports insertion and removal at both the front and the
back, combining stack and queue capabilities .
7. Which ADT stores unordered items with no duplicates allowed?
A. Bag
B. List
,C. Set
D. Dictionary
C. Set
A set stores distinct items with no duplicates and no defined order. A bag allows
duplicates. A list maintains order. A dictionary stores key-value pairs .
8. What is the primary advantage of a linked list over an array?
A. Faster random access
B. Faster insertion at arbitrary positions
C. Lower memory usage
D. Built-in sorting
B. Faster insertion at arbitrary positions
Inserting into a linked list only requires updating pointers, whereas an array requires
shifting elements. Arrays have faster random access by index .
9. What is the time complexity of accessing an element by index in a linked list?
A. O(1)
B. O(log n)
C. O(n)
D. O(n²)
C. O(n)
Linked lists have no direct index access. You must traverse from the head node, potentially
visiting all n nodes .
10. What is the time complexity of appending to a dynamic array (amortized)?
A. O(1)
B. O(log n)
C. O(n)
D. O(n²)
A. O(1)
Although resizing occasionally costs O(n), the cost is spread across many constant-time
appends, yielding amortized O(1) .
, 11. In a singly-linked list, what is the last node called?
A. Head
B. Tail
C. Root
D. Leaf
B. Tail
The first node is the head; the last node is the tail. The tail's next pointer is null (or points
to the head in a circular list) .
12. What makes a circular linked list different from a standard linked list?
A. It stores two values per node
B. The tail node references the head
C. It cannot be traversed
D. It requires no pointers
B. The tail node references the head
In a circular linked list, the tail's next reference points back to the head, allowing
continuous traversal .
13. What is a binary search tree's defining property?
A. Every node has exactly two children
B. Left subtree keys < node key < right subtree keys
C. All leaves are at the same level
D. It is always balanced
B. Left subtree keys < node key < right subtree keys
This ordering property enables efficient search: compare the target with the node and
eliminate half the remaining tree .
14. What traversal of a binary search tree produces sorted output?
A. Preorder
B. Inorder
C. Postorder
D. Level-order
B. Inorder