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
43
Grade
A+
Uploaded on
10-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 10, 2025
Number of pages
43
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 Update – Western
Governors University

1

Which Python data type is best suited for storing a fixed collection of unique
host-names that must remain immutable?

A. list

B. set

C. tuple

D. dict

Correct Answer: C

Rationale: A tuple is immutable and, when it contains only strings, can be used as a
constant collection; sets (B) are mutable, lists (A) are ordered but mutable, and dict (D)
is mapping, not a simple collection.

2

What is the output of the following snippet?

print(type(lambda x: x * 2))

A. <class 'function'>

,B. <class 'lambda'>

C. <class 'method'>

D. <class 'int'>

Correct Answer: A

Rationale: A lambda expression creates an anonymous function object whose type is
function; Python has no separate lambda class (B), and it is neither a bound method (C)
nor an int (D).

3

Which statement accurately describes the difference between shutil.copy() and
shutil.copy2() in Python 3.12?

A. copy() duplicates file data and metadata; copy2() duplicates only data.

B. copy2() preserves original timestamps and mode bits; copy() does not.

C. copy() works on directories; copy2() works only on files.

D. copy2() returns a file handle; copy() returns None.

Correct Answer: B

Rationale: copy2() attempts to preserve all metadata including atime/mtime, whereas
copy() duplicates content and permission bits but not timestamps; neither returns a
handle (D) and both operate on files, not directories (C).

4

,A script uses subprocess.run(["ping", "-c", "2", "8.8.8.8"], capture_output=True, text=True)
and later prints proc.stderr. Which argument addition will discard all output and prevent
shell injection when the address is variable?

A. shell=True

B. stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL

C. stdin=subprocess.PIPE

D. check=True

Correct Answer: B

Rationale: Redirecting both streams to DEVNULL silences output and avoids injection
because no shell is invoked; shell=True (A) increases injection risk, while PIPE (C) and
check (D) do not discard data.

5

Which regular-expression pattern matches only a valid dotted-decimal IPv4 address in
capture group 1?

A. ^(\d{1,3}.){3}\d{1,3}


B.



(




[0−9]1,3

, )



˙







3[0−9]1,3




C. ^((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d).){3}(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)


D.



(




\d+



)



˙
$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