Objective Assessment Prep - 2026-2027 | Grade
A | Algorithmic Problem Solving
Each question mapped to official competency and written in WGU’s concise, code-first
style.
Competency 1 – Logic & Algorithmic Thinking (21 Qs)
Q1
Trace the pseudocode:
Copy
SET n ← 6
SET s ← 0
WHILE n > 0
s ← s + n
n ← n - 2
END WHILE
OUTPUT s
Output = ?
A. 12
B. 9
C. 20
D. 0
,Correct: A (12)
Competency: Trace iterative algorithms with numeric accumulators.
Rationale: 6+4+2 = 12; loop stops when n = 0.
Q2
How many comparisons are performed when this linear-search algorithm finds the
value 7 in list [3, 7, 1, 9]?
Copy
FOR i ← 0 TO LENGTH(list)-1
IF list[i] = 7 THEN OUTPUT i
END FOR
A. 1
B. 2
C. 3
D. 4
Correct: B (2)
Competency: Count algorithmic steps (comparisons).
Rationale: Index-0 (3≠7), Index-1 (7=7) → 2 comparisons.
Q3
Which sequence of steps correctly swaps the contents of variables x and y using a
temporary variable?
A. temp ← x; x ← y; y ← temp
,B. x ← y; temp ← x; y ← temp
C. temp ← x; y ← x; x ← temp
D. x ← x + y; y ← x - y; x ← x - y
Correct: A
Competency: Express basic sequential algorithms.
Rationale: Classic three-move sequence; other orders lose original x.
Q4
The algorithm below is intended to output the factorial of n (n!). Which logic error
exists?
Copy
SET result ← 1
FOR i ← 1 TO n
result ← result * i
END FOR
A. Loop should start at 0
B. result should be 0 initially
C. Loop runs one extra iteration
D. No error; algorithm is correct
Correct: D
Competency: Identify logic errors (here, none).
Rationale: 1×1×2×…×n = n!; standard solution.
, Q5
Desk-check the following flowchart fragment (described):
Decision diamond: “x MOD 2 = 0”
True arrow: OUTPUT “even”
False arrow: OUTPUT “odd”
Given x = 9, output = ?
A. even
B. odd
C. null
D. error
Correct: B (odd)
Competency: Interpret flowchart decision symbols.
Rationale: 9 mod 2 = 1 → False branch → “odd”.
Q6
An algorithm sums all integers from 1 to n. Which loop header guarantees correctness
for any positive integer n?
Copy
________
sum ← sum + i
END LOOP