WGU C960 – Discrete Mathematics II
Objective Assessment Review | Full
Questions, Correct Answers, and Worked
Solutions | 2026 Update | 100% Correct.
SECTION 1: ALGORITHMS & ALGORITHM ANALYSIS
Question 1
What is the final value of abs after the following pseudocode is run?
text
x := 2
If (x > 0)
abs := x
Else
abs := -x
End-if
A) -2
B) 0
C) 2
D) 4
Answer: C
,Rationale: The condition (x > 0) evaluates to true because x = 2. The line abs := x is
executed, assigning the value 2 to abs. The Else branch is skipped entirely.
Question 2
What is the final value of abs after the following pseudocode is run?
text
x := -2
If (x > 0)
abs := x
Else
abs := -x
End-if
A) -2
B) 0
C) 2
D) 4
Answer: C
Rationale: The condition (x > 0) evaluates to false because x = -2. The Else branch is
executed, and abs := -x evaluates to -(-2) = 2.
Question 3
What is the final value of product after the following loop completes?
text
product := 1
,count := 5
While (count > 0)
product := product * count
count := count - 2
End-while
A) 3
B) 5
C) 15
D) 30
Answer: C
Rationale: First iteration: count = 5, product = 1 × 5 = 5, count becomes 3. Second
iteration: count = 3, product = 5 × 3 = 15, count becomes 1. Third iteration: count = 1,
product = 15 × 1 = 15, count becomes -1. The loop stops. Final product = 15.
Question 4
How many iterations does the loop in Question 3 execute?
A) 1
B) 2
C) 3
D) 4
Answer: C
Rationale: Count values: 5, 3, 1. Each time count > 0, the loop executes. When count
becomes -1, the condition count > 0 is false. The loop executes 3 iterations.
, Question 5
What is the worst-case time complexity of a nested loop where the outer loop runs n
times and the inner loop runs n times?
A) O(n)
B) O(n log n)
C) O(n²)
D) O(2ⁿ)
Answer: C
Rationale: A nested loop with both loops running n times has O(n²) time complexity.
This is a classic quadratic growth pattern. Total iterations = n × n = n².
Question 6
What is the asymptotic behavior of f(n) = 5n + 12?
A) n
B) 5n
C) 12
D) n²
Answer: A
Rationale: Drop the constant multiplier 5 and the constant term 12. The fastest-growing
term is n. Therefore, f(n) = Θ(n).
Question 7
Objective Assessment Review | Full
Questions, Correct Answers, and Worked
Solutions | 2026 Update | 100% Correct.
SECTION 1: ALGORITHMS & ALGORITHM ANALYSIS
Question 1
What is the final value of abs after the following pseudocode is run?
text
x := 2
If (x > 0)
abs := x
Else
abs := -x
End-if
A) -2
B) 0
C) 2
D) 4
Answer: C
,Rationale: The condition (x > 0) evaluates to true because x = 2. The line abs := x is
executed, assigning the value 2 to abs. The Else branch is skipped entirely.
Question 2
What is the final value of abs after the following pseudocode is run?
text
x := -2
If (x > 0)
abs := x
Else
abs := -x
End-if
A) -2
B) 0
C) 2
D) 4
Answer: C
Rationale: The condition (x > 0) evaluates to false because x = -2. The Else branch is
executed, and abs := -x evaluates to -(-2) = 2.
Question 3
What is the final value of product after the following loop completes?
text
product := 1
,count := 5
While (count > 0)
product := product * count
count := count - 2
End-while
A) 3
B) 5
C) 15
D) 30
Answer: C
Rationale: First iteration: count = 5, product = 1 × 5 = 5, count becomes 3. Second
iteration: count = 3, product = 5 × 3 = 15, count becomes 1. Third iteration: count = 1,
product = 15 × 1 = 15, count becomes -1. The loop stops. Final product = 15.
Question 4
How many iterations does the loop in Question 3 execute?
A) 1
B) 2
C) 3
D) 4
Answer: C
Rationale: Count values: 5, 3, 1. Each time count > 0, the loop executes. When count
becomes -1, the condition count > 0 is false. The loop executes 3 iterations.
, Question 5
What is the worst-case time complexity of a nested loop where the outer loop runs n
times and the inner loop runs n times?
A) O(n)
B) O(n log n)
C) O(n²)
D) O(2ⁿ)
Answer: C
Rationale: A nested loop with both loops running n times has O(n²) time complexity.
This is a classic quadratic growth pattern. Total iterations = n × n = n².
Question 6
What is the asymptotic behavior of f(n) = 5n + 12?
A) n
B) 5n
C) 12
D) n²
Answer: A
Rationale: Drop the constant multiplier 5 and the constant term 12. The fastest-growing
term is n. Therefore, f(n) = Θ(n).
Question 7