1
WGU D335 OA: Introduction to Programming in
Python | Objective Assessment | Actual Questions
with Verified Answers | New 2025/2026 Questions 1-
200 Update | 100% Correct | Graded A+
Question 1
What is the correct output of the following Python code? print(type())
A. <class 'int'>
B. <class 'float'>
C. <class 'complex'>
D. <class 'str'>
Answer: B
Explanation: In Python 3, the division operator (/) always returns a floating-
point number, even when the operands are integers. Thus, 5/2 results in 2.5,
which is a float. Integer division (floor division) is performed using the //
operator.
Question 2
Which of the following correctly creates a tuple in Python?
A. my_tuple = [1, 2, 3]
B. my_tuple = (1, 2, 3)
C. my_tuple = {1, 2, 3}
, 2
D. my_tuple = 1, 2, 3
Answer: B
Explanation: Tuples are defined using parentheses. While options B and D
both create tuples, option B is the most standard and clear representation.
Square brackets define lists, and curly braces define sets or dictionaries.
Question 3
What will be the output of the following code?
x = 10
def my_func():
global x
x=5
my_func()
print(x)
A. 10
B. 5
C. None
D. Error
Answer: B
Explanation: The global keyword allows the function to modify the global
variable x. Without global, the function would create a local variable.
Because global is used, the assignment x = 5 modifies the global variable, so the
final print outputs 5.
, 3
Question 4
Which data structure is most appropriate for storing a collection of unique,
unordered elements in Python?
A. List
B. Tuple
C. Set
D. Dictionary
Answer: C
Explanation: A set is an unordered collection of unique elements. Lists and
tuples can contain duplicates and are ordered. Dictionaries store key-value pairs.
Sets are ideal when uniqueness and membership testing are required.
Question 5
What is the result of the expression bool([]) in Python?
A. True
B. False
C. None
D. Error
Answer: B
Explanation: In Python, empty sequences (lists, tuples, strings), empty
dictionaries, and the number 0 evaluate to False in a boolean context. An empty
list [] is considered False. Non-empty lists evaluate to True.
, 4
Question 6
Which of the following statements correctly describes a Python list
comprehension?
A. It creates a new list by applying an expression to each item in an iterable
B. It creates a new dictionary from two lists
C. It is used to iterate over a list without creating a new list
D. It is a type of generator expression
Answer: A
Explanation: A list comprehension provides a concise way to create a new list
by applying an expression to each item in an existing iterable, optionally filtering
with a condition. The syntax is [expression for item in iterable if condition].
Question 7
What will be the output of the following code?
numbers = [1, 2, 3, 4]
squares = map(lambda x: x**2, numbers)
print(list(squares))
A. [1, 4, 9, 16]
B. [2, 4, 6, 8]
C. [1, 8, 27, 64]
D. [1, 2, 3, 4]
Answer: A
WGU D335 OA: Introduction to Programming in
Python | Objective Assessment | Actual Questions
with Verified Answers | New 2025/2026 Questions 1-
200 Update | 100% Correct | Graded A+
Question 1
What is the correct output of the following Python code? print(type())
A. <class 'int'>
B. <class 'float'>
C. <class 'complex'>
D. <class 'str'>
Answer: B
Explanation: In Python 3, the division operator (/) always returns a floating-
point number, even when the operands are integers. Thus, 5/2 results in 2.5,
which is a float. Integer division (floor division) is performed using the //
operator.
Question 2
Which of the following correctly creates a tuple in Python?
A. my_tuple = [1, 2, 3]
B. my_tuple = (1, 2, 3)
C. my_tuple = {1, 2, 3}
, 2
D. my_tuple = 1, 2, 3
Answer: B
Explanation: Tuples are defined using parentheses. While options B and D
both create tuples, option B is the most standard and clear representation.
Square brackets define lists, and curly braces define sets or dictionaries.
Question 3
What will be the output of the following code?
x = 10
def my_func():
global x
x=5
my_func()
print(x)
A. 10
B. 5
C. None
D. Error
Answer: B
Explanation: The global keyword allows the function to modify the global
variable x. Without global, the function would create a local variable.
Because global is used, the assignment x = 5 modifies the global variable, so the
final print outputs 5.
, 3
Question 4
Which data structure is most appropriate for storing a collection of unique,
unordered elements in Python?
A. List
B. Tuple
C. Set
D. Dictionary
Answer: C
Explanation: A set is an unordered collection of unique elements. Lists and
tuples can contain duplicates and are ordered. Dictionaries store key-value pairs.
Sets are ideal when uniqueness and membership testing are required.
Question 5
What is the result of the expression bool([]) in Python?
A. True
B. False
C. None
D. Error
Answer: B
Explanation: In Python, empty sequences (lists, tuples, strings), empty
dictionaries, and the number 0 evaluate to False in a boolean context. An empty
list [] is considered False. Non-empty lists evaluate to True.
, 4
Question 6
Which of the following statements correctly describes a Python list
comprehension?
A. It creates a new list by applying an expression to each item in an iterable
B. It creates a new dictionary from two lists
C. It is used to iterate over a list without creating a new list
D. It is a type of generator expression
Answer: A
Explanation: A list comprehension provides a concise way to create a new list
by applying an expression to each item in an existing iterable, optionally filtering
with a condition. The syntax is [expression for item in iterable if condition].
Question 7
What will be the output of the following code?
numbers = [1, 2, 3, 4]
squares = map(lambda x: x**2, numbers)
print(list(squares))
A. [1, 4, 9, 16]
B. [2, 4, 6, 8]
C. [1, 8, 27, 64]
D. [1, 2, 3, 4]
Answer: A