Question OA Practice Exam
The Objective Assessment (OA) for Data Structures and Algorithms I tests your
ability to analyze algorithm efficiency and choose appropriate structures to solve
programming problems. It focuses heavily on conceptual understanding and
foundational mathematics rather than writing complex code from scratch.
1. Which data structure operates on a Last-In, First-Out (LIFO) basis?
A) Queue
B) Stack
C) Linked List
D) Binary Tree
Rationale: A stack restricts insertion and deletion to one end, ensuring the last element
added is the first one removed.
2. What is the worst-case time complexity of searching for an element in a binary search
tree (BST) that is completely unbalanced?
A) \(O(1)\)
B) \(O(\log n)\)
C) \(O(n)\)
D) \(O(n \log n)\)
Rationale: An unbalanced BST degrades into a linear linked list shape, forcing a
sequential search through all \(n\) nodes.
3. Which algorithm utilizes a divide-and-conquer strategy by picking a 'pivot' element?
A) Merge Sort
B) Insertion Sort
C) Quick Sort
D) Bubble Sort
Rationale: Quick Sort partitions an array into sub-arrays around a selected pivot
element and recursively sorts them.
4. What is the main advantage of a doubly linked list over a singly linked list?
A) Uses less memory
B) Allows bidirectional traversal
C) Faster element insertion at the head
D) Guarantees \(O(1)\) random access
Rationale: Doubly linked lists store both next and previous pointers in each node,
allowing traversal in both directions.
5. What is the time complexity to access an element at a specific index in a dynamic
array?
A) \(O(1)\)
, B) \(O(\log n)\)
C) \(O(n)\)
D) \(O(n^2)\)
Rationale: Arrays use contiguous memory locations, allowing direct mathematical
calculation of any index address in constant time.
6. Which notation provides a strict mathematical upper bound on the growth rate of an
algorithm's running time?
A) Omega (\(\Omega \))
B) Theta (\(\Theta \))
C) Big O (\(O\))
D) Little o (\(o\))
Rationale: Big O notation describes the worst-case scenario or asymptotic upper bound
of an algorithm's performance.
7. What happens when two distinct keys generate the exact same index location in a hash
table?
A) Overflow error
B) Collision
C) Garbage collection
D) Compaction
Rationale: A collision occurs when a hash function maps two different keys to the same
bucket or slot.
8. Which abstract data type utilizes a First-In, First-Out (FIFO) access pattern?
A) Queue
B) Stack
C) Heap
D) Graph
Rationale: Queues process elements in the exact order they arrive; insertions occur at
the back and removals at the front.
9. What is the maximum number of children a node can have in a binary tree?
A) 1
B) 2
C) 3
D) Unlimited
Rationale: By definition, every node in a binary tree can have a maximum of two child
nodes (left and right).
10. Which sorting algorithm has a guaranteed worst-case time complexity of \(O(n \log n)\)?
A) Quick Sort
B) Bubble Sort
C) Merge Sort
D) Insertion Sort
Rationale: Merge Sort continually divides the array in half (\( \log n \) steps) and takes
\(O(n)\) time to merge them back, regardless of initial order.
11. If an algorithm contains two nested loops that both iterate up to \(n\), what is its overall
time complexity?
A) \(O(n)\)
B) \(O(n \log n)\)
, C) \(O(n^2)\)
D) \(O(2^n)\)
Rationale: The inner loop executes \(n\) times for each of the \(n\) iterations of the outer
loop, resulting in \(n \times n = n^2\) operations.
12. Which data structure is best suited for implementing a recursive function call stack?
A) Stack
B) Queue
C) Hash Map
D) Array
Rationale: The runtime environment uses a stack structure to track active functions,
pushing new frames and popping them upon return.
13. What is the best-case time complexity of a linear search algorithm?
A) \(O(1)\)
B) \(O(\log n)\)
C) \(O(n)\)
D) \(O(n \log n)\)
Rationale: The best-case scenario occurs if the desired target element is located at the
very first index of the collection.
14. Which tree traversal method visits the root node after visiting both the left and right
subtrees?
A) In-order
B) Pre-order
C) Post-order
D) Level-order
Rationale: Post-order traversal follows the execution sequence of Left Subtree
\(\rightarrow \) Right Subtree \(\rightarrow \) Root Node.
15. What type of graph contains pairs of vertices where edges have a specific direction
associated with them?
A) Undirected graph
B) Directed graph
C) Cyclic graph
D) Weighted graph
Rationale: In a directed graph (digraph), edges are ordered pairs pointing explicitly from
one vertex to another.
16. What is the time complexity of pushing an item onto a properly implemented stack?
A) \(O(1)\)
B) \(O(\log n)\)
C) \(O(n)\)
D) \(O(n \log n)\)
Rationale: Pushing an item involves adding an element directly to the top pointer,
requiring a constant number of operations.
17. Which search algorithm requires the underlying collection data to be completely sorted
beforehand?
A) Linear search
B) Binary search
C) Depth-First Search
, D) Breadth-First Search
Rationale: Binary search relies on comparing the midpoint value to eliminate half the
dataset, which fails if the data lacks sorted order.
18. What is a key disadvantage of utilizing a standard array data structure?
A) High overhead per element
B) Fixed size allocation
C) Slow random access read speeds
D) Complex implementation steps
Rationale: Arrays require a contiguous block of memory allocated at creation time,
making resizing an expensive \(O(n)\) task.
19. Which collision resolution technique stores all colliding elements within the same bucket
using a linked list?
A) Open Addressing
B) Linear Probing
C) Chaining
D) Quadratic Probing
Rationale: Separate chaining resolves collisions by building a linked list chain of entries
at the targeted hash table index.
20. What is the runtime complexity of a binary search algorithm on a sorted array of size
\(n\)?
A) \(O(1)\)
B) \(O(\log n)\)
C) \(O(n)\)
D) \(O(n^2)\)
Rationale: Binary search repeatedly divides the search space in half, resulting in a
logarithmic relationship with dataset size.
21. In Python, which built-in data type represents an ordered, mutable sequence of
elements?
A) Tuple
B) List
C) Dictionary
D) Set
Rationale: Lists are mutable sequences, meaning their individual items can be modified,
added, or deleted after creation.
22. Which algorithm design paradigm solves a problem by combining solutions to non-
overlapping subproblems?
A) Dynamic Programming
B) Greedy Method
C) Divide and Conquer
D) Backtracking
Rationale: Divide-and-conquer breaks a large problem into independent, non-
overlapping parts, solves them, and merges the results.
23. What is the height of an empty binary tree?
A) -1
B) 0
C) 1