Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Examen

WGU D522 Python for IT Automation ACTUAL OBJECTIVE ASSESSMENT PRACTICE 2026/2027 | Verified Code-Centric & Scenario-Based Questions and Answers | Grade A Target | Pass Guaranteed

Puntuación
-
Vendido
-
Páginas
57
Grado
A+
Subido en
07-02-2026
Escrito en
2025/2026

WGU D522 Python for IT Automation ACTUAL OBJECTIVE ASSESSMENT PRACTICE 2026/2027 | Verified Code-Centric & Scenario-Based Questions and Answers | Grade A Target | Pass Guaranteed

Institución
WGU D522
Grado
WGU D522

Vista previa del contenido

WGU D522 Python for IT Automation ACTUAL
OBJECTIVE ASSESSMENT PRACTICE 2026/2027 |
Verified Code-Centric & Scenario-Based Questions
and Answers | Grade A Target | Pass Guaranteed

SECTION 1: PYTHON FOUNDATIONS & SCRIPTING ENVIRONMENT

Questions 1-10



Q1: An IT administrator needs to write a Python script that processes server hostnames. The
script must handle cases where a hostname might be missing (None) without crashing. Which
code snippet properly implements this error handling?

A.

Python

Copy

hostname = get_server_name()

print(hostname.upper())

B.

Python

Copy

hostname = get_server_name()

try:

print(hostname.upper())

except AttributeError:

print("No hostname provided")

``` [CORRECT]

,C.

```python

hostname = get_server_name()

if hostname is not "":

print(hostname.upper())

D.

Python

Copy

hostname = get_server_name()

print(hostname.upper() or "No hostname provided")

Correct Answer: B

Rationale: Option B correctly uses a try/except block to catch the AttributeError that occurs
when calling .upper() on None. This is the Pythonic way to handle potential None values when
the operation might fail. Option A crashes with AttributeError if hostname is None. Option C
checks for empty string but None is not an empty string—the condition passes and still crashes.
Option D uses short-circuit evaluation incorrectly; hostname.upper() executes first and raises
the exception before the or can evaluate.



Q2: A DevOps engineer is creating a virtual environment for a new automation project. Which
sequence of commands correctly sets up and activates a Python 3 virtual environment named
automation_env on a Linux system?

A. python -m venv automation_env then source automation_env/bin/activate [CORRECT]

B. pip install virtualenv automation_env then virtualenv activate

C. python3 -m virtualenv create automation_env then automation_env/Scripts/activate

D. venv create automation_env then ./automation_env/bin/activate

Correct Answer: A

,Rationale: The standard library venv module creates virtual environments: python -m venv
<name>. Activation on Linux/macOS uses source <name>/bin/activate (Windows uses
Scripts\activate). Option B incorrectly uses pip to install virtualenv without proper syntax.
Option C uses wrong module path (Scripts is Windows, not Linux). Option D omits the -m flag
required to run venv as a module.



Q3: [CODE ANALYSIS] What is the output of the following code snippet?

Python

Copy

import sys



def check_python_version():

version = sys.version_info

if version.major == 3 and version.minor >= 8:

return "Supported"

elif version.major == 3:

return "Legacy"

else:

return "Unsupported"



print(check_python_version())

Assuming the script runs on Python 3.11.4:

A. "Legacy"
B. "Unsupported"
C. "Supported" [CORRECT]
D. None

Correct Answer: C

, Rationale: sys.version_info returns a named tuple (major, minor, micro, releaselevel, serial).
Python 3.11.4 gives version.major=3, version.minor=11. The condition version.major == 3 and
version.minor >= 8 evaluates True (11 >= 8), returning "Supported". This pattern is common in
automation scripts checking for compatible Python versions before importing version-specific
modules like asyncio features or typing constructs.



Q4: A system administrator needs to process a list of IP addresses, removing duplicates while
preserving the original order of first appearance. Which Python code accomplishes this most
efficiently?

A.

Python

Copy

unique_ips = list(set(ip_list))

B.

Python

Copy

unique_ips = []

for ip in ip_list:

if ip not in unique_ips:

unique_ips.append(ip)

``` [CORRECT]



C.

```python

unique_ips = dict.fromkeys(ip_list).keys()

D.

Python

Copy

Escuela, estudio y materia

Institución
WGU D522
Grado
WGU D522

Información del documento

Subido en
7 de febrero de 2026
Número de páginas
57
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

$16.99
Accede al documento completo:

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Conoce al vendedor
Seller avatar
EMPRESS254
1.0
(1)

Conoce al vendedor

Seller avatar
EMPRESS254 Chamberlain College Of Nursing
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
6
Miembro desde
6 meses
Número de seguidores
0
Documentos
646
Última venta
19 horas hace
Empress

One stop shop for all all study materials, Study guides,Exams and all assignments and homeworks.

1.0

1 reseñas

5
0
4
0
3
0
2
0
1
1

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes