OBJECTIVE ASSESSMENT - EXAM
WGU D278 Final Exam Prep (Latest
Update 2026/2027) Scripting and
Programming - Foundations |
Questions and Verified Answers |
100% Correct | Grade A 2026/2027
QUESTIONS: 75 VERIFIED ANSWERS: 75 EDITION: 2026/2027 EditionPASSING: 8
TOPICS COVERED
• Programming Logic & Flowcharts • Functions, Recursion & Scope
• Pseudocode & Algorithm Design • Arrays, Stacks, Queues & Hash Tables
• Compiled vs Interpreted Languages • Sorting, Searching & Merge Algorithms
• Variables, Constants & Data Types • String Parsing & Manipulation
• Operator Precedence & Type Casting • Classes, Objects & Inheritance
• Short-Circuit Evaluation • Encapsulation, Polymorphism & Interfaces
• If-Else, Switch & Ternary Operators • File I/O & Exception Handling
• Loops: For, While, Do-While • Debugging, Unit Testing & Version Control
COVER PAGE - 1
,Section 1: Programming Fundamentals, Logic & Problem Solving
Q1.
A junior developer is tasked with writing a program that calculates the total cost of items in a shopping cart,
including tax. The developer begins by breaking the problem into smaller steps: input item prices, sum them,
apply tax rate, and output the final amount.
A. The developer is using top-down design to decompose a complex problem into manageable
sub-problems.
B. The developer is performing code refactoring to improve runtime performance.
C. The developer is implementing object inheritance to reuse existing classes.
D. The developer is applying recursion to solve the calculation repeatedly.
Correct Answer: A
Rationale:
Breaking a problem into smaller, manageable steps is the essence of top-down design and algorithmic decomposition.
Option B confuses planning with refactoring.
Q2.
A software team is reviewing a flowchart for a login system. The flowchart contains a diamond shape that
checks whether the entered password matches the stored hash.
A. The diamond shape represents a decision point where the program flow branches based on a true
or false condition.
B. The diamond shape indicates a loop that will repeat until the password is correct.
C. The diamond shape is a process step that encrypts the password before storage.
D. The diamond shape represents the start or end of the program execution.
Correct Answer: A
Rationale:
In flowcharts, diamonds universally represent decision points with yes/no or true/false branches. Option B confuses
decisions with loops.
Q3.
A student is learning about pseudocode and writes the following: 'SET total TO 0. FOR each item IN cart,
ADD item price TO total. DISPLAY total.' The instructor reviews this pseudocode.
A. The pseudocode correctly uses sequential and iterative structures to describe an algorithm without
language-specific syntax.
B. The pseudocode contains a syntax error because 'FOR' is not a valid keyword in any programming
language.
C. The pseudocode will fail because it does not declare variable types before use.
D. The pseudocode is actually Python code and can be executed directly by the interpreter.
, WGU D278 Final Exam Prep (Latest Update 2026/2027) Scripting and Programming - Foundations...
Correct Answer: A
Rationale:
Pseudocode is language-agnostic and uses plain English structures to describe algorithms. Option B incorrectly applies
programming language syntax rules to pseudocode.
Q4.
A programmer needs to determine whether a user-input year is a leap year. The algorithm must check if the
year is divisible by 4, but not by 100 unless also divisible by 400.
A. The programmer must use nested conditional logic with modulo operators to evaluate the leap year
rules correctly.
B. A simple check for divisibility by 4 is sufficient for all years in the Gregorian calendar.
C. The programmer should use a random number generator to approximate leap year probability.
D. Leap years occur every 4 years without exception, so no additional logic is needed.
Correct Answer: A
Rationale:
Leap year rules require checking divisibility by 4, 100, and 400 with nested conditions. Option B misses the century
exception.
Q5.
A development team is designing a program to validate email addresses. They create a table listing all
possible valid and invalid email formats, then derive rules from the patterns.
A. The team is using truth tables to systematically evaluate all possible input combinations and
determine correct validation logic.
B. The team is performing unit testing by executing the program with each email address.
C. The team is compiling the source code into machine language before validation.
D. The team is applying machine learning to automatically classify email formats.
Correct Answer: A
Rationale:
Listing all possible cases to derive logic rules is characteristic of truth table analysis. Option B confuses design-time
planning with runtime testing.