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 27 páginas
Examen

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

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

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

Vista previa del contenido

D 522 Exam 1 V1 | D 522 Python for IT
Automation | Actual Q&A with Rationale
(D522 Exam 1) | Western Governors
University
1. Which module in Python is most commonly used for interacting with the operating system

to perform tasks like listing directory contents?

A. sys


B. os


C. subprocess


D. shutil


Answer: B


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

functionality. While subprocess is used for external commands, the os module is

specifically designed for file system navigation and environment interaction. This is a

fundamental concept in IT automation for managing local file structures.


2. When using the ‘csv’ module to read a file, which object type does ‘csv.DictReader’ return

for each row in the iteration?

A. Dictionary


B. Tuple

,C. List


D. String


Answer: A


Rationale: The csv.DictReader function maps the information in each row to an

OrderedDict, where keys are the column headers. This allows developers to access data by

column name rather than index, improving code readability. Using dictionaries for data

manipulation is a key skill in Python for IT Automation workflows.


3. What is the primary purpose of the ‘with’ statement when opening a file in Python?

A. To increase the speed of reading the file


B. To encrypt the file contents upon opening


C. To automatically handle file closing even if an exception occurs


D. To allow multiple users to write to the file simultaneously


Answer: C


Rationale: The ‘with’ statement simplifies exception handling by encapsulating common

preparation and cleanup tasks. It ensures that the file is properly closed after the block of

code is finished, preventing resource leaks. This practice is essential for robust automation

scripts that handle many files.


4. In a regular expression, which special character is used to match the start of a string?

A. $

, B. ^


C. .


D. []


Answer: B


Rationale: The caret character (^) anchors the search to the beginning of the string or line.

This is frequently used in log analysis to find lines starting with specific timestamps or

error levels. Mastering regex anchors is vital for precise text processing in IT environments.


5. Which method from the ‘subprocess’ module is recommended for executing a command

and waiting for it to complete in Python 3.5+?

A. subprocess.run()


B. subprocess.popen()


C. subprocess.call()


D. subprocess.check_output()


Answer: A


Rationale: subprocess.run() was introduced in Python 3.5 as the primary way to run

commands. It returns a CompletedProcess instance, which makes it easier to check return

codes and capture output. It is generally preferred over older methods like subprocess.call

for modern automation tasks.

Información del documento

Subido en
16 de julio de 2026
Número de páginas
27
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