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

WGU D522 Python for IT Automation Objective Assessment Exam Actual Exam 2026/2027 – Complete Exam-Style Questions | Detailed Rationales – Pass Guaranteed – A+ Graded

Rating
-
Sold
-
Pages
39
Grade
A+
Uploaded on
05-06-2026
Written in
2025/2026

WGU D522 Python for IT Automation OA Exam Actual Exam 2026/2027 – Real-Style Questions with Answers | 100% Correct | Python Syntax, Data Types, Control Structures, Functions, File Handling | Graded A+ Verified | Regular Expressions, APIs, Web Scraping, Automation Scripts, Debugging | Detailed Rationales | Verified Correct Answers – Pass Guaranteed – Instant Download

Show more Read less
Institution
WGU D522 Python For IT Automation Objective
Course
WGU D522 Python for IT Automation Objective

Content preview

WGU D522 Objective Assessment (New 2026/2027 Update) Python for IT Automation | Qs & As| Grade A| 100% Correct (Verified Answers) 2026/2027 | Page 1 | Passing Score: 80%




WESTERN GOVERNORS UNIVERSITY
WGU D522 Objective Assessment (New 2026/2027 Update)
Python for IT Automation | Qs & As| Grade A| 100% Correct (Verified
Answers)
2026/2027 Edition · Official Exam 2026/2027



75 80% N/A
QUESTIONS PASSING SCORE RECERTIFICATION




TABLE OF CONTENTS



Section 1 Python Fundamentals and Syntax Q1-Q15


Section 2 Data Structures and Operations Q16-Q30


Section 3 Control Flow and Functions Q31-Q45


Section 4 File Handling and Exception Management Q46-Q60


Section 5 Automation Scripts and Libraries Q61-Q75



Instructions: Select the single best answer for each question. This exam is designed for WGU D522 Python for IT
Automation certification preparation. Passing score: 80% (60 questions correct).




WGU D522 Python for IT Automation - 2026/2027 | Passing Score: 80% | Page 1 of 39

,SECTION 1 | Python Fundamentals and Syntax | Q1-Q15 | WGU D522 Python for IT Automation 2026/2027


Q1 Question 1 of 75
A developer is writing a Python script that needs to assign the value 42 to a variable named
count and then print it. The script must follow PEP 8 naming conventions. A junior colleague
suggests using Count = 42 as the assignment. What should the developer do instead?
A. Use count = 42 because PEP 8 recommends lowercase with underscores for variable names
B. Use Count = 42 because it follows CamelCase convention for all variables
C. Use COUNT = 42 because uppercase is preferred for integer variables
D. Use _count = 42 because leading underscores improve readability


Correct Answer: A

Rationale:
PEP 8 specifies that variable names should use lowercase letters with words separated by underscores
(snake_case). CamelCase (Count) is reserved for class names, and all-uppercase names are reserved
for constants. Using a leading underscore indicates a private variable, which is not appropriate for a
general-purpose counter.



Q2 Question 2 of 75
A system administrator is reviewing a Python 3 script and encounters the line result = . The
administrator expects an integer result of 3 but gets 3.3333 instead. Which operation should be
used to obtain the integer quotient?
A. result = 10 % 3
B. result = 10 // 3
C. result =
D. result = int(.0)


Correct Answer: B

Rationale:
The floor division operator // returns the integer quotient of a division, discarding the remainder. The
single slash / performs true division returning a float in Python 3. While int(.0) also yields 3, it is
unnecessarily complex and uses floating-point division before truncation. The modulo operator %
returns the remainder, not the quotient.




WGU D522 Python for IT Automation - 2026/2027 | Passing Score: 80% | Page 2 of 39

,Q3 Question 3 of 75
A programmer needs to concatenate a string variable name with the literal string '_report' to
create a filename. The variable name holds the value 'quarterly'. Which approach correctly
produces 'quarterly_report'?
A. filename = name.append('_report')
B. filename = name + _report
C. filename = name + '_report'
D. filename = name.concat('_report')


Correct Answer: C

Rationale:
The + operator concatenates strings in Python. Without quotes, _report would be treated as a variable
name, not a string literal. The .append() method is for lists, not strings, and .concat() is not a built-in
string method in Python. String concatenation with + is the standard approach for joining strings.



Q4 Question 4 of 75
An IT analyst is converting user input to an integer but the program crashes when the user types
'twenty' instead of '20'. The analyst needs a Python expression that safely handles this
conversion. Which built-in method checks whether a string can be converted to an integer before
attempting the conversion?
A. The type() function comparing the input to int
B. The isnumeric() function directly converting the string
C. The eval() function wrapping the input string
D. The str.isdigit() method on the input string before calling int()


Correct Answer: D

Rationale:
The str.isdigit() method returns True only if all characters in the string are digits, making it a reliable
pre-check before calling int(). The type() function checks the type of an existing object, not whether a
string is convertible. There is no standalone isnumeric() function in Python (it is a string method with
broader Unicode digit coverage). Using eval() is dangerous because it executes arbitrary code, creating
a security vulnerability.




WGU D522 Python for IT Automation - 2026/2027 | Passing Score: 80% | Page 3 of 39

, Q5 Question 5 of 75
A Python developer needs to store configuration values that should never change during program
execution, such as MAX_RETRIES = 5 and API_ENDPOINT = 'https://api.example.com'.
According to PEP 8, how should these names be formatted?
A. Use all uppercase letters with underscores: MAX_RETRIES, API_ENDPOINT
B. Use CamelCase: MaxRetries, ApiEndpoint
C. Use lowercase with underscores: max_retries, api_endpoint
D. Use a single leading underscore: _MAX_RETRIES, _API_ENDPOINT


Correct Answer: A

Rationale:
PEP 8 dictates that constants should be named using all uppercase letters with words separated by
underscores. CamelCase is for class names. Lowercase with underscores is for regular variables and
function names. A single leading underscore indicates a private attribute, which is a separate naming
convention unrelated to constants.



Q6 Question 6 of 75
A junior developer writes x = 5 and then y = x, expecting y to remain 5 even after x is later
changed to 10. When x changes to 10, y remains 5. What concept explains this behavior in
Python?
A. Python creates a deep copy of the value when assigning y = x
B. Variables in Python are references to objects; reassigning x creates a new object, leaving y
referencing the original integer 5
C. Integer variables in Python are statically typed and cannot change
D. The assignment y = x creates a linked reference that updates in both directions


Correct Answer: B

Rationale:
In Python, variables are labels (references) pointing to objects in memory. When x = 5 is executed, x
points to the integer object 5. The statement y = x makes y point to the same object 5. When x = 10 is
later executed, x is reassigned to point to a new integer object 10, but y still points to the original object
5. This is not a deep copy mechanism; integers are immutable, so no copying is needed.




WGU D522 Python for IT Automation - 2026/2027 | Passing Score: 80% | Page 4 of 39

Written for

Institution
WGU D522 Python for IT Automation Objective
Course
WGU D522 Python for IT Automation Objective

Document information

Uploaded on
June 5, 2026
Number of pages
39
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$16.49
Get access to the full document:

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

Get to know the seller

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.
STUVIAACTUALEXAMS University Of California - Los Angeles (UCLA)
Follow You need to be logged in order to follow users or courses
Sold
1070
Member since
3 year
Number of followers
204
Documents
7914
Last sold
1 day ago
Actual Exam

STUVIAACTUALEXAMS is a trusted exam-success delivering accurate, verified, and exam-focused study materials that include real exam-style questions, correct answers, and clear, easy-to-follow rationales, all professionally organized to save time, eliminate guesswork, reduce stress, boost confidence, and help students secure top grades and pass their exams on the first attempt with certainty and ease.

3.5

145 reviews

5
59
4
24
3
23
2
11
1
28

Recently viewed by you

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