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

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

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

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

Vista previa del contenido

D 522 Exam 3 V1 | D 522 Python for IT
Automation | Actual Q&A with Rationale
(D522 Exam 3) | Western Governors
University
1. When using the re module in Python, which function should be utilized to find all

occurrences of a pattern within a string and return them as a list?

A. re.search()


B. re.findall()


C. re.match()


D. re.split()


Answer: B


Rationale: The re.findall() function scans the entire string and returns all non-

overlapping matches of a pattern as a list of strings. This is particularly useful for extracting

data like IP addresses or dates from log files where multiple instances may occur. In

contrast, re.search() only returns the first match found, and re.match() checks only

the beginning of the string.


2. Which method from the os module is the most appropriate for checking if a specific file

exists at a given path before attempting to open it?

A. os.access()

,B. os.path.isfile()


C. os.path.exists()


D. os.mkdir()


Answer: B


Rationale: The os.path.isfile() function specifically checks if the target path points to

a regular file, ensuring that the script does not try to process a directory as a file. While

os.path.exists() confirms the path is valid, it does not distinguish between files and

directories. Using this check helps prevent FileNotFoundError exceptions during

automation tasks.


3. In the context of the csv module, what is the primary advantage of using

csv.DictReader over the standard csv.reader?

A. It processes data faster in large datasets.


B. It automatically encrypts the data during the read process.


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


D. It handles binary files more efficiently than text files.


Answer: C


Rationale: csv.DictReader creates an object that maps the information in each row to a

dictionary whose keys are given by the optional fieldnames parameter or inferred from the

first row. This makes the code much more readable and maintainable because values can

, be accessed via column names rather than integer indices. It reduces errors when the CSV

structure changes, such as when columns are rearranged.


4. A system administrator needs to run an external command from a Python script and

capture its output for logging. Which module is best suited for this task?

A. sys


B. subprocess


C. logging


D. platform


Answer: B


Rationale: The subprocess module allows Python to spawn new processes, connect to

their input/output/error pipes, and obtain their return codes. It is the recommended

standard for executing shell commands and replacing older functions like os.system. This

is critical for IT automation when interacting with legacy scripts or system utilities.


5. Which regular expression character is used to match the start of a string?

A. $


B. ^


C. *


D. +


Answer: B

Información del documento

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