WESTERN GOVERNORS UNIVERSITY
WGU D278 Final Exam Prep
(Latest 2026/2027 Update) Scripting and Programming - Foundations
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 -
WGU D278 Scripting and Programming - Foundations - 2026/2027 | Passing Score: 80% | Page 1 of 39
,SECTION 1 | Programming Fundamentals and Logic | Q1-Q15 | WGU D278 Scripting and Programming - Foundations 2026/2027
Q1 Question 1 of 75
A software developer is writing a program that processes user input and produces formatted
output. The developer describes the solution as a sequence of steps that transform input into
output. What term best describes this step-by-step procedure?
A. A. Algorithm
B. B. Syntax
C. C. Variable
D. D. Compiler
Correct Answer: A
Rationale:
An algorithm is a finite, step-by-step procedure for solving a problem or performing a computation. Syntax
refers to the rules governing the structure of code in a programming language, not the logical steps. A
variable stores data, and a compiler translates source code into machine code.
Q2 Question 2 of 75
A student is learning about how computers execute programs. The instructor explains that
source code must be converted into machine code before the processor can run it. What type
of software performs this conversion for languages like C and C++?
A. A. Interpreter
B. B. Compiler
C. C. Debugger
D. D. Linker
Correct Answer: B
Rationale:
A compiler translates the entire source code of a compiled language like C or C++ into machine code before
execution. An interpreter executes code line by line without producing a standalone machine-code file. A
debugger helps find errors, and a linker combines object files but does not perform the initial translation.
WGU D278 Scripting and Programming - Foundations - 2026/2027 | Passing Score: 80% | Page 2 of 39
,SECTION 1 | Programming Fundamentals and Logic | Q1-Q15 | WGU D278 Scripting and Programming - Foundations 2026/2027
Q3 Question 3 of 75
A programmer is designing a solution and draws a diagram using oval shapes for start and
end, rectangles for processes, and diamonds for decisions. What type of diagram is the
programmer creating?
A. A. UML class diagram
B. B. Entity-relationship diagram
C. C. Flowchart
D. D. Network topology diagram
Correct Answer: C
Rationale:
A flowchart uses ovals for terminals (start/end), rectangles for processes, and diamonds for decisions to
visually represent an algorithm. UML class diagrams show object-oriented class structures,
entity-relationship diagrams model database schemas, and network topology diagrams illustrate network
connections.
Q4 Question 4 of 75
A developer encounters a situation where the program compiles successfully but produces
incorrect output when given specific inputs. What type of error is this?
A. A. Syntax error
B. B. Runtime error
C. C. Compilation error
D. D. Logic error
Correct Answer: D
Rationale:
A logic error occurs when a program compiles and runs without crashing but produces incorrect results due
to flawed reasoning in the code. Syntax errors and compilation errors prevent the program from compiling.
Runtime errors cause the program to crash during execution, not to produce wrong output.
WGU D278 Scripting and Programming - Foundations - 2026/2027 | Passing Score: 80% | Page 3 of 39
,SECTION 1 | Programming Fundamentals and Logic | Q1-Q15 | WGU D278 Scripting and Programming - Foundations 2026/2027
Q5 Question 5 of 75
A team lead is reviewing a colleague's code and notices that variable names like x, y1, and
temp are used throughout. The lead recommends renaming them to studentCount, totalScore,
and maxTemperature. What principle is the lead emphasizing?
A. A. Self-documenting code
B. B. Code obfuscation
C. C. Encapsulation
D. D. Polymorphism
Correct Answer: A
Rationale:
Self-documenting code uses descriptive variable and function names that clearly convey their purpose,
reducing the need for separate comments. Code obfuscation deliberately makes code harder to read.
Encapsulation hides internal state, and polymorphism allows objects to take multiple forms.
Q6 Question 6 of 75
A programmer writes a program that reads a temperature value and needs to categorize it as
cold, mild, or hot. Before writing any code, the programmer creates a table showing all
possible input ranges and their corresponding outputs. What phase of program development
does this represent?
A. A. Testing
B. B. Design
C. C. Debugging
D. D. Deployment
Correct Answer: B
Rationale:
Creating a mapping of inputs to outputs before coding is part of the design phase, where the programmer
plans the logic and structure of the solution. Testing involves verifying the completed program works
correctly. Debugging fixes errors found during testing. Deployment distributes the finished program.
WGU D278 Scripting and Programming - Foundations - 2026/2027 | Passing Score: 80% | Page 4 of 39