WESTERN GOVERNORS UNIVERSITY
WGU D278 Pre-Assessment V2
(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-15
Section 2 Data Types, Variables, and Operators Q16-30
Section 3 Control Structures (Loops and Conditionals) Q31-45
Section 4 Functions and Modular Programming Q46-60
Section 5 Arrays, Lists, and Basic Data Structures Q61-75
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 of 27
,SECTION 1 | Programming Fundamentals and Logic | Q1-Q15 | WGU D278 Scripting and Programming -
Q1. Question 1 of 75
Q1. A software developer is designing a flowchart for a payroll application that must calculate gross pay
from hours worked and hourly rate. The developer uses a rectangular symbol in the flowchart to
represent the step where gross pay is computed. In standard flowchart notation, what does a rectangle
represent?
A. A terminal symbol indicating start or end
B. A decision symbol representing a conditional test
C. A process symbol representing a calculation or action
D. An input/output symbol representing data entry
Correct Answer: C
Rationale:
A rectangle in standard flowchart notation represents a process step such as a calculation, assignment, or
action. The diamond shape is used for decisions, parallelograms for input/output, and rounded rectangles
or ovals for terminals.
Q2. Question 2 of 75
Q2. A student is writing pseudocode for a program that converts Celsius to Fahrenheit using the
formula F = (9/5)*C + 32. The student wants to ensure the conversion logic is clear before coding.
Which principle of algorithm design does this approach best demonstrate?
A. Encapsulation of data within objects
B. Polymorphism through multiple representations
C. Top-down design by planning logic before implementation
D. Inheritance from a base conversion class
Correct Answer: C
Rationale:
Writing pseudocode before actual coding exemplifies top-down design, where the algorithm's logic is
planned at a high level before detailed implementation. Encapsulation, polymorphism, and inheritance are
object-oriented concepts not relevant to this scenario.
Q3. Question 3 of 75
Q3. A programmer reviews a set of step-by-step instructions that detail how to sort a list of student
grades in descending order. These instructions, when written in a programming language, will produce
a working program. What term best describes this ordered set of instructions?
A. A syntax rule
B. A variable declaration
C. A compiler directive
D. An algorithm
Correct Answer: D
Rationale:
An algorithm is a finite, ordered set of well-defined instructions that performs a computation or solves a
problem. Syntax rules govern language grammar, compiler directives instruct the compiler, and variable
declarations allocate storage.
WGU D278 Scripting and Programming - Foundations -- 2026/2027 | Passing Score: 80% | Page 2 of 27
, Q4. Question 4 of 75
Q4. An instructor explains that a particular programming language uses indentation to define code
blocks instead of braces or keywords. A student asks which language follows this convention. Which
language is the instructor most likely referring to?
A. Java
B. C++
C. Ruby
D. Python
Correct Answer: D
Rationale:
Python uses indentation (whitespace) to define code blocks, which is a distinctive feature compared to
Java, C++, and Ruby that use braces or keywords like 'end' to delimit blocks.
Q5. Question 5 of 75
Q5. A developer encounters a syntax error when compiling a program. The compiler reports that a
semicolon is missing at the end of a statement. What type of error does this represent?
A. A syntax error violating language grammar rules
B. A logical error producing incorrect results
C. A runtime error occurring during execution
D. A semantic error with correct syntax but wrong meaning
Correct Answer: A
Rationale:
A missing semicolon violates the grammar rules of the language, making it a syntax error. Logical errors
produce wrong results but do not prevent compilation, runtime errors occur during execution, and semantic
errors involve correct syntax with unintended meaning.
Q6. Question 6 of 75
Q6. A programmer writes a loop that is supposed to sum the values from 1 to 10, but the result is
always 0. Upon inspection, the loop body never executes because the loop condition is false from the
start. What type of error is this?
A. Syntax error
B. Compilation error
C. Runtime error
D. Logical error
Correct Answer: D
Rationale:
A loop that never executes due to an incorrectly written condition is a logical error: the program compiles
and runs but produces incorrect results. There is no syntax or compilation error, and the program does not
crash at runtime.
WGU D278 Scripting and Programming - Foundations -- 2026/2027 | Passing Score: 80% | Page 3 of 27