EXAMINATION DOCUMENT 2026/2027
D278 Scripting and Programming Foundations
Exam 2 2026/2027 - Control Structures Loops Functions Mastery
210 Q&A - A+ Graded - Latest Update This Year
Just Released - Verified Solutions - Pass Guaranteed
A+ VERIFIED
WGU D278
Focus: if else switch, loops for while, break continue, functions methods parameters return scope, modular programming
, TABLE OF CONTENTS
1. Section 1: Conditional Control Structures (Q1-40) - if, else, elif, switch, ternary, truthy/falsy, logical
operators
2. Section 2: Iterative Structures - For & While Loops (Q41-85) - range, sentinel, off-by-one, nested
loops, complexity
3. Section 3: Loop Interruption - Break & Continue Mastery (Q86-120) - break search, continue filter,
nested break
4. Section 4: Functions, Methods, Parameters, Return & Scope (Q121-175) - return vs print, LEGB,
closures, *args
5. Section 5: Modular Programming & Code Organization (Q176-210) - cohesion, coupling, import
system, DRY, API design
, D278 Exam 2 - Control Loops - {'A': 53, 'B': 53, 'C': 52, 'D': 52} Balanced
Distribution
1. [IF-ELSE-SWITCH - if-else evaluation] Scenario: For D278 control structures, consider
code involving if-else evaluation where input value is 3. Evaluate execution flow, variable
updates, and output prediction. Which statement correctly describes if-else evaluation
behavior under WGU OA exam conditions?
A. Correct. A conditional executes one branch based on boolean expression. If true, if block runs;
otherwise else block. This correctly handles if-else evaluation edge cases and expected OA logic.
B. Incorrect: Assumes misinterpreting fall-through, off-by-one, or scope that would cause logic error in
if-else evaluation scenario (Option B).
C. Incorrect: Assumes misinterpreting fall-through, off-by-one, or scope that would cause logic error in
if-else evaluation scenario (Option C).
D. Incorrect: Assumes misinterpreting fall-through, off-by-one, or scope that would cause logic error in
if-else evaluation scenario (Option D).
Correct Answer: A
Rationale: The correct choice is A because A conditional executes one branch based on boolean expression. If true, if
block runs; otherwise else block. In programming fundamentals, this behavior aligns with how if-else evaluation is
evaluated at runtime. The misinterpreting fall-through, off-by-one, or scope options fail since they misinterpret initialization
condition update and scope chain. This distinction is critical for WGU D278 as it tests precise understanding of control
flow, scope, and modular design principles used in both Python and JavaScript.
2. [IF-ELSE-SWITCH - switch fall-through] Scenario: For D278 control structures, consider
code involving switch fall-through where input value is 6. Evaluate execution flow, variable
updates, and output prediction. Which statement correctly describes switch fall-through
behavior under WGU OA exam conditions?
A. Incorrect: Assumes misinterpreting fall-through, off-by-one, or scope that would cause logic error in
switch fall-through scenario (Option A).
B. Correct. Switch evaluates expression once then jumps to matching case without break fall-through
executes next cases. This correctly handles switch fall-through edge cases and expected OA logic.
C. Incorrect: Assumes misinterpreting fall-through, off-by-one, or scope that would cause logic error in
switch fall-through scenario (Option C).
D. Incorrect: Assumes misinterpreting fall-through, off-by-one, or scope that would cause logic error in
switch fall-through scenario (Option D).
Correct Answer: B
Rationale: The correct choice is B because Switch evaluates expression once then jumps to matching case without break
fall-through executes next cases. In programming fundamentals, this behavior aligns with how switch fall-through is
evaluated at runtime. The misinterpreting fall-through, off-by-one, or scope options fail since they misinterpret initialization
condition update and scope chain. This distinction is critical for WGU D278 as it tests precise understanding of control
flow, scope, and modular design principles used in both Python and JavaScript. WGU D278 emphasizes tracing,
desk-check, understanding Python JS differences, scope lifetime, parameter passing, return semantics, and modular
decomposition for maintainability and testability.
3. [IF-ELSE-SWITCH - truthy falsy] Scenario: For D278 control structures, consider code
involving truthy falsy where input value is 9. Evaluate execution flow, variable updates, and
output prediction. Which statement correctly describes truthy falsy behavior under WGU OA