2026/2027 | Objective Assessment Practice
Questions & Answers | Python for IT
Automation Study Guide | WGU Exam Prep
WGU D522 Python for IT Automation 2026/2027 | Objective Assessment
Practice Questions & Answers
• Comprehensive 200-question study guide designed to build mastery of Python
automation concepts through systematic, exam-aligned practice
• Strategic study approach: Work through sections sequentially, review incorrect
answers with detailed rationales, and repeat weak areas until confident
1. What is the primary purpose of Python in IT automation?
A) To replace all system administrators
B) To automate repetitive tasks and improve efficiency in IT operations
C) To serve as the only programming language for infrastructure
D) To eliminate the need for documentation
E) To increase system vulnerability testing
✓ CORRECT ANSWER: B) To automate repetitive tasks and improve efficiency
in IT operations
RATIONALE: Python is widely used in IT automation because it excels at
automating repetitive, time-consuming tasks, thereby improving operational
efficiency, reducing human error, and freeing IT professionals to focus on strategic
work. While Python is a powerful tool, it doesn't replace system administrators (A),
isn't the only programming language (C), doesn't eliminate documentation
requirements (D), and isn't specifically designed for vulnerability testing (E).
,2. Which of the following best describes a variable in Python?
A) A constant value that cannot be changed
B) A named storage location that holds a value and can be reassigned
C) A function that performs mathematical operations
D) A keyword reserved by the Python interpreter
E) An error message displayed during execution
✓ CORRECT ANSWER: B) A named storage location that holds a value and can
be reassigned
RATIONALE: A variable is a named container in memory that stores data and
allows that data to be changed. Unlike constants (A), variables can be reassigned
multiple times. Variables are distinct from functions (C), reserved keywords (D), and
error messages (E).
3. What is the correct way to declare a variable in Python?
A) declare x = 5
B) var x = 5
C) x = 5
D) int x = 5
E) variable x = 5
✓ CORRECT ANSWER: C) x = 5
RATIONALE: Python uses simple assignment syntax without keywords like
"declare," "var," or type declarations. The format "x = 5" is the correct Python syntax
for creating a variable and assigning it a value. Options A, B, D, and E follow syntax
from other programming languages, not Python.
,4. Which of the following is NOT a valid Python variable name?
A) my_variable
B) MyVariable
C) myVariable123
D) 123myVariable
E) _myVariable
✓ CORRECT ANSWER: D) 123myVariable
RATIONALE: Python variable names must begin with a letter (a-z, A-Z) or an
underscore (_), not a number. Option D violates this rule by starting with digits. All
other options (A, B, C, E) follow valid naming conventions: underscores are allowed,
camelCase and snake_case are both acceptable, and numbers can appear after the
first character.
5. What is the data type of the value 42 in Python?
A) string
B) float
C) integer
D) boolean
E) list
✓ CORRECT ANSWER: C) integer
RATIONALE: The value 42 is a whole number without a decimal point, making it an
integer data type. A string would be written as "42" (in quotes), a float would be
42.0 (with a decimal), a boolean would be True or False, and a list would be
enclosed in brackets like [42].
, 6. Which operator is used for exponentiation in Python?
A) ^
B) **
C) ^*
D) pow
E) exp
**✓ CORRECT ANSWER: B) **
RATIONALE: The double asterisk (**) operator performs exponentiation in Python
(e.g., 2 ** 3 = 8). The caret symbol (^) is used for bitwise XOR operations, not
exponentiation. While pow() is a built-in function for exponentiation, ** is the
operator. Options C and E are not valid Python operators for this purpose.
7. What will be the output of the following code?
x = 10
y=3
print(x % y)
A) 3.33
B) 3
C) 1
D) 13
E) 30
✓ CORRECT ANSWER: C) 1