WESTERN GOVERNORS UNIVERSITY
WGU D278 Final Exam Prep
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
INCLUDES DETAILED ANSWERS WITH RATIONALE FOR EVERY QUESTION
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 junior developer is writing a program and notices that the computer executes instructions
one after another in the exact order they appear in the source file. This sequential execution
model is best described as which fundamental programming concept?
A. Sequential execution where statements run in top-to-bottom order
B. Parallel execution where multiple statements run simultaneously
C. Event-driven execution where statements trigger on user actions only
D. Random execution where the interpreter chooses statement order arbitrarily
Correct Answer: A
Rationale:
Sequential execution is the fundamental model in which statements are executed one after another in the
order they appear in the source code. This is the default execution pattern in imperative programming.
Parallel, event-driven, and random execution describe fundamentally different models that require explicit
mechanisms to achieve.
Q2 Question 2 of 75
A student is learning about algorithms and is told that an algorithm must produce the same
output for the same input every time it runs. This property is known as which of the following?
A. Determinism meaning the algorithm always produces consistent and predictable results
B. Randomness meaning the algorithm generates different outputs to explore possibilities
C. Ambiguity meaning the algorithm can interpret inputs in multiple valid ways
D. Parallelism meaning the algorithm splits work across multiple processors simultaneously
Correct Answer: A
Rationale:
Determinism is the property that an algorithm will always produce the same output given the same input,
ensuring predictable and reproducible results. Randomness, ambiguity, and parallelism all describe
properties that are opposite to or inconsistent with the requirement for consistent outputs.
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 software engineer needs to represent a step-by-step procedure for solving a problem before
writing actual code. The engineer draws a flowchart with standard symbols including
rectangles for processes and diamonds for decisions. This visual representation is called
which of the following?
A. A flowchart that visually represents the logical flow and structure of an algorithm
B. Source code that the compiler translates directly into machine instructions
C. A database schema that defines relationships between tables and columns
D. A class diagram that shows object-oriented inheritance hierarchies
Correct Answer: A
Rationale:
A flowchart is a visual diagram that uses standardized symbols such as rectangles for processes and
diamonds for decisions to represent the logical flow of an algorithm. Source code is textual, a database
schema defines data structure, and a class diagram shows object relationships, none of which match the
described visual representation.
Q4 Question 4 of 75
A programmer writes a variable name as 'StudentGrade' where the first letter of each word is
capitalized and the words are joined together. This naming convention is known as which of
the following?
A. PascalCase where each word begins with an uppercase letter and words are concatenated
B. snake_case where words are separated by underscores and all letters are lowercase
C. camelCase where the first word starts lowercase and subsequent words start uppercase
D. kebab-case where words are separated by hyphens and all letters are lowercase
Correct Answer: A
Rationale:
PascalCase capitalizes the first letter of every word and concatenates them without separators, as in
StudentGrade. camelCase is similar but the first word starts with a lowercase letter. snake_case uses
underscores between lowercase words, and kebab-case uses hyphens which are not valid in most
programming language identifiers.
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 development team is discussing how to handle complexity in a large software project. The
lead architect suggests breaking the system into smaller, manageable pieces that can be
developed and tested independently. This approach is best described as which principle?
A. Decomposition where a complex problem is divided into smaller, more manageable
sub-problems
B. Encapsulation where data and methods are bundled together within a single class
C. Polymorphism where a single interface can represent different underlying forms
D. Inheritance where derived classes acquire properties from a parent class
Correct Answer: A
Rationale:
Decomposition is the principle of breaking a complex problem or system into smaller, more manageable
sub-problems that can be developed and tested independently. Encapsulation, polymorphism, and
inheritance are object-oriented programming concepts that address different aspects of software design.
Q6 Question 6 of 75
A programmer encounters a logic error in a program that compiles without any syntax errors
but produces incorrect output. The best way to identify and fix this type of error is which of the
following?
A. Trace through the program logic step by step comparing expected versus actual values
B. Fix all syntax errors first since logic errors cannot exist alongside syntax errors
C. Add more print statements to the source file to make it longer and more comprehensive
D. Rewrite the entire program from scratch because logic errors are irreparable
Correct Answer: A
Rationale:
Logic errors do not produce compilation errors but cause incorrect behavior, so the most effective approach
is to trace through the program step by step comparing expected values to actual values at each point.
Syntax errors are separate from logic errors, adding print statements indiscriminately does not
systematically solve the problem, and rewriting is unnecessary.
WGU D278 Scripting and Programming - Foundations -- 2026/2027 | Passing Score: 80% | Page 4 of 39