Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 3 out of 23 pages
Exam (elaborations)

ITSW 3126 (D335) Intro to Programming in Python Latest OA Guide 2025.

Document preview thumbnail
Preview 3 out of 23 pages

ITSW 3126 (D335) Intro to Programming in Python Latest OA Guide 2025.ITSW 3126 (D335) Intro to Programming in Python Latest OA Guide 2025.ITSW 3126 (D335) Intro to Programming in Python Latest OA Guide 2025.

Content preview

D335 ITSW 3126

Introduction to Programming in Python

3.0 Credits

Objective Assessment Review (Qns &
Ans)

2025




©2025

, Multiple Choice Questions

Question 1:
A data analyst working with large datasets in Python is considering
different approaches to iterate over data without loading an entire list
into memory. Which of the following best describes the key benefit of
using a generator expression over a list comprehension?
A. It evaluates elements eagerly, ensuring faster access.
B. It yields one element at a time using lazy evaluation, reducing memory
usage.
C. It reduces code complexity by eliminating loops entirely.
D. It provides built-in caching for repeated iterations.

Correct ANS: B. It yields one element at a time using lazy evaluation,
reducing memory usage.

Rationale:
Generator expressions compute values on the fly and yield one item at a
time, which is especially beneficial when processing very large datasets.
This lazy evaluation minimizes memory consumption compared to list
comprehensions that generate the entire list in memory.

---

Question 2:
In Python, which advanced feature allows a function to capture variables
from its enclosing scope—even after that scope has finished execution—
and thus maintain state?
A. Recursion
B. Closure
C. Lambda function
D. Decorator

Correct ANS: B. Closure
©2025

, Rationale:
A closure is a function object that remembers values in enclosing scopes
even if they are not present in memory. This capability is vital for
encapsulating state and behavior, which helps in building higher-level
abstractions in Python programming.

---

Question 3:
Which built-in Python module is primarily used to write asynchronous
code using the async/await syntax, enabling non-blocking I/O
operations?
A. threading
B. multiprocessing
C. asyncio
D. concurrent.futures

Correct ANS: C. asyncio

Rationale:
The `asyncio` module provides a framework for asynchronous
programming in Python by running an event loop that supports non-
blocking I/O, making it essential for real‑time applications and scenarios
where high concurrency is required without resorting to multi-threading.

---

Question 4:
What Python feature allows you to extend or modify the behavior of
functions or methods without altering their source code, effectively
wrapping them with additional functionality?
A. Inheritance
B. Decorators
C. Context managers
©2025

Document information

Uploaded on
May 9, 2025
Number of pages
23
Written in
2024/2025
Type
Exam (elaborations)
Contains
Unknown
$15.99

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.
EmilioOchieng
4.1
(24)
Sold
148
Followers
17
Items
4032
Last sold
3 months 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