WGU D278 Comprehensive Final Real Exam
2025 | Scripting and Programming – Foundations
(Full Questions with Answers)
Overview
This comprehensive 2025 WGU D278 Scripting and Programming –
Foundations Practice Exam provides a complete 200-question review designed to
mirror the knowledge and skill areas tested in the official WGU final assessment.
Each question is paired with correct answers in bold and clear Rationales to
ensure strong concept retention and exam readiness.
This updated edition focuses on practical coding proficiency in Python, problem-
solving logic, and the core programming foundations required for success in
software development and scripting environments.
1. What is the output of the following code?
x = 5
y = 10
print(x + y)
A) 15
B) 15
C) 510
D) Error
Rationale: Addition between integers returns their sum, 15.
2. Which of the following is a valid variable name in Python?
,2|Page
A) 2ndName
B) my-name
C) my_name
D) class
Rationale: Variables cannot start with a digit or use hyphens. class is a
reserved keyword.
3. What is the output?
x = "5"
y = 2
print(x * y)
A) 10
B) Error
C) 55
D) '10'
Rationale: String multiplied by integer repeats the string — "5" * 2 = "55".
4. Which data type is immutable in Python?
A) List
B) Dictionary
C) Tuple
D) Set
Rationale: Tuples cannot be changed after creation.
5. What is the correct output?
for i in range(3):
print(i)
,3|Page
A) 1 2 3
B) 0 1 2
C) 0 1 2 3
D) 3
Rationale: range(3) generates 0, 1, 2.
6. Which keyword defines a function in Python?
A) func
B) def
C) define
D) function
Rationale: def is the keyword used to declare a function.
7. What is printed by this code?
def greet(name="Student"):
print("Hello", name)
greet()
A) Error
B) Hello
C) Hello Student
D) Hello None
Rationale: Default argument is used when no argument is passed.
8. What is the output?
nums = [2, 4, 6]
nums.append(8)
print(nums)
, 4|Page
A) [2, 4, 6]
B) [2, 4, 6, 8]
C) [8, 6, 4, 2]
D) [2, 4, 6][8]
Rationale: .append() adds an element to the end of a list.
9. What is the result of bool("")?
A) True
B) False
C) None
D) Error
Rationale: Empty strings evaluate to False in Boolean context.
10. Which symbol is used for integer division in Python?
A) /
B) //
C) %
D) **
Rationale: // returns integer (floor) division results.
11. What is the output of the following code?
x = 3
if x > 2:
print("High")
else:
print("Low")