1|Page
WGU D278 OA | OBJECTIVE ASSESSMENT | 200 QUESTIONS
AND ANSWERS | 2026 UPDATE | 100% CORRECT
1. A program receives an integer and must determine whether it is both positive
and evenly divisible by 3. Which Boolean expression correctly represents this
requirement?
A. number > 0 OR number % 3 == 0
B. number >= 0 AND number / 3 == 0
C. number > 0 AND number % 3 == 0
D. number < 0 AND number % 3 != 0
Answer: C. number > 0 AND number % 3 == 0
Rationale: The number must satisfy both conditions. The modulo operator
determines whether division by 3 leaves a remainder of zero.
2. Consider the following pseudocode:
x = 8
y = 3
z = x + y * 2
What is the value of z after execution?
A. 22
B. 14
C. 19
D. 11
Answer: B. 14
Rationale: Multiplication has higher precedence than addition, so y * 2 is
evaluated first: 3 * 2 = 6; then 8 + 6 = 14.
,2|Page
3. A programmer wants a loop to process every integer from 1 through 100 exactly
once. Which design presents the greatest risk of an off-by-one error if the
programmer intends the upper boundary to be included?
A. A loop beginning at 0 and continuing while the counter is less than 100
B. A loop beginning at 1 and continuing while the counter is less than or equal to
100
C. A loop beginning at 1 and stopping after the counter reaches 100
D. A loop beginning at 100 and decrementing until it reaches 1
Answer: A. A loop beginning at 0 and continuing while the counter is less than
100
Rationale: That loop processes 0 through 99 rather than 1 through 100,
demonstrating how boundary selection can produce an off-by-one error.
4. Consider:
total = 0
for i = 1 to 4
total = total + i
end for
What is the final value of total?
A. 6
B. 8
C. 10
D. 12
Answer: C. 10
Rationale: The accumulator receives 1 + 2 + 3 + 4, producing 10.
5. A developer observes that a program repeatedly executes a loop without ever
reaching the statement following the loop. The loop condition depends on a
counter, but the counter is never changed inside the loop. What is the most likely
problem?
,3|Page
A. Type conversion error
B. Infinite loop
C. Syntax error
D. Array indexing error
Answer: B. Infinite loop
Rationale: If the condition remains true because the controlling variable never
changes, the loop may execute indefinitely.
6. Consider:
x = 15
if x > 10
if x < 20
print("A")
else
print("B")
else
print("C")
What is displayed?
A. A
B. B
C. C
D. Nothing
Answer: A. A
Rationale: 15 > 10 is true, so the nested condition is evaluated. 15 < 20 is
also true, resulting in "A".
7. A function is declared as:
calculateAverage(score1, score2, score3)
A programmer calls it as:
, 4|Page
calculateAverage(80, 90)
What type of problem is most directly represented?
A. The function has received too few arguments for its defined parameters.
B. The function contains an infinite loop.
C. The function necessarily has a syntax error.
D. The function is using a Boolean operator incorrectly.
Answer: A. The function has received too few arguments for its defined
parameters.
Rationale: The function definition specifies three parameters, but the call supplies
only two arguments.
8. Which scenario best demonstrates modular programming?
A. Writing an entire application inside one very large function
B. Dividing a complex application into smaller functions that each perform a
specific responsibility
C. Replacing every variable with a constant
D. Removing comments to reduce program size
Answer: B. Dividing a complex application into smaller functions that each
perform a specific responsibility
Rationale: Modular programming decomposes a system into manageable,
reusable, and independently testable components.
9. An array contains:
[14, 7, 22, 9, 31]
If indexing begins at zero, which value is stored at index 3?
A. 7
B. 22
C. 9
D. 31
WGU D278 OA | OBJECTIVE ASSESSMENT | 200 QUESTIONS
AND ANSWERS | 2026 UPDATE | 100% CORRECT
1. A program receives an integer and must determine whether it is both positive
and evenly divisible by 3. Which Boolean expression correctly represents this
requirement?
A. number > 0 OR number % 3 == 0
B. number >= 0 AND number / 3 == 0
C. number > 0 AND number % 3 == 0
D. number < 0 AND number % 3 != 0
Answer: C. number > 0 AND number % 3 == 0
Rationale: The number must satisfy both conditions. The modulo operator
determines whether division by 3 leaves a remainder of zero.
2. Consider the following pseudocode:
x = 8
y = 3
z = x + y * 2
What is the value of z after execution?
A. 22
B. 14
C. 19
D. 11
Answer: B. 14
Rationale: Multiplication has higher precedence than addition, so y * 2 is
evaluated first: 3 * 2 = 6; then 8 + 6 = 14.
,2|Page
3. A programmer wants a loop to process every integer from 1 through 100 exactly
once. Which design presents the greatest risk of an off-by-one error if the
programmer intends the upper boundary to be included?
A. A loop beginning at 0 and continuing while the counter is less than 100
B. A loop beginning at 1 and continuing while the counter is less than or equal to
100
C. A loop beginning at 1 and stopping after the counter reaches 100
D. A loop beginning at 100 and decrementing until it reaches 1
Answer: A. A loop beginning at 0 and continuing while the counter is less than
100
Rationale: That loop processes 0 through 99 rather than 1 through 100,
demonstrating how boundary selection can produce an off-by-one error.
4. Consider:
total = 0
for i = 1 to 4
total = total + i
end for
What is the final value of total?
A. 6
B. 8
C. 10
D. 12
Answer: C. 10
Rationale: The accumulator receives 1 + 2 + 3 + 4, producing 10.
5. A developer observes that a program repeatedly executes a loop without ever
reaching the statement following the loop. The loop condition depends on a
counter, but the counter is never changed inside the loop. What is the most likely
problem?
,3|Page
A. Type conversion error
B. Infinite loop
C. Syntax error
D. Array indexing error
Answer: B. Infinite loop
Rationale: If the condition remains true because the controlling variable never
changes, the loop may execute indefinitely.
6. Consider:
x = 15
if x > 10
if x < 20
print("A")
else
print("B")
else
print("C")
What is displayed?
A. A
B. B
C. C
D. Nothing
Answer: A. A
Rationale: 15 > 10 is true, so the nested condition is evaluated. 15 < 20 is
also true, resulting in "A".
7. A function is declared as:
calculateAverage(score1, score2, score3)
A programmer calls it as:
, 4|Page
calculateAverage(80, 90)
What type of problem is most directly represented?
A. The function has received too few arguments for its defined parameters.
B. The function contains an infinite loop.
C. The function necessarily has a syntax error.
D. The function is using a Boolean operator incorrectly.
Answer: A. The function has received too few arguments for its defined
parameters.
Rationale: The function definition specifies three parameters, but the call supplies
only two arguments.
8. Which scenario best demonstrates modular programming?
A. Writing an entire application inside one very large function
B. Dividing a complex application into smaller functions that each perform a
specific responsibility
C. Replacing every variable with a constant
D. Removing comments to reduce program size
Answer: B. Dividing a complex application into smaller functions that each
perform a specific responsibility
Rationale: Modular programming decomposes a system into manageable,
reusable, and independently testable components.
9. An array contains:
[14, 7, 22, 9, 31]
If indexing begins at zero, which value is stored at index 3?
A. 7
B. 22
C. 9
D. 31