100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

WGU D522 Objective Assessment | Python for IT Automation | ACTUAL EXAM | Questions & Verified Answers | Latest 2025 / 2026 Update – Western Governors University

Rating
-
Sold
-
Pages
37
Grade
A
Uploaded on
12-12-2025
Written in
2025/2026

WGU D522 Objective Assessment | Python for IT Automation | ACTUAL EXAM | Questions & Verified Answers | Latest 2025 / 2026 Update – Western Governors University

Institution
WGU D522
Course
WGU D522











Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
WGU D522
Course
WGU D522

Document information

Uploaded on
December 12, 2025
Number of pages
37
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

WGU D522 Objective Assessment | Python for IT Automation |
ACTUAL EXAM | Questions & Verified Answers | Latest 2025 /
2026 Update – Western Governors University

1.​

Which Python data type is best suited to store a static lookup table that maps VLAN IDs
(integers) to VLAN names (strings) and provides O(1) average-time lookups?

A. list

B. set

C. dict

D. tuple

Correct Answer: C

Rationale: A dict (hash map) gives constant-time average lookups via hashing. A list (A)
would require O(n) linear search. A set (B) only stores keys, not key-value pairs. A tuple
(D) is immutable and lacks efficient keyed access.

2.​

What is the output of the following snippet?

PythonCopy

x = [1, 2, 3]
y = x
x.append(4)
print(y)


A. [1, 2, 3]

,B. [1, 2, 3, 4]

C. [4, 3, 2, 1]

D. TypeError

Correct Answer: B

Rationale: Both x and y reference the same list object in memory; mutating via either
name is visible through both. Appending 4 modifies the shared object, so y reflects the
change. No error occurs because list.append is valid.

3.​

Which statement about Python’s Global Interpreter Lock (GIL) is accurate in CPython
3.11?

A. It allows true parallel execution of multiple threads in a single process.

B. It is released during I/O-bound operations, enabling concurrency.

C. It is bypassed automatically when using the multiprocessing module.

D. Both B and C are correct.

Correct Answer: D

Rationale: The GIL prevents simultaneous execution of Python bytecode by multiple
threads in one process (so A is false), but it is released around blocking I/O syscalls (B),
and the multiprocessing module creates separate processes, each with its own GIL (C),
enabling true parallelism.

4.​

Which exception will be raised by int('abc')?

,A. ValueError

B. TypeError

C. SyntaxError

D. OverflowError

Correct Answer: A

Rationale: int() cannot parse the non-numeric string, raising ValueError. TypeError (B)
occurs when the argument type is wrong (e.g., int(None)). SyntaxError (C) is for invalid
Python code, and OverflowError (D) is for numbers too large.

5.​

Given re.search(r'^\d{3}-\d{3}-\d{4}$', phone), which string will match?


A. "555-123-4567"

B. "5551234567"

C. "(555) 123-4567"

D. "555-123-456"

Correct Answer: A

Rationale: The regex anchors at start/end and requires exactly three digits, hyphen,
three digits, hyphen, four digits. Only A fits. B lacks hyphens, C uses parentheses and
space, D has only three final digits.

6.​

, Which subprocess call safely executes ls -l /tmp and captures stdout as a string

while suppressing stderr?

A. subprocess.run(['ls', '-l', '/tmp'], stderr=subprocess.PIPE).stdout

B. subprocess.call('ls -l /tmp', shell=True, stderr=subprocess.DEVNULL)

C. subprocess.check_output(['ls', '-l', '/tmp'], stderr=subprocess.DEVNULL).decode()

D. os.system('ls -l /tmp 2>/dev/null')

Correct Answer: C

Rationale: check_output returns stdout bytes; decoding gives the string, and DEVNULL
discards stderr. Option A is missing decode and may return None if stdout not piped. B
returns exit code only. D does not capture output in Python and uses os.system, which
is discouraged.

7.​

What is returned by sorted({'b': 2, 'a': 1})?


A. {'a': 1, 'b': 2}

B. ['a', 'b']

C. ['b', 'a']

D. TypeError

Correct Answer: B

Rationale: sorted() iterates over dictionary keys (insertion-ordered in 3.7+) and returns a
new list of those keys in ascending order. It does not return the dict (A) or values (C).
$15.49
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
TommyRicks

Get to know the seller

Seller avatar
TommyRicks Chamberlain College Of Nursing
View profile
Follow You need to be logged in order to follow users or courses
Sold
New on Stuvia
Member since
1 week
Number of followers
0
Documents
140
Last sold
-
TommyRicks

One stop shop for all all study materials, Study guides,Exams and all assignments and homeworks.

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

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

Frequently asked questions