WGU D291 Objective Assessment Exam
2026/2027 Actual Exam | 100% Correct
Answers with Detailed Rationales | Pass
Guaranteed - A+ Graded
Section 1: Algorithm Analysis
Q1: What is the time complexity of the following code?
python
for i in range(n):
for j in range(n):
print(i, j)
A. O(n)
B. O(n²) [CORRECT]
C. O(log n)
D. O(2ⁿ)
Correct Answer: B
Rationale: The code consists of two nested loops, each iterating n times. The total number of
operations is n * n = n², resulting in quadratic time complexity.
Q2: What is the time complexity of binary search on a sorted array of size n?
A. O(1)
B. O(log n) [CORRECT]
C. O(n)
,2
D. O(n log n)
Correct Answer: B
Rationale: Binary search halves the search space with each comparison. This logarithmic
reduction results in O(log n) time complexity.
Q3: Which of the following represents the worst-case time complexity for accessing an element
in a linked list?
A. O(1)
B. O(log n)
C. O(n) [CORRECT]
D. O(n²)
Correct Answer: C
Rationale: Unlike arrays, linked lists do not allow random access. To find an element, you must
traverse the list from the head node, taking linear time in the worst case.
Q4: What is the space complexity of a recursive algorithm that creates a new stack frame for
each call and has a recursion depth of n?
A. O(1)
B. O(n) [CORRECT]
C. O(n²)
D. O(log n)
Correct Answer: B
Rationale: Each recursive call adds a layer to the system call stack. With a depth of n, the space
required grows linearly with the input size.
,3
Q5: An algorithm has a time complexity of O(n log n). Which of the following functions
represents this complexity?
A. A single loop iterating n times.
B. A nested loop where the inner loop cuts the input size in half each time. [CORRECT]
C. Two sequential loops, each iterating n times.
D. A recursive function making two calls per step without reducing input size significantly.
Correct Answer: B
Rationale: A loop running n times combined with an inner operation that takes log n time (like
dividing the problem space) results in O(n log n). Merge Sort is a classic example.
Q6: What does Big O notation specifically describe?
A. The exact number of CPU cycles an algorithm takes.
B. The average-case performance of an algorithm.
C. The upper bound of an algorithm's growth rate. [CORRECT]
D. The lower bound of an algorithm's growth rate.
Correct Answer: C
Rationale: Big O notation (O) describes the asymptotic upper bound, representing the worst-case
scenario for an algorithm's time or space requirements as input size approaches infinity.
Q7: If an algorithm takes 10 ms to process 100 elements, approximately how long will it take to
process 1000 elements if the complexity is O(n²)?
A. 100 ms
B. 1000 ms (1 second) [CORRECT]
C. 10 ms
D. 10000 ms
, 4
Correct Answer: B
Rationale: If complexity is O(n²), increasing the input size by a factor of 10 (100 to 1000)
increases the time by a factor of 10² = 100. 10 ms * 100 = 1000 ms.
Q8: What is the time complexity of the following code snippet?
python
i=1
while i < n:
i=i*2
A. O(n)
B. O(log n) [CORRECT]
C. O(n log n)
D. O(1)
Correct Answer: B
Rationale: The loop variable i doubles with each iteration (1, 2, 4, 8...). It reaches n in log₂n
steps. Therefore, the complexity is logarithmic.
Q9: Which of the following complexities is the most efficient (fastest growth suppression)?
A. O(n log n)
B. O(n)
C. O(log n) [CORRECT]
D. O(n²)
Correct Answer: C