WESTERN GOVERNORS UNIVERSITY
WGU D278 Scripting and Programming - Foundations (Latest 2026/2027
Update) | Questions and Verified Answers| 100% Correct| Grade A
2026/2027 Edition -- Official Exam 2026/2027
75 80% N/A
QUESTIONS PASSING SCORE RECERTIFICATION
TABLE OF CONTENTS
Section 1 Programming Fundamentals and Logic Q1-Q15
Section 2 Data Types, Variables, and Operators Q16-Q30
Section 3 Control Structures (Loops and Conditionals) Q31-Q45
Section 4 Functions and Modular Programming Q46-Q60
Section 5 Arrays, Lists, and Basic Data Structures Q61-Q75
Instructions: Select the single best answer for each question. This exam is designed for WGU D278 Scripting and
Programming - Foundations certification preparation. Passing score: 80% (60 questions correct).
WGU D278 Scripting and Programming - Foundations -- 2026/2027 | Passing Score: 80% | Page 1
,SECTION 1 | Programming Fundamentals and Logic | Q1-Q15 | WGU D278 Scripting and Programming - Foundations 2026/2027
Q1 Question 1 of 75
Q1. A software developer is designing a program that converts temperatures from Fahrenheit to Celsius. The
developer writes out the step-by-step process before coding. This planning technique is known as creating what
type of document?
A. An algorithm, which is a finite set of unambiguous steps that solve a problem in a defined sequence
B. A compiler, which automatically translates the problem into executable machine code
C. A syntax diagram, which visually represents the grammar rules of the programming language
D. A debugger, which traces through code execution to identify logical errors
Correct Answer: A
Rationale:
An algorithm is a step-by-step procedure for solving a problem, and writing one before coding is a fundamental planning
technique. A compiler translates code but does not plan solutions, and a debugger finds errors after code is written.
Q2 Question 2 of 75
Q2. A student is learning about programming paradigms and encounters a language where the program is
structured as a sequence of instructions that execute in order. The student is working with which type of
programming paradigm?
A. The functional paradigm, where programs are composed of pure mathematical functions
B. The object-oriented paradigm, where programs model real-world entities as objects
C. The procedural paradigm, where programs are structured as sequences of executable statements
D. The declarative paradigm, where programs describe what should be computed rather than how
Correct Answer: C
Rationale:
Procedural programming organizes code as a linear sequence of statements executed in order. Functional programming
uses pure functions, object-oriented programming uses objects and classes, and declarative programming describes
outcomes rather than steps.
Q3 Question 3 of 75
Q3. A programmer encounters an error where the code runs without crashing but produces incorrect output. The
programmer reviews the logic and realizes the comparison operator was written as an assignment. What type of
error is this?
A. A syntax error, because the assignment operator cannot be used in a comparison context
B. A runtime error, because the program will eventually crash when the wrong value is accessed
C. A logical error, because the code compiles and runs but produces incorrect results due to flawed logic
D. A compilation error, because the compiler rejects the use of assignment in conditional statements
Correct Answer: C
WGU D278 Scripting and Programming - Foundations -- 2026/2027 | Passing Score: 80% | Page 2
, Rationale:
A logical error occurs when code compiles and runs without crashing but produces incorrect results because the algorithm or
logic is wrong. Syntax errors and compilation errors prevent code from running, while runtime errors cause the program to
crash during execution.
Q4 Question 4 of 75
Q4. A development team is reviewing a program and finds that variable names like x, y1, and temp make the
code difficult to understand. Which programming principle has been violated?
A. Code readability, because meaningful variable names make code easier to understand and maintain
B. Encapsulation, because the variables should be hidden inside classes
C. Polymorphism, because variables should be able to hold different data types
D. Inheritance, because variables should derive their names from parent classes
Correct Answer: A
Rationale:
Using descriptive variable names is a fundamental principle of code readability and maintainability. Encapsulation,
polymorphism, and inheritance are object-oriented concepts that are unrelated to variable naming conventions.
Q5 Question 5 of 75
Q5. A programmer writes pseudocode for a sorting algorithm and then translates it into Python. The pseudocode
serves which primary purpose in the software development process?
A. It serves as executable code that the interpreter can run directly without translation
B. It automatically generates test cases for verifying the correctness of the implementation
C. It compiles into machine code more efficiently than the actual programming language
D. It provides a language-independent representation of the algorithm that humans can easily read and
understand
Correct Answer: D
Rationale:
Pseudocode is a human-readable, language-independent way to express algorithms before implementation. It cannot be
executed by an interpreter or compiler, and it does not generate test cases or compile to machine code.
Q6 Question 6 of 75
Q6. A student is tracing through a program and encounters the expression 5 + 3 * 2. The student evaluates it as
16, but the computer returns 11. Which concept explains the difference between these results?
A. Type coercion, because the numbers are automatically converted to floating-point values
B. Short-circuit evaluation, because the second operand is skipped when the first is true
C. Integer overflow, because the result exceeds the maximum value for integer storage
D. Operator precedence, because multiplication is evaluated before addition in standard arithmetic order
Correct Answer: D
WGU D278 Scripting and Programming - Foundations -- 2026/2027 | Passing Score: 80% | Page 3