Objective Assessment Review Full
Questions, Correct Answers, and Worked
Solutions | 2026 Update | 100% Correct.
SECTION 1: ALGORITHMS & ALGORITHM ANALYSIS
(Questions 1-30)
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
executes, setting abs := -x = -(-2) = 2 .
Question 3
What is the final value of product after the following pseudocode runs?
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:
• Iteration 1: count = 5, product = 1 × 5 = 5, count becomes 3
• Iteration 2: count = 3, product = 5 × 3 = 15, count becomes 1
• The loop would execute a third iteration (count = 1), but the condition is checked at
the start. Wait, let me recalculate:
Actually, the loop executes while count > 0:
• Iteration 1: count=5 → product=5, count=3
• Iteration 2: count=3 → product=15, count=1
• Iteration 3: count=1 → product=15, count=-1
• Loop ends (count = -1)
Final product = 15
Question 4
How many iterations will 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
Consider the following pseudocode that merges two lists:
, text
Merge0(List1, List2)
Set OUTlist to empty
While List1 is not empty OR List2 is not empty
If one list is empty and the other is not,
Remove the first number from the non-empty list and add it to OUTlist
If both lists are non-empty,
Remove the first number from List1 and add it to OUTlist
Remove the first number from List2 and add it to OUTlist
Return OUTlist
If ListA = [1, 3, 5] and ListB = [2, 4, 6], what is the result of Merge0(ListA,
Merge0(ListB, ListA))?
A) [1, 2, 3, 4, 5, 6]
B) [1, 2, 3, 1, 5, 4, 3, 6, 5]
C) [2, 1, 4, 3, 6, 5]
D) [2, 4, 6, 1, 3, 5]
Answer: B
Rationale: First compute the inner call: Merge0([2,4,6], [1,3,5]) produces [2,1,4,3,6,5]. Then
the outer call: Merge0([1,3,5], [2,1,4,3,6,5]) produces [1,2,3,1,5,4,3,6,5] .
Question 6
Given the following pseudocode, what is S at the end?
text
S = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}
x = 2
While(x < 11):
For i in S:
If 0 ≡ i mod x and i ≠ x:
delete i from S
end-If
end-For
x = x + 1
end-While