C949, Data Structures And Algorithms I, C949
Wgu Up to Date 2025/2026 Latest Exam
Questions And Answers Complete Study Guide
Exam Prep Practice Test.
Big-O & Complexity Analysis
Q1. When analyzing an algorithm whose running time is
7nlogn+40n+9007nlogn+40n+900, which classification best expresses its
asymptotic growth?
A. O(n)O(n)
B. O(nlogn)O(nlogn)
C. O(n2)O(n2)
D. O(logn)O(logn)
Correct Answer: B
The dominant term nlognnlogn determines the asymptotic class because constants
and lower-order terms become insignificant as input size grows .
Q2. What is the time complexity of the following pseudocode?
,text
for i = 1 to n:
for j = 1 to i:
print(i, j)
A. O(n)
B. O(n log n)
C. O(n^2)
D. O(2^n)
Correct Answer: C
The inner loop runs an average of n/2 times. The total number of operations is the sum of
1 to n, which equals n(n+1)/2. In Big-O notation, this simplifies to O(n^2) .
Q3. A dynamic array doubles its capacity whenever it becomes full. What is the
amortized time complexity of appending one item over a long sequence of
appends?
A. O(1)
B. O(log n)
C. O(n)
D. O(n log n)
Correct Answer: A
Although an individual resize can copy many elements, the total copying cost spreads
across many constant-time appends, yielding amortized O(1) .
Q4. What is the time complexity of finding the maximum element in an unsorted
array of n elements?
A. O(1)
B. O(log n)
C. O(n)
D. O(n²)
,Correct Answer: C
Finding the maximum requires examining each element once to compare and track the
largest value. This results in linear time complexity, O(n) .
Q5. What is the time complexity of accessing the element at index i in an array?
A. O(1)
B. O(log n)
C. O(n)
D. O(n^2)
Correct Answer: A
Arrays provide direct access to any element using its index through pointer arithmetic in
constant time, O(1). This is known as random access .
Q6. A function whose cost scales logarithmically with the input size is:
A. O(n)
B. O(log n)
C. O(n²)
D. O(2^n)
Correct Answer: B
Logarithmic growth occurs when an algorithm repeatedly halves the problem size, such as
binary search .
Q7. An example of a function with quadratic growth is:
A. A single loop
B. A doubly nested loop
, C. A recursive call
D. A hash lookup
Correct Answer: B
A doubly nested loop where both loops iterate over the input size results in O(n²) growth .
Data Structures: Fundamentals
Q8. Which data structure provides O(1) average time complexity for lookups,
insertions, and deletions when using a good hash function?
A. Linked List
B. Array
C. Hash Table
D. Binary Search Tree
Correct Answer: C
Hash Tables provide O(1) average time complexity for lookups, insertions, and deletions,
making them ideal for existence checks of unique elements .
Q9. Which data structure operates on a Last-In-First-Out (LIFO) principle?
A. Queue
B. Stack
C. Linked List
D. Tree
Correct Answer: B
A stack is an abstract data type that follows the LIFO principle. The most recently added
element is the first one to be removed .