WGU D278 OBJECTIVE ASSESSMENT (LATEST 2026/2027)
ACTUAL EXAM QUESTIONS AND CORRECT DETAILED
ANSWERS (100% VERIFIED ANSWERS) | ALREADY
GRADED A+ | D278 OA | GUARANTEED PASS
1|Page
,WGU D278 OBJECTIVE ASSESSMENT
Scripting and Programming - Foundations
2026/2027 Examination
Total Questions: 200
Instructions:
• Answer all questions.
• Select the single best answer.
• Each question has four answer choices: A, B, C, and D.
• Select only ONE answer for each question.
SECTION 1: Programming Fundamentals and Logic
Questions 1–25
Q1. A programmer needs to create a variable that will store a student's grade point average,
which can include decimal values such as 3.75. Which data type is most appropriate for this variable?
A. Integer
B. String
C. Boolean
D. Float
Correct Answer: D. Float
Rationale: A float (floating-point) data type is designed to store numbers that contain fractional
or decimal components. Since a GPA like 3.75 requires decimal precision, float is the correct choice.
Integer would truncate the decimal portion, string would store it as text (preventing mathematical
operations), and boolean only stores true/false values.
Q2. Consider the following pseudocode:
text
x = 10
y=4
z=x%y
What value is stored in variable z?
A. 2.5
B. 2
2|Page
,C. 40
D. 0
Correct Answer: B. 2
Rationale: The modulo operator (%) returns the remainder after integer division. When 10 is
divided by 4, the quotient is 2 and the remainder is 2, so z receives the value 2. Choice A represents
the floating-point result of normal division, C is the product of multiplication, and D would only
occur if x were evenly divisible by y.
Q3. A developer is writing a program that must repeatedly ask the user for input until the user
enters a specific sentinel value. The program must execute the input prompt at least once before
checking the condition. Which loop structure is most appropriate?
A. For loop
B. While loop
C. Do-while loop
D. Nested loop
Correct Answer: C. Do-while loop
Rationale: A do-while loop executes its body first and then evaluates the condition, guaranteeing
at least one execution. This matches the requirement that the input prompt must appear before any
condition check. A while loop checks the condition before executing, a for loop is designed for a
known number of iterations, and a nested loop simply refers to a loop within another loop without
addressing the "execute at least once" requirement.
Q4. What is the primary purpose of using pseudocode during program development?
A. To execute the program directly without compilation
B. To test the program's performance under load
C. To plan the logic of a solution in a language-independent format
D. To replace the need for documentation entirely
Correct Answer: C. To plan the logic of a solution in a language-independent format
Rationale: Pseudocode allows programmers to outline the logic and sequence of operations
without being constrained by the syntax of any specific programming language. It serves as a
planning and communication tool. Pseudocode cannot be executed directly (A), is not used for
performance testing (B), and does not eliminate the need for documentation (D).
Q5. Which of the following best describes the difference between a syntax error and a logic
error?
A. Syntax errors occur at runtime; logic errors prevent compilation
B. Syntax errors violate language rules and prevent execution; logic errors allow execution but
produce incorrect results
3|Page
, C. Logic errors are always caught by the compiler; syntax errors are not
D. Syntax errors can only occur in compiled languages; logic errors only in interpreted languages
Correct Answer: B. Syntax errors violate language rules and prevent execution; logic errors allow
execution but produce incorrect results
Rationale: A syntax error breaks the grammatical rules of the language and stops the program
from compiling or running. A logic error, by contrast, allows the program to run successfully but the
output or behavior is incorrect due to flawed reasoning in the algorithm. Choice A reverses the
definitions, C is incorrect because compilers typically catch syntax errors rather than logic errors, and
D falsely restricts error types to specific language categories.
Q6. A program contains the following expression:
text
result = 7 + 3 * 2 -
Following standard operator precedence, what is the value of result?
A. 16
B. 11
C. 9
D. 6
Correct Answer: B. 11
Rationale: Multiplication and division are evaluated before addition and subtraction. First, 3 * 2
= 6 and = 2. The expression simplifies to 7 + 6 - 2 = 11. Choice A would result from strictly left-
to-right evaluation, C from incorrect precedence assumptions, and D from evaluating all operations
as if grouped differently.
Q7. What is the primary function of a variable in a program?
A. To permanently store data that cannot be changed
B. To provide a named storage location whose value can be modified during execution
C. To define the structure of a database
D. To translate source code into machine language
Correct Answer: B. To provide a named storage location whose value can be modified during
execution
Rationale: Variables serve as named containers for data, and their values can be reassigned
throughout program execution. Choice A describes a constant rather than a variable, C refers to
database schema design, and D describes a compiler's function, not a variable's purpose.
4|Page
ACTUAL EXAM QUESTIONS AND CORRECT DETAILED
ANSWERS (100% VERIFIED ANSWERS) | ALREADY
GRADED A+ | D278 OA | GUARANTEED PASS
1|Page
,WGU D278 OBJECTIVE ASSESSMENT
Scripting and Programming - Foundations
2026/2027 Examination
Total Questions: 200
Instructions:
• Answer all questions.
• Select the single best answer.
• Each question has four answer choices: A, B, C, and D.
• Select only ONE answer for each question.
SECTION 1: Programming Fundamentals and Logic
Questions 1–25
Q1. A programmer needs to create a variable that will store a student's grade point average,
which can include decimal values such as 3.75. Which data type is most appropriate for this variable?
A. Integer
B. String
C. Boolean
D. Float
Correct Answer: D. Float
Rationale: A float (floating-point) data type is designed to store numbers that contain fractional
or decimal components. Since a GPA like 3.75 requires decimal precision, float is the correct choice.
Integer would truncate the decimal portion, string would store it as text (preventing mathematical
operations), and boolean only stores true/false values.
Q2. Consider the following pseudocode:
text
x = 10
y=4
z=x%y
What value is stored in variable z?
A. 2.5
B. 2
2|Page
,C. 40
D. 0
Correct Answer: B. 2
Rationale: The modulo operator (%) returns the remainder after integer division. When 10 is
divided by 4, the quotient is 2 and the remainder is 2, so z receives the value 2. Choice A represents
the floating-point result of normal division, C is the product of multiplication, and D would only
occur if x were evenly divisible by y.
Q3. A developer is writing a program that must repeatedly ask the user for input until the user
enters a specific sentinel value. The program must execute the input prompt at least once before
checking the condition. Which loop structure is most appropriate?
A. For loop
B. While loop
C. Do-while loop
D. Nested loop
Correct Answer: C. Do-while loop
Rationale: A do-while loop executes its body first and then evaluates the condition, guaranteeing
at least one execution. This matches the requirement that the input prompt must appear before any
condition check. A while loop checks the condition before executing, a for loop is designed for a
known number of iterations, and a nested loop simply refers to a loop within another loop without
addressing the "execute at least once" requirement.
Q4. What is the primary purpose of using pseudocode during program development?
A. To execute the program directly without compilation
B. To test the program's performance under load
C. To plan the logic of a solution in a language-independent format
D. To replace the need for documentation entirely
Correct Answer: C. To plan the logic of a solution in a language-independent format
Rationale: Pseudocode allows programmers to outline the logic and sequence of operations
without being constrained by the syntax of any specific programming language. It serves as a
planning and communication tool. Pseudocode cannot be executed directly (A), is not used for
performance testing (B), and does not eliminate the need for documentation (D).
Q5. Which of the following best describes the difference between a syntax error and a logic
error?
A. Syntax errors occur at runtime; logic errors prevent compilation
B. Syntax errors violate language rules and prevent execution; logic errors allow execution but
produce incorrect results
3|Page
, C. Logic errors are always caught by the compiler; syntax errors are not
D. Syntax errors can only occur in compiled languages; logic errors only in interpreted languages
Correct Answer: B. Syntax errors violate language rules and prevent execution; logic errors allow
execution but produce incorrect results
Rationale: A syntax error breaks the grammatical rules of the language and stops the program
from compiling or running. A logic error, by contrast, allows the program to run successfully but the
output or behavior is incorrect due to flawed reasoning in the algorithm. Choice A reverses the
definitions, C is incorrect because compilers typically catch syntax errors rather than logic errors, and
D falsely restricts error types to specific language categories.
Q6. A program contains the following expression:
text
result = 7 + 3 * 2 -
Following standard operator precedence, what is the value of result?
A. 16
B. 11
C. 9
D. 6
Correct Answer: B. 11
Rationale: Multiplication and division are evaluated before addition and subtraction. First, 3 * 2
= 6 and = 2. The expression simplifies to 7 + 6 - 2 = 11. Choice A would result from strictly left-
to-right evaluation, C from incorrect precedence assumptions, and D from evaluating all operations
as if grouped differently.
Q7. What is the primary function of a variable in a program?
A. To permanently store data that cannot be changed
B. To provide a named storage location whose value can be modified during execution
C. To define the structure of a database
D. To translate source code into machine language
Correct Answer: B. To provide a named storage location whose value can be modified during
execution
Rationale: Variables serve as named containers for data, and their values can be reassigned
throughout program execution. Choice A describes a constant rather than a variable, C refers to
database schema design, and D describes a compiler's function, not a variable's purpose.
4|Page