• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 104 pages
Exam (elaborations)

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+

Document preview thumbnail
Preview 4 out of 104 pages

WGU D335 OA: Introduction to Programming in Python | Objective Assessment | Actual Questions with Verified Answers | New 2025/2026 Questions 1 200 Update | 100% Correct | Grade A+

Content preview

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

Document information

Uploaded on
September 8, 2026
Number of pages
104
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$16.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
1
Followers
0
Items
173
Last sold
4 days ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions