• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 4 fuera de 95 páginas
Examen

WGU D522 Python for IT Automation OA

Document preview thumbnail
Vista previa 4 fuera de 95 páginas

WGU D522 Python for IT Automation OA

Vista previa del contenido

WGU D522 Python for IT Automation OA
Exam Prep
200 Questions & Answers with Rationales

SECTION 1: PYTHON FUNDAMENTALS (Questions 1-40)
Question 1
What is the output of the following code?
python
x=5
y=2
print(x // y)
A) 2.5
B) 2
C) 3
D) 2.0
Answer: B) 2
Rationale: The // operator performs floor division, which returns the integer
quotient rounded down. 5 // 2 = 2 (not 2.5). This is different from / which returns a
float.


Question 2
Which of the following is NOT a valid variable name in Python?
A) _my_var
B) myVar2
C) 2myVar
D) my_var

,Answer: C) 2myVar
Rationale: Python variable names cannot start with a number. They must start with
a letter (a-z, A-Z) or underscore (_). The subsequent characters can be letters,
numbers, or underscores.


Question 3
What is the result of bool([]) in Python?
A) True
B) False
C) Error
D) None
Answer: B) False
Rationale: In Python, empty sequences (lists, tuples, strings), empty dictionaries,
and the number 0 evaluate to False in a boolean context. [] is an empty list, so it
evaluates to False.


Question 4
Which method is used to add an element to the end of a list?
A) insert()
B) append()
C) extend()
D) add()
Answer: B) append()
Rationale: append() adds a single element to the end of a list. insert() adds at a
specific index, extend() adds multiple elements from another iterable, and add() is
not a list method (it's for sets).


Question 5

,What does the pass statement do in Python?
A) Terminates the program
B) Does nothing and acts as a placeholder
C) Skips the next iteration of a loop
D) Exits a function
Answer: B) Does nothing and acts as a placeholder
Rationale: pass is a null operation - it does nothing when executed. It's used as a
placeholder where syntax requires a statement but you don't want any action to be
taken, such as in empty function or class definitions.


Question 6
What is the output?
python
s = "Hello World"
print(s[6:])
A) "World"
B) "World "
C) "World"
D) "llo World"
Answer: A) "World"
Rationale: String slicing [start:end] extracts characters from index start to end-1.
Index 6 is 'W' (H=0, e=1, l=2, l=3, o=4, space=5, W=6), and since no end is
specified, it goes to the end of the string.


Question 7
Which operator is used for string concatenation?
A) &
B) .

,C) +
D) *
Answer: C) +
Rationale: In Python, the + operator concatenates strings. Example: "Hello" + " "
+ "World" results in "Hello World". * is used for repetition, not concatenation.


Question 8
What is the correct way to create a tuple?
A) my_tuple = [1, 2, 3]
B) my_tuple = (1, 2, 3)
C) my_tuple = {1, 2, 3}
D) my_tuple = <1, 2, 3>
Answer: B) my_tuple = (1, 2, 3)
Rationale: Tuples are created using parentheses (). Lists use square brackets [],
sets use curly braces {}, and angle brackets <> are not used for Python data
structures.


Question 9
What is the output of the following?
python
print(2 ** 3 ** 2)
A) 64
B) 512
C) 729
D) 128
Answer: B) 512
Rationale: The exponentiation operator ** has right-to-left associativity. So 2 ** 3
** 2 is evaluated as 2 ** (3 ** 2) = 2 ** 9 = 512.

Información del documento

Subido en
21 de noviembre de 2026
Número de páginas
95
Escrito en
2026/2027
Tipo
Examen
Contiene
Preguntas y respuestas
$21.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

Vendido
3
Seguidores
0
Artículos
142
Última venta
4 semanas 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