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
Document preview thumbnail
Vista previa 3 fuera de 28 páginas
Examen

D 522 Final Exam V2 | D 522 Python for IT Automation | Actual Q&A with Rationale (D522 Final Exam) | Western Governors University

Document preview thumbnail
Vista previa 3 fuera de 28 páginas

D 522 Final Exam V2 | D 522 Python for IT Automation | Actual Q&A with Rationale (D522 Final Exam) | Western Governors University

Vista previa del contenido

D 522 Final Exam V2 | D 522 Python for IT
Automation | Actual Q&A with Rationale
(D522 Final Exam) | Western Governors
University
1. When automating file system tasks, which Python module is primarily used to interact with

the operating system for tasks like creating directories?

A. sys


B. subprocess


C. os


D. re


Answer: C


Rationale: The ‘os’ module provides a portable way of using operating system dependent

functionality. In IT automation, it is essential for directory management and environment

variable access. Utilizing this module allows scripts to run across different platforms

without changing the code for basic file system operations.


2. Which regular expression character is used to match zero or more occurrences of the

preceding character?

A. *


B. ?

,C. +


D. .


Answer: A


Rationale: The asterisk (*) quantifier matches zero or more repetitions of the preceding

element. This is a fundamental tool when searching for patterns in logs where a value

might be missing or repeated. Understanding quantifiers is critical for creating flexible

search patterns in Python scripting.


3. In the context of the ‘subprocess’ module, what is the purpose of setting

‘capture_output=True’?

A. To stop the script if the command fails


B. To prevent the command from running in the background


C. To store stdout and stderr in the returned object


D. To display the output directly to the terminal


Answer: C


Rationale: Setting ‘capture_output=True’ allows the Python script to intercept the text

printed by the external process. This enables the script to process the output data for

further logic or logging. It is a best practice for automation when the results of a system

command determine the next step in a workflow.

, 4. Which method is specifically used to convert a JSON-formatted string into a Python

dictionary?

A. json.loads()


B. json.load()


C. json.dumps()


D. json.dump()


Answer: A


Rationale: The ‘json.loads()’ function stands for ‘load string’, which parses a valid JSON

string into a Python object. This is distinct from ‘json.load()’, which reads from a file

pointer. Automating API interactions frequently requires this conversion to manipulate

web data within Python.


5. What is the primary advantage of using a ‘csv.DictReader’ over a standard ‘csv.reader’?

A. It executes much faster on large datasets


B. It automatically converts strings to integers


C. It maps the information in each row to a dictionary using header names


D. It removes duplicate entries from the CSV file


Answer: C


Rationale: The ‘csv.DictReader’ class creates a dictionary for each row where keys are the

column headers. This makes the code more readable and less prone to errors if the column

Información del documento

Subido en
16 de julio de 2026
Número de páginas
28
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$17.99

¿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

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
ScholarsAscend
3.7
(77)
Vendido
453
Seguidores
39
Artículos
29361
Última venta
15 horas hace




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