I N F O R M AT I O N T E C H N O L O G Y · O B J E C T I V E A S S E S S M E N T
WGU D522 Objective Assessment (New 2026/2027
Update) Python for IT Automation | Qs & As| Grade
A| 100% Correct (Verified Answers) 2026/2027 —
Complete
Official Exam
70 Questions Full Rationales Verified Answers
A+
Q U ES T I O N S
5S EC T I O N S 100%
R AT I O N A L ES
Complete coverage Core exam domains Every answer explained
W H AT T H I S C OVER S
01 Python Fundamentals and Syntax
02 Data Structures and File Handling
03 Scripting for System Administration
04 Networking and API Automation
05 Error Handling and Best Practices
A BO U T THI S A SSE SSM E N T
Build job-ready automation skills across the full D522 blueprint — from Python fundamentals and syntax, data
structures and file handling, and system administration scripting to networking and API automation and error
handling with code-quality discipline. This original study bank for WGU D522 Objective Assessment (New
2026/2027 Update) Python for IT Automation pairs realistic IT scenarios with application- and analysis-level items
and a fully explained rationale for every answer. For review use only; not an institutional proctored assessment.
PA SSI NG SC ORE LE V E L F ORM AT
75% Intermediate Application / Analysis
STUVIA ACTUAL EXAM Page 1
, SECTION 1: PYTHON FUNDAMENTALS AND SYNTAX
Q1. A monitoring script starts with port_count = 22 and later executes port_count = "ssh/tcp" so the same name
now labels a string. A teammate argues the next arithmetic statement should still work because the variable kept
its original type. How does Python actually treat this reassignment?
A. Names are untyped references, so port_count now points to a str object and later arithmetic raises a
TypeError
B. Variables are statically typed, so the reassignment is rejected the moment the line runs
C. The variable secretly stays an int and silently converts the string back to a number
D. Python stores both values and picks whichever type the last expression requires
Correct Answer: A
Rationale: Python names are just references to objects, and assignment rebinds the name to the new object without any
type enforcement. After port_count points to a string, arithmetic such as port_count + 1 raises a TypeError because str and
int cannot be combined.
Q2. A batching routine must split 1024 queued jobs into groups of 150, and the engineer evaluates two
expressions: 1024 // 150 and . The team needs a whole batch count with no fractional part. What
does each expression return?
A. 1024 // 150 returns the int 6 while returns the float 6.826666
B. Both expressions return the float 6.826666 but round differently when printed
C. 1024 // 150 returns 7 because floor division always rounds to the nearest whole number
D. raises a TypeError because both operands are integers
Correct Answer: A
Rationale: The floor division operator // discards the fractional part and yields the int 6, which is the count of complete
batches. The true division operator / always produces a float, here 6.826666, so it is the wrong choice for an index-safe
batch count.
Q3. A dispatcher script walks a task counter forward from 0 and must cycle assignments across exactly four
backup workers in round-robin order, producing only the worker indexes 0, 1, 2, and 3 forever. Which
expression computes the worker index for any counter value?
A. counter / 4, which spreads tasks evenly across the pool
B. counter % 4, which maps every counter value into the range 0 through 3
C. counter // 4, which scales with the counter and identifies the pass number
D. round(counter / 4), which snaps each counter value to the nearest worker
Correct Answer: B
Rationale: The modulo operator returns the remainder after division by 4, so counter % 4 cycles through 0, 1, 2, 3
repeatedly as the counter grows. Floor division counter // 4 keeps increasing and identifies the round number, while the
division forms produce floats or wrong ranges.
STUVIA ACTUAL EXAM · Page 2
, Q4. An archiving utility holds the filename string name = "daily-backup.log" and needs just the four-character
extension at the end for a routing decision. The engineer reaches for slicing rather than index math. Which
expression extracts ".log"?
A. name[:-4], which removes the extension and keeps the stem
B. name[-4:-1], which stops one character before the true end of the string
C. name[4:], which starts four characters from the left edge
D. name[-4:], which starts four characters from the end and runs to the last character
Correct Answer: D
Rationale: A negative start index counts from the end of the string, and omitting the stop index runs the slice through the
final character, so name[-4:] returns ".log". The other slices either drop the tail, stop early, or cut from the wrong end of the
filename.
Q5. A cleanup step runs raw = " old-report.log " and then calls raw.strip().replace("old", "archived") without
assigning the result, expecting the variable itself to be cleaned. Later code prints raw and the engineer is
surprised by the output. What does the print show and why?
A. The string with only the word old replaced, because replace mutates in place
B. The original " old-report.log " because every string method returns a new object and raw still references the
old one
C. An AttributeError, because strip and replace cannot be chained on one line
D. An empty string, because strip permanently clears the object it is called on
Correct Answer: B
Rationale: Python strings are immutable, so strip and replace build and return brand-new string objects and never touch
the original. Because the returned value was discarded, raw still refers to the original padded text when it is printed.
Q6. A log shipper processes lines like "2027-01-05 09:12:44 INFO disk usage 91 percent" and needs exactly
three fields: the date, the time, and everything after them preserved as one message blob. A plain split() shatters
the message into eight fragments. Which call produces the required three fields?
A. line.split(), which splits on every run of whitespace in the line
B. line.split(" "), which splits on every single space character
C. line.split("INFO"), which uses the severity token as the separator
D. line.split(None, 2), which performs at most two splits and keeps the remainder intact
Correct Answer: D
Rationale: Supplying maxsplit=2 tells split to stop after two separators, so the first two fields are date and time and the rest
of the line arrives whole as the third element. The plain and space-based splits divide the entire message, and splitting on
INFO would delete the severity token itself.
STUVIA ACTUAL EXAM · Page 3