OBJECTIVE ASSESSMENT | OA V1 AND V2 | PRACTICE
QUESTIONS AND ANSWERS | 2026 STUDY GUIDE | 100%
CORRECT.
89 Questions with Answers and Detailed Rationales
100 PERCENT GUARANTEED PASS
INSTANT DOWNLOAD ANSWERS INCLUDED
IMPORTANCE OF THIS DOCUMENT
This comprehensive examination preparation guide has been meticulously developed to help you succeed in the
WGU E010 FOUNDATIONS OF PROGRAMMING (PYTHON) OBJECTIVE ASSESSMENT | OA V1 AND V2 |
PRACTICE QUESTIONS AND ANSWERS | 2026 STUDY GUIDE | 100% CORRECT.. It contains 89 carefully
selected questions that reflect the most current exam content and testing strategies. Each question is
accompanied by a correct answer and a detailed rationale that explains the underlying pathophysiology,
pharmacology, or clinical reasoning.
Self-Assessment – Test your knowledge and Exam Preparation – Familiarize yourself with the
identify areas requiring further question format and content
study areas
Concept Reinforcement – Deepen your Confidence Building – Develop test-taking
understanding through strategies and reduce
evidence-based exam anxiety
rationales
Time Management – Practice answering
questions under simulated
exam conditions
Review Summary 89 Questions
Foundations - Application - WGU E010 Foundations OF Programming Python Objective Assessment OA
V1 AND V2 AND 2026 Study Guide 100 Correct Computer Science / Python Programming Undergraduate
YEAR 1-2 Introductory Programming
All answers with rationales
,Table of Contents
Content Area Questions Key Topics
Basic Python Syntax AND 1-15 Print, Output, Python, Return, INIT SELF
Semantics
Control FLOW Conditionals 16-30 Python, Return, Numbers, Print, Primary Purpose
AND Loops
DATA Structures Lists Tuples 31-45 Print, Result, Return, Output, CHAR
Dictionaries SETS
Functions AND Scope 46-60 INIT SELF, Output, Print, Consider, Return
FILE Input/output 61-75 Python, Print, Return, Correctly, Output
Exception Handling 76-89 Output, Return, Print, Result, NEW CLS NAME
TOTAL 89 All questions include answers and detailed rationales
,Section A - Basic Python Syntax AND Semantics
Q1.
In Python, which of the following statements about variable scoping and the 'global'
keyword is correct when a variable is assigned inside a nested function?
A. The 'global' keyword allows modifying a B. Without 'global' or 'nonlocal', an
variable in the nearest enclosing non-global assignment inside a nested function always
scope. creates a new local variable, even if a
variable with the same name exists in the
enclosing scope.
C. The 'nonlocal' keyword is required to read D. If a variable is declared 'global' inside a
a variable from an enclosing function's nested function, it becomes accessible to all
scope. functions in the module, including other
nested functions.
Correct: B - Without 'global' or 'nonlocal', an assignment inside a nested function always
creates a new local variable, even if a variable with the same name exists in the enclosing
scope.
Rationale:In Python, assignment to a name in a function (including nested) makes that name
local to that function unless explicitly declared global or nonlocal. Reading a variable from an
enclosing scope does not require nonlocal; only assignment does. Global makes the name
refer to a module-level variable, but it does not make it accessible to other nested functions
as a nonlocal. Therefore, option B is correct.
Why the other answers are wrong:
A. 'global' refers to the module-level scope, not the nearest enclosing non-global scope; that is
'nonlocal'.
C. 'nonlocal' is only needed for assignment, not for reading an enclosing variable.
D. 'global' binds to the module's global namespace, not to the enclosing function's scope; it
does not create a shared variable among nested functions.
Reference: WGU E010 Foundations of Programming (Python) OA Study Guide, Ch. 3: Functions and
Scoping
Q2.
Consider the following code:
def func(a, b=[]):
b.append(a)
return b
print(func(1))
print(func(2))
print(func(3))
Page 3
, Section A - Basic Python Syntax AND Semantics
What is the output?
A. [1] [2] [3] B. [1] [1, 2] [1, 2, 3]
C. [1] [2, 1] [3, 2, 1] D. Error: 'list' object is not callable
Correct: B - [1] [1, 2] [1, 2, 3]
Rationale:In Python, default argument values are evaluated only once at function definition
time. Therefore, the list 'b' is the same mutable object across calls, accumulating appended
values. The output reflects this persistent state: [1], then [1, 2], then [1, 2, 3].
Why the other answers are wrong:
A. This would occur if 'b' were reinitialized to a new empty list each call, which is not the case.
C. Appending does not reverse order; the list retains insertion sequence.
D. No error occurs because the default list is mutable and can be modified.
Reference: WGU E010 Foundations of Programming (Python) OA Study Guide, Ch. 3: Functions -
Mutable Default Arguments
Q3.
Given the code:
x = [1, 2, 3]
y=x
x.append(4)
z = x.copy()
x.append(5)
What is the final value of y and z?
A. y = [1, 2, 3, 4, 5], z = [1, 2, 3, 4] B. y = [1, 2, 3, 4], z = [1, 2, 3, 4, 5]
C. y = [1, 2, 3, 4, 5], z = [1, 2, 3, 4, 5] D. y = [1, 2, 3, 4], z = [1, 2, 3, 4]
Correct: A - y = [1, 2, 3, 4, 5], z = [1, 2, 3, 4]
Rationale:y = x creates a reference to the same list object, so y reflects all mutations. z =
x.copy() creates a shallow copy at that moment, so z retains the state of x at the time of copy
(after first append, before second). Hence y has all five elements, z has the first four.
Why the other answers are wrong:
B. z is a copy made before the second append, so it doesn't include 5.
C. y is a reference, not a copy, but z is a copy made at an earlier time.
D. y is a reference and thus includes the last append as well.
Reference: WGU E010 Foundations of Programming (Python) OA Study Guide, Ch. 2: Lists and
References
Page 4