WGU D522 (WEN1) Task 1 Performance Assessment |
Incident Response & DNS Remediation | Python,
GitLab, Device Inventory, Email, Helpdesk API &
Evidence Guide | 2026 Updated
SECTION 1: PYTHON FUNDAMENTALS FOR IT AUTOMATION
(Questions 1–50)
1. Which data type would be most appropriate for storing a collection
of unique IP addresses in Python?
A. List
B. Tuple
C. Set
D. Dictionary
Correct Answer: C
Rationale: A set is the most appropriate data type for storing
unique IP addresses because sets automatically eliminate duplicate
values. Lists and tuples allow duplicates, and while dictionaries can
store unique keys, a set is the most direct and efficient choice for a
collection of unique values without associated data .
2. What is the output of the following code? name = "IT Automation"
print(name[3:8])
A. "Auto"
B. "Autom"
C. "o Aut"
D. "Automat"
Correct Answer: C
,Rationale: String slicing in Python uses the syntax [start:stop],
where the start index is inclusive and the stop index is exclusive.
name[3:8] starts at index 3 ("o") and stops before index 8 ("t"),
resulting in "o Aut" (indices 3,4,5,6,7: o, space, A, u, t) .
3. Which operator is used for exponentiation in Python?
A. ^
B. **
C. //
D. *
Correct Answer: B
Rationale: ** is the exponentiation operator (e.g., 2**3 = 8). ^ is
bitwise XOR, not exponentiation. // is floor division .
4. What is the output of print(3 * "Hi") in Python?
A. HiHiHi
B. 3Hi
C. Hi
D. TypeError
Correct Answer: A
Rationale: The * operator repeats a string when used with an
integer. "Hi" * 3 results in "HiHiHi" .
5. What data type is produced by the input("Enter age: ") function in
Python?
,A. int
B. float
C. str
D. bool
Correct Answer: C
Rationale: The input() function always returns a string, regardless
of what the user types. Use int() or float() to convert the input to a
numeric type .
6. Which of the following statements will cause a NameError in
Python?
A. print(x) where x = 5 defined earlier
B. print(y) where y has not been defined
C. print("hello")
D. print(5)
Correct Answer: B
Rationale: A NameError occurs when a variable name is used but
has not been defined. Common causes include typos in variable names
.
7. Which escape sequence represents a tab character in Python?
A. \t
B. \n
C. \r
D. \b
Correct Answer: A
, Rationale: \t is the escape sequence for a tab character. \n is
newline, \r is carriage return, \b is backspace .
8. Which data structure is being used to store the device names in the
following code? devices = ["router01", "switch01", "modem01",
"gateway01", "printer01"]
A. Tuple
B. Dictionary
C. List
D. Set
Correct Answer: C
Rationale: Square brackets [] denote a list in Python. Lists are
ordered, mutable collections that allow duplicate values .
9. What does the slice operation my_list[1:4] return?
A. Elements at indices 1, 2, 3, and 4
B. Elements at indices 1, 2, and 3 (4 is exclusive)
C. Elements at indices 1 and 4 only
D. Elements from index 1 to the end of the list
Correct Answer: B
Rationale: In Python slicing, the stop index is exclusive, meaning
the element at that index is not included. So [1:4] includes elements at
indices 1, 2, and 3. This "off-by-one" behavior is a common source of
errors in automation scripts .
Incident Response & DNS Remediation | Python,
GitLab, Device Inventory, Email, Helpdesk API &
Evidence Guide | 2026 Updated
SECTION 1: PYTHON FUNDAMENTALS FOR IT AUTOMATION
(Questions 1–50)
1. Which data type would be most appropriate for storing a collection
of unique IP addresses in Python?
A. List
B. Tuple
C. Set
D. Dictionary
Correct Answer: C
Rationale: A set is the most appropriate data type for storing
unique IP addresses because sets automatically eliminate duplicate
values. Lists and tuples allow duplicates, and while dictionaries can
store unique keys, a set is the most direct and efficient choice for a
collection of unique values without associated data .
2. What is the output of the following code? name = "IT Automation"
print(name[3:8])
A. "Auto"
B. "Autom"
C. "o Aut"
D. "Automat"
Correct Answer: C
,Rationale: String slicing in Python uses the syntax [start:stop],
where the start index is inclusive and the stop index is exclusive.
name[3:8] starts at index 3 ("o") and stops before index 8 ("t"),
resulting in "o Aut" (indices 3,4,5,6,7: o, space, A, u, t) .
3. Which operator is used for exponentiation in Python?
A. ^
B. **
C. //
D. *
Correct Answer: B
Rationale: ** is the exponentiation operator (e.g., 2**3 = 8). ^ is
bitwise XOR, not exponentiation. // is floor division .
4. What is the output of print(3 * "Hi") in Python?
A. HiHiHi
B. 3Hi
C. Hi
D. TypeError
Correct Answer: A
Rationale: The * operator repeats a string when used with an
integer. "Hi" * 3 results in "HiHiHi" .
5. What data type is produced by the input("Enter age: ") function in
Python?
,A. int
B. float
C. str
D. bool
Correct Answer: C
Rationale: The input() function always returns a string, regardless
of what the user types. Use int() or float() to convert the input to a
numeric type .
6. Which of the following statements will cause a NameError in
Python?
A. print(x) where x = 5 defined earlier
B. print(y) where y has not been defined
C. print("hello")
D. print(5)
Correct Answer: B
Rationale: A NameError occurs when a variable name is used but
has not been defined. Common causes include typos in variable names
.
7. Which escape sequence represents a tab character in Python?
A. \t
B. \n
C. \r
D. \b
Correct Answer: A
, Rationale: \t is the escape sequence for a tab character. \n is
newline, \r is carriage return, \b is backspace .
8. Which data structure is being used to store the device names in the
following code? devices = ["router01", "switch01", "modem01",
"gateway01", "printer01"]
A. Tuple
B. Dictionary
C. List
D. Set
Correct Answer: C
Rationale: Square brackets [] denote a list in Python. Lists are
ordered, mutable collections that allow duplicate values .
9. What does the slice operation my_list[1:4] return?
A. Elements at indices 1, 2, 3, and 4
B. Elements at indices 1, 2, and 3 (4 is exclusive)
C. Elements at indices 1 and 4 only
D. Elements from index 1 to the end of the list
Correct Answer: B
Rationale: In Python slicing, the stop index is exclusive, meaning
the element at that index is not included. So [1:4] includes elements at
indices 1, 2, and 3. This "off-by-one" behavior is a common source of
errors in automation scripts .