WGU D278 MIDTERM EXAM:
SCRIPTING AND PROGRAMMING
FOUNDATIONS QUESTIONS WITH
VERIFIED ANSWERS AND DETAILED
EXPLANATIONS. 2026/2027
1. A developer is analyzing an algorithm that splits a dataset in half during each iteration to
find a target value. If the input size doubles, the number of operations increases by only one.
What is the Big O complexity?
A. O(1)
B. O(log n)
C. O(n)
D. O(n^2)
Answer: B
Conceptual Explanation: Logarithmic time complexity O(log n) occurs when the problem
size is reduced by a constant factor (usually half) in each step.
2. Which phase of the Software Development Life Cycle (SDLC) involves creating flowcharts
and pseudocode before any actual code is written?
A. Design
,B. Analysis
C. Implementation
D. Testing
Answer: A
Conceptual Explanation: The Design phase focuses on the technical architecture,
including algorithms, data structures, and logic flow using tools like pseudocode.
3. Consider a function with a local variable and a global variable of the same name. Which
value is accessed if the name is referenced inside the function?
A. The local variable
B. The global variable
C. A syntax error occurs
D. Both variables are updated simultaneously
Answer: A
Conceptual Explanation: Local scope takes precedence over global scope within the
context of a function; this is often referred to as variable shadowing.
4. In the context of algorithm efficiency, which of the following best describes the ‘worst-
case’ scenario?
A. The minimum time required to execute
B. The average time required for random inputs
, C. The memory space required by the stack
D. The upper bound on the time required for any input of size n
Answer: D
Conceptual Explanation: The worst-case scenario represents the maximum resources
(usually time) an algorithm will ever need for a specific input size.
5. Which of the following is a primary disadvantage of using a compiled language compared
to an interpreted language?
A. Required translation step before execution
B. Easier debugging process
C. Slower execution speed
D. Implicit data typing
Answer: A
Conceptual Explanation: Compiled languages must be fully converted into machine code
by a compiler before they can run, which adds a build step to the workflow.
6. What is the result of the Boolean expression: (NOT (True AND False)) OR (False AND True)?
A. Error
B. False
C. Null
SCRIPTING AND PROGRAMMING
FOUNDATIONS QUESTIONS WITH
VERIFIED ANSWERS AND DETAILED
EXPLANATIONS. 2026/2027
1. A developer is analyzing an algorithm that splits a dataset in half during each iteration to
find a target value. If the input size doubles, the number of operations increases by only one.
What is the Big O complexity?
A. O(1)
B. O(log n)
C. O(n)
D. O(n^2)
Answer: B
Conceptual Explanation: Logarithmic time complexity O(log n) occurs when the problem
size is reduced by a constant factor (usually half) in each step.
2. Which phase of the Software Development Life Cycle (SDLC) involves creating flowcharts
and pseudocode before any actual code is written?
A. Design
,B. Analysis
C. Implementation
D. Testing
Answer: A
Conceptual Explanation: The Design phase focuses on the technical architecture,
including algorithms, data structures, and logic flow using tools like pseudocode.
3. Consider a function with a local variable and a global variable of the same name. Which
value is accessed if the name is referenced inside the function?
A. The local variable
B. The global variable
C. A syntax error occurs
D. Both variables are updated simultaneously
Answer: A
Conceptual Explanation: Local scope takes precedence over global scope within the
context of a function; this is often referred to as variable shadowing.
4. In the context of algorithm efficiency, which of the following best describes the ‘worst-
case’ scenario?
A. The minimum time required to execute
B. The average time required for random inputs
, C. The memory space required by the stack
D. The upper bound on the time required for any input of size n
Answer: D
Conceptual Explanation: The worst-case scenario represents the maximum resources
(usually time) an algorithm will ever need for a specific input size.
5. Which of the following is a primary disadvantage of using a compiled language compared
to an interpreted language?
A. Required translation step before execution
B. Easier debugging process
C. Slower execution speed
D. Implicit data typing
Answer: A
Conceptual Explanation: Compiled languages must be fully converted into machine code
by a compiler before they can run, which adds a build step to the workflow.
6. What is the result of the Boolean expression: (NOT (True AND False)) OR (False AND True)?
A. Error
B. False
C. Null