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

D 522 Exam 1 V3 | 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 26 páginas

D 522 Exam 1 V3 | 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 V3 | 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 to retrieve command-line arguments

passed to a script?

A. os


B. sys


C. subprocess


D. argparse


Answer: B


Rationale: The sys module provides access to some variables used or maintained by the

interpreter. Specifically, sys.argv is a list in Python, which contains the command-line

arguments passed to the script. This is fundamental for IT automation when scripts need to

handle dynamic input from the shell.


2. When opening a file in Python using open(‘data.txt’, ‘a’), what does the ‘a’ mode signify?

A. Append mode


B. Write mode (overwrite)


C. Read mode

,D. Binary mode


Answer: A


Rationale: The ‘a’ mode stands for append, which allows data to be added to the end of the

file without deleting existing content. If the file does not exist, Python will create a new one.

This is essential for logging tasks where historical data must be preserved.


3. What is the result of the expression 10 // 3 in Python?

A. 3.333


B. Error


C. 1


D. 3


Answer: D


Rationale: The double forward slash represents floor division in Python. It divides the first

number by the second and rounds down to the nearest whole number. This is distinct from

the single slash, which would return a floating-point result.


4. Which data type in Python is unordered, mutable, and does not allow duplicate elements?

A. List


B. Tuple


C. Set


D. Dictionary

, Answer: C


Rationale: A set is a collection which is unordered and unindexed. It is highly efficient for

membership testing and eliminating duplicate entries from other collections. Unlike lists,

sets do not maintain the order in which items were added.


5. In Python, how is a block of code defined for a function or a loop?

A. Curly braces {}


B. Keywords begin and end


C. Parentheses ()


D. Indentation


Answer: D


Rationale: Python uses indentation to indicate the scope of code blocks. This is a unique

feature compared to languages like C++ or Java that use braces. Consistent use of spaces or

tabs is mandatory for the script to execute correctly.


6. Which method is used to remove leading and trailing whitespace from a string?

A. strip()


B. clean()


C. trim()


D. remove()


Answer: A

Información del documento

Subido en
16 de julio de 2026
Número de páginas
26
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$16.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