• 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 61 pages
Exam (elaborations)

WGU E010 FOUNDATIONS OF PROGRAMMING (PYTHON) OBJECTIVE ASSESSMENT OA V3 PRACTICE QUESTIONS AND ANSWERS WITH RATIONALES| INSTANT DOWNLOAD

Document preview thumbnail
Preview 4 out of 61 pages

This study document offers 100 practice questions for the WGU E010 Foundations of Programming (Python) Objective Assessment OA V3. Each question includes the correct answer and a detailed rationale covering Python basics like functions, lists, tuples, dictionaries, exceptions, file handling, and comprehensions. Use it to test your knowledge and prepare for the OA.

Content preview

, Question 1
Given the following code, what is the final value of `result`?


```python
def modify(lst, val):
lst.append(val)
lst = [val]
return lst


nums = [1, 2]
result = modify(nums, 3)
result.append(4)
```
A. [3, 4]
B. [1, 2, 3]
C. [1, 2, 3, 4]
D. [3]
Correct Answer: A - [3, 4]


RATIONALE
Inside modify, lst.append(val) mutates the caller's list nums to [1,2,3],
but then lst is rebound to a new list [3]. The function returns this new
list. result refers to [3], and result.append(4) yields [3,4]. The original
nums is [1,2,3] but is not used.

Question 2
Which statement about Python's `range()` function is correct when used in a
`for` loop?
A. range(5, 0, -1) produces the sequence 5, 4, 3, 2, 1.
B. range(0, 5, -1) produces 0, -1, -2, -3, -4.



Page 2

, C. range(5) produces 1, 2, 3, 4, 5.

D. range(1, 5, 2) produces 1, 3, 5.
Correct Answer: A - range(5, 0, -1) produces the sequence 5, 4, 3,
2, 1.


RATIONALE
range(start, stop, step) generates values from start up to but excluding
stop. range(5,0,-1) yields 5,4,3,2,1. Option B is empty because step is
negative but start < stop. Option C starts at 0. Option D stops before 5,
yielding 1,3.

Question 3
What is the output of the following code?


```python
def outer():
x = 10
def inner():
nonlocal x
x += 5
return x
return inner()


print(outer())
```
A. 15
B. 10
C. UnboundLocalError
D. 5
Correct Answer: A - 15



Page 3

, RATIONALE
The nonlocal keyword allows inner to modify x in the enclosing scope
of outer. x starts at 10, becomes 15, and inner returns 15. Without
nonlocal, x += 5 would raise UnboundLocalError because x would be
treated as local to inner.

Question 4
Consider the dictionary `d = {'a': 1, 'b': 2, 'c': 3}`. After executing `d['a'] =
d.get('d', 0) + d.pop('b')`, what is the resulting dictionary?
A. {'a': 2, 'c': 3}
B. {'a': 3, 'c': 3}
C. {'a': 1, 'c': 3}
D. KeyError
Correct Answer: A - {'a': 2, 'c': 3}


RATIONALE
d.get('d', 0) returns 0 because 'd' is absent. d.pop('b') removes 'b' and
returns 2. The expression becomes d['a'] = 0 + 2 = 2. The final
dictionary is {'a': 2, 'c': 3}.

Question 5
Which of the following best describes the difference between a `list` and a
`tuple` in Python?
A. Lists are mutable and typically used for homogeneous sequences;
tuples are immutable and often used for heterogeneous records.
B. Lists can contain any data type; tuples can only contain numbers.
C. Tuples are mutable and support item assignment; lists are immutable.
D. Lists are indexed by integers; tuples are indexed by strings.
Correct Answer: A - Lists are mutable and typically used for
homogeneous sequences; tuples are immutable and often used for
heterogeneous records.


Page 4

Document information

Uploaded on
October 1, 2026
Number of pages
61
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$30.00

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

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
CaseHero
3.8
(4)
Sold
20
Followers
0
Items
6237
Last sold
6 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