WGU D278 SCRIPTING AND
PROGRAMMING - FOUNDATIONS
FINAL EXAM PREP QUESTIONS WITH
VERIFIED ANSWERS 2026/2027
1. Which of the following describes a key difference between a compiler and an interpreter?
A. Compilers are generally slower during execution than interpreters.
B. An interpreter produces a standalone executable file, whereas a compiler requires the
source code to run.
C. A compiler translates the entire program into machine code before execution, while an
interpreter translates and executes line by line.
D. Interpreters are only used for low-level languages like Assembly.
Answer: C
Conceptual Explanation: A compiler converts the whole source code into an executable
machine code file at once. An interpreter processes the code statement by statement at
runtime.
2. In Big O notation, what is the time complexity of an algorithm that uses a nested loop to
iterate through a list of size N?
A. O(N)
,B. O(log N)
C. O(N^2)
D. O(1)
Answer: C
Conceptual Explanation: A nested loop where both loops iterate up to N results in N * N
operations, which is quadratic time complexity, represented as O(N^2).
3. Which phase of the Software Development Life Cycle (SDLC) involves defining the
hardware and software architecture of the system?
A. Analysis
B. Design
C. Implementation
D. Testing
Answer: B
Conceptual Explanation: The Design phase focuses on how the system will be built,
including technical specifications, architecture, and data structures.
4. Which logical operator returns true only if exactly one of the two operands is true?
A. AND
B. XOR
, C. NOT
D. OR
Answer: B
Conceptual Explanation: XOR (Exclusive OR) evaluates to true if the inputs are different
(one true, one false) and false if they are the same.
5. What is the main advantage of using a ‘Binary Search’ over a ‘Linear Search’?
A. Binary search is much faster for large, sorted datasets.
B. Binary search works on unsorted lists.
C. Binary search is easier to implement.
D. Binary search uses more memory to improve speed.
Answer: A
Conceptual Explanation: Binary search has a time complexity of O(log N), making it
significantly more efficient than the O(N) linear search for large sorted arrays.
6. In Object-Oriented Programming, what is ‘Encapsulation’?
A. The ability of a function to take many forms.
B. Creating a new class from an existing class.
C. Bundling data and methods that work on that data within a single unit and restricting
access to some components.
PROGRAMMING - FOUNDATIONS
FINAL EXAM PREP QUESTIONS WITH
VERIFIED ANSWERS 2026/2027
1. Which of the following describes a key difference between a compiler and an interpreter?
A. Compilers are generally slower during execution than interpreters.
B. An interpreter produces a standalone executable file, whereas a compiler requires the
source code to run.
C. A compiler translates the entire program into machine code before execution, while an
interpreter translates and executes line by line.
D. Interpreters are only used for low-level languages like Assembly.
Answer: C
Conceptual Explanation: A compiler converts the whole source code into an executable
machine code file at once. An interpreter processes the code statement by statement at
runtime.
2. In Big O notation, what is the time complexity of an algorithm that uses a nested loop to
iterate through a list of size N?
A. O(N)
,B. O(log N)
C. O(N^2)
D. O(1)
Answer: C
Conceptual Explanation: A nested loop where both loops iterate up to N results in N * N
operations, which is quadratic time complexity, represented as O(N^2).
3. Which phase of the Software Development Life Cycle (SDLC) involves defining the
hardware and software architecture of the system?
A. Analysis
B. Design
C. Implementation
D. Testing
Answer: B
Conceptual Explanation: The Design phase focuses on how the system will be built,
including technical specifications, architecture, and data structures.
4. Which logical operator returns true only if exactly one of the two operands is true?
A. AND
B. XOR
, C. NOT
D. OR
Answer: B
Conceptual Explanation: XOR (Exclusive OR) evaluates to true if the inputs are different
(one true, one false) and false if they are the same.
5. What is the main advantage of using a ‘Binary Search’ over a ‘Linear Search’?
A. Binary search is much faster for large, sorted datasets.
B. Binary search works on unsorted lists.
C. Binary search is easier to implement.
D. Binary search uses more memory to improve speed.
Answer: A
Conceptual Explanation: Binary search has a time complexity of O(log N), making it
significantly more efficient than the O(N) linear search for large sorted arrays.
6. In Object-Oriented Programming, what is ‘Encapsulation’?
A. The ability of a function to take many forms.
B. Creating a new class from an existing class.
C. Bundling data and methods that work on that data within a single unit and restricting
access to some components.