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
36
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-15


Section 2 Data Structures and Operations Q16-30


Section 3 Control Flow and Functions Q31-45


Section 4 File Handling and Exception Management Q46-60


Section 5 Automation Scripts and Libraries Q61-75




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 36

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


Q1 Question 1 of 75
A developer writes a Python script that needs to prompt the user for an integer value and store it for later
calculation. The script must handle the input conversion correctly without raising a TypeError. Which
approach correctly reads and stores the integer?
A. Using input('Enter a number: ') which automatically returns an integer type
B. Using str(input('Enter a number: ')) and relying on implicit conversion during arithmetic
C. Using int(input('Enter a number: ')) to read and convert the input in one step
D. Using float(input('Enter a number: ')) and truncating the decimal with modulo


Correct Answer: C
Rationale:
The input() function always returns a string in Python 3, so int() must wrap it to convert to an integer. Using
input() alone stores a string, str() wraps an already-string value, and float() returns a float, not an int.




Q2 Question 2 of 75
A systems administrator is troubleshooting a script where a variable named count has been assigned inside
a function but the outer scope reports it as undefined. The script uses no global declarations. Which Python
scope rule explains this behavior?
A. Variables in Python have function scope by default and are visible everywhere in the module
B. Python uses block-level scoping so the variable is visible only within the if-block
C. Inner function variables are automatically promoted to module scope after the function returns
D. LEGB rule - variables assigned inside a function are local to that function unless declared global


Correct Answer: D
Rationale:
Python follows LEGB (Local, Enclosing, Global, Built-in) resolution. A variable assigned inside a function is local
to that function unless explicitly declared global. Unlike some languages, Python does not use block-level or
function-hoisting scope.




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

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


Q3 Question 3 of 75
A junior developer creates a variable named 2nd_value in a Python script and receives a SyntaxError. The
developer reviews PEP 8 naming conventions to understand valid identifier rules. Which statement correctly
describes Python identifier naming?
A. Identifiers can start with a digit as long as the rest contains only letters
B. Identifiers must start with a letter or underscore and cannot begin with a digit
C. Identifiers are case-insensitive so 2nd_value is the same as Second_Value
D. Identifiers can contain any character if enclosed in backticks


Correct Answer: B
Rationale:
Python identifiers must begin with a letter (a-z, A-Z) or underscore and can be followed by letters, digits, or
underscores. Starting with a digit like 2nd_value causes a SyntaxError. Python identifiers are case-sensitive and
backticks are not used for identifiers.




Q4 Question 4 of 75
An IT analyst needs to concatenate a string message with an integer error_code in a log statement. The
analyst writes 'Error: ' + error_code and gets a TypeError. Which is the correct way to build this string?
A. Using 'Error: ' + int(error_code) to force both operands to integers before the plus sign acts
B. Using 'Error: ' + str(error_code) to explicitly convert the integer before concatenation
C. Using 'Error: ' . error_code because the dot operator auto-converts types in Python
D. Using 'Error: ' + error_code inside a try block so the exception handler performs the conversion


Correct Answer: B
Rationale:
Python does not allow implicit concatenation between str and int types. The + operator requires both operands to
be the same type. str() converts the integer to its string representation so concatenation succeeds. The dot
operator and try-except do not perform automatic type conversion.




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

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


Q5 Question 5 of 75
A developer wants to store configuration values that should never change during program execution, such
as MAX_RETRIES = 5 and API_URL. Which Python convention signals that a variable is intended to be a
constant?
A. Using the const keyword before the variable name as in other programming languages
B. Declaring the variable inside a __constants__ module which Python treats as read-only
C. Prefixing the variable with two underscores so Python enforces immutability via name mangling
D. Naming the variable in ALL_CAPS with underscores to indicate it should be treated as a constant


Correct Answer: D
Rationale:
Python has no const keyword. The PEP 8 convention is to use ALL_CAPS_WITH_UNDERSCORES for
constants. This is a naming convention - Python does not enforce immutability, but it signals the programmer's
intent. Name mangling with double underscores is for class attribute privacy, not constants.




Q6 Question 6 of 75
A script contains the expression result = 17 // 5 and the developer expects the value 3.4, but the interpreter
returns 3. Which operation should the developer use instead to obtain the floating-point quotient?
A. Using the / operator as in which returns 3.4 in Python 3
B. Using the % operator as in 17 % 5 which returns the decimal remainder
C. Using the // operator with a float operand as in 17.0 // 5 which returns 3.4
D. Using the divmod() function which always returns a floating-point quotient


Correct Answer: A
Rationale:
The // operator is floor division and always truncates toward negative infinity, returning an integer result when
both operands are integers. The / operator performs true division and returns a float (3.4). The % operator
returns the modulo remainder, and divmod() returns a tuple of (quotient, remainder).




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

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
36
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

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