1
WGU D278 FINAL EXAM PREP SCRIPTING AND
PROGRAMMING FOUNDATIONS QS & AS WITH
RATIONALES (SPECIFIC TO 2026-27 SITTING EXAM)
➢ What will this code output?
x = {"a": [1,2], "b": [3]}
x["a"].append(9) print(x)
A. {'a': [1, 2], 'b': [3]}
B. {'a': [1, 2, 9], 'b': [3]}
C. {'a': [9], 'b': [3]}
D. Error
Rationale: Modifying the list under key "a" updates dictionary value.
➢ Which is the correct syntax to create a new exception?
A. raise Exception("error")
B. throw Exception("error")
C. raise Exception("error")
D. error Exception("error")
Rationale: Use raise to raise exceptions in Python.
,2
➢ Which of the following sorts a list L in place?
A. sorted(L)
B. L.sort()
C. sort(L)
D. L.sorted()
Rationale: L.sort() sorts in place; sorted(L) returns a new list.
➢ What will the following print?
print(bool("False"))
A. False
B. True
C. None
D. Error
Rationale: Non-empty strings are truthy; "False" is truthy → True.
➢ How do you write a single-line comment in Python?
A. // comment
B. /* comment */
C. # comment
D. -- comment
Rationale: # starts single-line comments in Python.
➢ Which of the following is NOT a Python built-in sequence type?
A. List
B. Tuple
C. Dictionary
D. String
Rationale: Dictionaries are mapping types, not sequence types.
, 3
WGU D278 FINAL EXAM PREP SCRIPTING AND
PROGRAMMING FOUNDATIONS QS & AS WITH
RATIONALES (SPECIFIC TO 2026-27 SITTING EXAM)
➢ What will this code output?
x = {"a": [1,2], "b": [3]}
x["a"].append(9) print(x)
A. {'a': [1, 2], 'b': [3]}
B. {'a': [1, 2, 9], 'b': [3]}
C. {'a': [9], 'b': [3]}
D. Error
Rationale: Modifying the list under key "a" updates dictionary value.
➢ Which is the correct syntax to create a new exception?
A. raise Exception("error")
B. throw Exception("error")
C. raise Exception("error")
D. error Exception("error")
Rationale: Use raise to raise exceptions in Python.
,2
➢ Which of the following sorts a list L in place?
A. sorted(L)
B. L.sort()
C. sort(L)
D. L.sorted()
Rationale: L.sort() sorts in place; sorted(L) returns a new list.
➢ What will the following print?
print(bool("False"))
A. False
B. True
C. None
D. Error
Rationale: Non-empty strings are truthy; "False" is truthy → True.
➢ How do you write a single-line comment in Python?
A. // comment
B. /* comment */
C. # comment
D. -- comment
Rationale: # starts single-line comments in Python.
➢ Which of the following is NOT a Python built-in sequence type?
A. List
B. Tuple
C. Dictionary
D. String
Rationale: Dictionaries are mapping types, not sequence types.
, 3