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-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 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 development team is designing a program that converts Celsius temperatures to
Fahrenheit. The team lead asks a junior developer to identify the correct formula for this
conversion. The junior developer recalls that the formula involves multiplying by 9/5 and
adding 32. In what order should these operations be applied?
A. Add 32 to the Celsius value first, then multiply by 9/5
B. Multiply the Celsius value by 5/9 first, then add 32 to the result
C. Multiply the Celsius value by 9/5 first, then add 32 to the result
D. Add 32 to the Celsius value first, then multiply by 5/9
Correct Answer: C
Rationale:
The standard formula for converting Celsius to Fahrenheit is F = (C x 9/5) + 32. Multiplication by 9/5 is
performed first, followed by adding 32. Option B reverses the operation order, producing incorrect results.
Option C uses the wrong fraction 5/9, which is the reciprocal needed for the reverse conversion.
Q2 Question 2 of 75
A student is learning about algorithms and encounters a problem that requires sorting a small
list of five numbers. The instructor explains that one simple sorting method repeatedly steps
through the list, compares adjacent elements, and swaps them if they are in the wrong order.
What is the name of this sorting algorithm?
A. Selection sort
B. Insertion sort
C. Merge sort
D. Bubble sort
Correct Answer: D
Rationale:
Bubble sort works by repeatedly stepping through the list, comparing adjacent elements, and swapping them
if they are in the wrong order. This process is repeated until the list is sorted. Selection sort finds the
minimum element and places it at the beginning, while insertion sort builds the sorted list one element at a
time by inserting into the correct position.
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 developer is writing pseudocode for a program and needs to represent a decision point
where the program takes one action if a condition is true and a different action if the condition
is false. What programming construct should the developer use for this purpose?
A. A for loop
B. A while loop
C. An if-else statement
D. A variable assignment
Correct Answer: C
Rationale:
An if-else statement is the fundamental programming construct for implementing conditional branching,
where the program executes one block of code if a condition is true and a different block if it is false. A for
loop and while loop are used for iteration, not conditional branching. A variable assignment stores a value
but does not make decisions.
Q4 Question 4 of 75
A programmer needs to trace the logic of a flowchart that begins with a start symbol, followed
by a process box, then a decision diamond with two branches, and ends with a terminal
symbol. The decision diamond contains the expression 'x > 10'. What does the diamond
shape specifically represent in this flowchart?
A. An input or output operation
B. A process that modifies a variable
C. A conditional test that evaluates to true or false
D. The start or end of the program
Correct Answer: C
Rationale:
In flowchart notation, a diamond shape always represents a decision point where a condition is evaluated
and the flow branches based on whether the result is true or false. Rectangles represent processes,
parallelograms represent input/output, and rounded rectangles or ovals represent start/end terminals.
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 student encounters a problem where a program must compute the factorial of a number n,
defined as n x (n-1) x (n-2) x ... x 1. The student writes a solution where the function calls itself
with a smaller input until it reaches the base case of 1. What programming technique is the
student using?
A. Iteration
B. Polymorphism
C. Recursion
D. Encapsulation
Correct Answer: C
Rationale:
Recursion is a programming technique where a function calls itself with a modified input until it reaches a
base case. The factorial function is a classic example of recursion because f(n) = n * f(n-1). Iteration uses
loops instead of self-calling functions. Polymorphism and encapsulation are object-oriented concepts, not
related to this technique.
Q6 Question 6 of 75
A team of developers is reviewing code quality guidelines. One guideline states that variable
names should be descriptive and reflect the purpose of the variable rather than using
single-letter abbreviations. What principle of programming best practices does this guideline
support?
A. Code execution speed
B. Code readability and maintainability
C. Memory optimization
D. Algorithmic complexity reduction
Correct Answer: B
Rationale:
Descriptive variable names improve code readability by making it clear what each variable represents, which
in turn makes the code easier to maintain and debug. This has no direct impact on execution speed,
memory usage, or algorithmic complexity, which are separate performance considerations.
WGU D278 Scripting and Programming - Foundations - 2026/2027 | Passing Score: 80% | Page 4 of 39