WGU D522 PYTHON FOR IT AUTOMATION (SKO1) EXAM – QUESTIONS AND CORRECT ANSWERS
(VERIFIED ANSWERS) PLUS RATIONALES 2026 Q&A | INSTANT DOWNLOAD PDF.
Core Domains
Python Syntax and Data Types
Control Structures and Functions
Object-Oriented Programming (OOP) in Python
Standard Libraries and Module Management
Interacting with the Operating System (OS)
Regular Expressions and Data Parsing
Automated Testing and Unit Tests
IT Infrastructure Automation and Scripting Ethics
Introduction
This comprehensive assessment is designed to evaluate a candidate's proficiency in using Python for IT
automation within a professional infrastructure environment. The exam covers a broad spectrum of skills, ranging
from fundamental scripting logic and data manipulation to advanced system interactions and automated testing
frameworks. By utilizing a mix of conceptual multiple-choice questions and complex scenario-based problems, this
exam ensures that the learner can apply Pythonic principles to solve real-world technical challenges. Emphasis is
placed on critical thinking, efficient code design, and adherence to professional standards and ethical automation
practices required in modern DevOps and SysAdmin roles.
,SECTION ONE: QUESTIONS 1–100
1. Which Python data type is immutable and stores an ordered sequence of elements?
A. List
B. Dictionary
🟢 Correct answer C. Tuple
D. Set
🔴 RATIONALE: Tuples are ordered sequences like lists, but they are immutable, meaning their elements cannot
be changed after creation. This is a foundational concept in Python data structures.
2. A script needs to iterate over a list of server names and stop immediately if a specific "maintenance" flag is
found. Which keyword should be used?
🟢 Correct answer A. break
B. continue
C. pass
D. exit
🔴 RATIONALE: The break statement is used to terminate the current loop prematurely when a specific condition
is met, whereas continue only skips the current iteration.
3. When opening a file for the purpose of adding new logs to the end without overwriting existing data, which
mode should be used in the open() function?
A. 'r'
B. 'w'
,🟢 Correct answer C. 'a'
D. 'x'
🔴 RATIONALE: The 'a' mode stands for append, which places the file pointer at the end of the file, ensuring new
data is added to the existing content rather than overwriting it.
4. Which of the following follows the PEP 8 recommendation for naming a variable in Python?
A. VariableName
🟢 Correct answer B. variable_name
C. VARIABLE_NAME
D. vName
🔴 RATIONALE: PEP 8 suggests using "snake_case" (all lowercase with underscores) for variable and function
names to ensure readability and consistency.
5. An IT professional is writing a script that involves sensitive employee data. Which ethical principle is most
relevant when deciding how to log errors?
A. Performance efficiency
B. Code reusability
🟢 Correct answer C. Data privacy and confidentiality
D. Scalability
🔴 RATIONALE: When handling sensitive data, ethics and professional standards dictate that PII (Personally
Identifiable Information) must not be exposed in cleartext logs or error outputs.
6. What is the result of the expression 10 // 3 in Python 3?
, A. 3.333
🟢 Correct answer B. 3
C. 1
D. 4
🔴 RATIONALE: The // operator performs floor division, which divides the numbers and rounds down to the
nearest whole integer.
7. Which module is most appropriate for executing system commands like 'ping' or 'ls' from within a Python
script?
🟢 Correct answer A. subprocess
B. sys
C. os.path
D. requests
🔴 RATIONALE: While the 'os' module can run commands, the 'subprocess' module is the modern,
recommended way to spawn new processes and retrieve their results.
8. In Object-Oriented Programming, what is the purpose of the init method?
A. To delete an object
🟢 Correct answer B. To initialize an object's attributes upon creation
C. To define a private variable
D. To inherit from a parent class
🔴 RATIONALE: The init method is a special constructor method in Python that runs automatically when a new
instance of a class is created.
(VERIFIED ANSWERS) PLUS RATIONALES 2026 Q&A | INSTANT DOWNLOAD PDF.
Core Domains
Python Syntax and Data Types
Control Structures and Functions
Object-Oriented Programming (OOP) in Python
Standard Libraries and Module Management
Interacting with the Operating System (OS)
Regular Expressions and Data Parsing
Automated Testing and Unit Tests
IT Infrastructure Automation and Scripting Ethics
Introduction
This comprehensive assessment is designed to evaluate a candidate's proficiency in using Python for IT
automation within a professional infrastructure environment. The exam covers a broad spectrum of skills, ranging
from fundamental scripting logic and data manipulation to advanced system interactions and automated testing
frameworks. By utilizing a mix of conceptual multiple-choice questions and complex scenario-based problems, this
exam ensures that the learner can apply Pythonic principles to solve real-world technical challenges. Emphasis is
placed on critical thinking, efficient code design, and adherence to professional standards and ethical automation
practices required in modern DevOps and SysAdmin roles.
,SECTION ONE: QUESTIONS 1–100
1. Which Python data type is immutable and stores an ordered sequence of elements?
A. List
B. Dictionary
🟢 Correct answer C. Tuple
D. Set
🔴 RATIONALE: Tuples are ordered sequences like lists, but they are immutable, meaning their elements cannot
be changed after creation. This is a foundational concept in Python data structures.
2. A script needs to iterate over a list of server names and stop immediately if a specific "maintenance" flag is
found. Which keyword should be used?
🟢 Correct answer A. break
B. continue
C. pass
D. exit
🔴 RATIONALE: The break statement is used to terminate the current loop prematurely when a specific condition
is met, whereas continue only skips the current iteration.
3. When opening a file for the purpose of adding new logs to the end without overwriting existing data, which
mode should be used in the open() function?
A. 'r'
B. 'w'
,🟢 Correct answer C. 'a'
D. 'x'
🔴 RATIONALE: The 'a' mode stands for append, which places the file pointer at the end of the file, ensuring new
data is added to the existing content rather than overwriting it.
4. Which of the following follows the PEP 8 recommendation for naming a variable in Python?
A. VariableName
🟢 Correct answer B. variable_name
C. VARIABLE_NAME
D. vName
🔴 RATIONALE: PEP 8 suggests using "snake_case" (all lowercase with underscores) for variable and function
names to ensure readability and consistency.
5. An IT professional is writing a script that involves sensitive employee data. Which ethical principle is most
relevant when deciding how to log errors?
A. Performance efficiency
B. Code reusability
🟢 Correct answer C. Data privacy and confidentiality
D. Scalability
🔴 RATIONALE: When handling sensitive data, ethics and professional standards dictate that PII (Personally
Identifiable Information) must not be exposed in cleartext logs or error outputs.
6. What is the result of the expression 10 // 3 in Python 3?
, A. 3.333
🟢 Correct answer B. 3
C. 1
D. 4
🔴 RATIONALE: The // operator performs floor division, which divides the numbers and rounds down to the
nearest whole integer.
7. Which module is most appropriate for executing system commands like 'ping' or 'ls' from within a Python
script?
🟢 Correct answer A. subprocess
B. sys
C. os.path
D. requests
🔴 RATIONALE: While the 'os' module can run commands, the 'subprocess' module is the modern,
recommended way to spawn new processes and retrieve their results.
8. In Object-Oriented Programming, what is the purpose of the init method?
A. To delete an object
🟢 Correct answer B. To initialize an object's attributes upon creation
C. To define a private variable
D. To inherit from a parent class
🔴 RATIONALE: The init method is a special constructor method in Python that runs automatically when a new
instance of a class is created.