• ¿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 48 páginas
Examen

WGU D522 Python for IT Automation

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

WGU D522 Python for IT Automation

Vista previa del contenido

WGU D522 Python for IT Automation - 200
Exam Questions & Answers (2026/2027)
Version 1: Python Fundamentals & Data
Structures
Section 1: Python Basics & Syntax
(Questions 1-25)
Q1: What is the primary use of whitespace in Python?
A) To improve code readability only
B) To define the structure and hierarchy of the code
C) To separate variables
D) To indicate comments
Answer: B
Rationale: In Python, whitespace (indentation) is syntactically significant and
defines code blocks, unlike many other languages that use curly braces or
keywords. This is a fundamental Python concept .
Q2: Which of the following is NOT a valid Python variable name?
A) my_var
B) _internal
C) 2nd_attempt
D) userName
Answer: C
Rationale: Python variable names cannot start with a number. They must start with
a letter or underscore and can only contain letters, numbers, and underscores .
Q3: What does the input() function return in Python?
A) An integer
B) A float
C) A string
D) A boolean

,Answer: C
Rationale: The input() function always returns user input as a string, regardless of
what the user types. Type conversion must be performed separately .
Q4: Which error occurs when a program tries to use a variable that does not
exist?
A) Syntax Error
B) ValueError
C) NameError
D) TypeError
Answer: C
Rationale: A NameError is raised when Python encounters a variable name that
hasn't been defined in the current scope .
Q5: What is the purpose of indentation in Python?
A) To make code look professional
B) To define blocks of code
C) To separate statements
D) To indicate comments
Answer: B
Rationale: Indentation is how Python defines scope for control flow statements,
functions, and classes. Inconsistent indentation causes IndentationError .
Q6: Which Python data type represents an ordered, mutable sequence?
A) Tuple
B) Set
C) List
D) Dictionary
Answer: C
Rationale: Lists are ordered, mutable collections that allow indexing, slicing, and
modification. This makes them ideal for storing sequences that need to change .
Q7: What happens when an operation involves both an int and a float in
Python?
A) An error occurs
B) The result is automatically promoted to float
C) The result is truncated to int

,D) The operation is ignored
Answer: B
Rationale: Python automatically promotes integers to floats when performing
operations with floating-point numbers to preserve precision .
Q8: Which escape character creates a new line in a string?
A) \t
B) \n
C) \r
D) \b
Answer: B
Rationale: The \n escape sequence inserts a newline character in a string .
Q9: What is the result of print("Hello" + 5) in Python?
A) Hello5
B) 5Hello
C) TypeError
D) Hello 5
Answer: C
Rationale: The + operator cannot concatenate a string and an integer. This raises
a TypeError, requiring explicit type conversion .
Q10: Which method removes leading and trailing whitespace from a string?
A) trim()
B) strip()
C) remove()
D) clean()
Answer: B
Rationale: The strip() method removes leading and trailing whitespace
characters. lstrip() and rstrip() remove from left or right only .
Q11: What does the len() function return when used on a list?
A) The number of characters in the list representation
B) The number of elements in the list
C) The memory size of the list
D) The last index of the list
Answer: B

,Rationale: len() returns the total number of elements in an iterable, including lists,
tuples, strings, and dictionaries .
Q12: What are the three components of a string slice?
A) [start:end:count]
B) [start:stop:step]
C) [begin:finish:increment]
D) [first:last:skip]
Answer: B
Rationale: String slicing uses [start:stop:step] where start is inclusive, stop is
exclusive, and step is optional .
Q13: What does the // operator do in Python?
A) Performs regular division
B) Performs floor division
C) Performs modulo operation
D) Performs exponentiation
Answer: B
Rationale: The // operator performs floor division, rounding down to the nearest
whole number and discarding the decimal part .
Q14: Which of the following are truthy values in Python?
A) 0, None, ""
B) 1, "Hello", [1,2]
C) False, 0, []
D) None, False, 0
Answer: B
Rationale: Truthy values include non-zero numbers and non-empty collections.
Falsy values include zero, None, and empty collections .
Q15: How do you check the version of Python you are using?
A) python --version
B) import sys; print(sys.version)
C) version()
D) import os; print(os.version)
Answer: B

Información del documento

Subido en
21 de noviembre de 2026
Número de páginas
48
Escrito en
2026/2027
Tipo
Examen
Contiene
Preguntas y respuestas
$23.49

¿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
3 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