WGU D522: python for It Automation|(SKO1)
Study Tips 2024/2025;(100% Guaranteed
success)
SECTION 1: PYTHON FUNDAMENTALS (Q1–Q30)
Q1. Which Python data type is immutable?
A) List
B) Dictionary
C) Tuple
D) Set
Correct Answer: C) Tuple
Rationale: Tuples are immutable — once created, elements cannot be added, removed, or
changed. Lists are mutable, dictionaries are mutable (keys must be immutable), and sets are
mutable. Immutability makes tuples suitable for dictionary keys and fixed configuration values in
automation scripts .
Q2. What does len("Automation") return?
A) 9
B) 10
C) 11
D) Error
Correct Answer: B) 10
Rationale: len() counts all characters in the string. "Automation" has 10 characters: A-u-t-o-
m-a-t-i-o-n. This function is essential for validating input lengths and processing text data from
logs or configurations .
Q3. Which statement correctly reads an integer from user input?
A) value = input("Enter: ")
B) value = int(input("Enter: "))
,C) value = float(input("Enter: "))
D) value = str(input("Enter: "))
Correct Answer: B) value = int(input("Enter: "))
Rationale: input() always returns a string in Python 3. To store an integer, you must wrap it
with int(). Option A stores a string, C stores a float, and D stores a string (str of a str is
redundant). This is critical for reading numeric configuration values or port numbers .
Q4. What is the output of print(17 // 5)?
A) 3.4
B) 3
C) 4
D) 2
Correct Answer: B) 3
Rationale: // is floor division, which returns the largest integer less than or equal to the
result. 17/5 = 3.4, floored to 3. This differs from / which returns 3.4 as a float. Floor division is
useful for calculating pagination, chunk sizes, or device ID extraction .
Q5. What is the result of 7 % 3?
A) 2
B) 1
C) 3
D) 0
Correct Answer: B) 1
Rationale: % is the modulus operator, returning the remainder. 7 divided by 3 is 2 with
remainder 1. Common uses include checking even/odd (x % 2 == 0) and cycling through values (i
% 7 to wrap indices) .
Q6. Which of the following is a valid Python identifier?
A) 2nd_device
B) device-2
,C) device_2
D) class
Correct Answer: C) device_2
Rationale: Identifiers must start with a letter or underscore, cannot contain hyphens, and
cannot be Python keywords like class. device_2 follows all rules. This matters when naming
variables in automation scripts .
Q7. What does type(3.14) return?
A) <class 'int'>
B) <class 'float'>
C) <class 'str'>
D) <class 'double'>
Correct Answer: B) <class 'float'>
Rationale: 3.14 is a floating-point number. Python has no double type — all decimal
numbers are float. Use type() to verify data types when processing values from external sources
like CSV files .
Q8. What is the output of print(bool(""))?
A) True
B) False
C) Error
D) None
Correct Answer: B) False
Rationale: Empty strings are "falsy" in Python. Non-empty strings are truthy. This is
important when validating user input or checking if a configuration value was provided .
Q9. Which operator checks for equality?
A) =
B) ==
, C) !=
D) =>
Correct Answer: B) ==
Rationale: = assigns a value; == compares for equality. Using = in a condition causes a
SyntaxError. This is one of the most common beginner mistakes and a common exam trap .
Q10. What is the output of "Hello" + " " + "World"?
A) Hello World
B) HelloWorld
C) Hello+World
D) Error
Correct Answer: A) Hello World
Rationale: The + operator concatenates strings. The space in the middle string is included.
Concatenation requires both operands to be strings — mixing str and int raises TypeError .
Q11. What does "Error: " + 404 produce?
A) Error: 404
B) TypeError
C) Error:404
D) ValueError
Correct Answer: B) TypeError
Rationale: Python does not implicitly convert types in concatenation. You must use str(404)
first. This is a frequent error when building log messages or constructing API payloads .
Q12. Which function converts a string to an integer?
A) str()
B) float()
C) int()
D) bool()
Correct Answer: C) int()
Study Tips 2024/2025;(100% Guaranteed
success)
SECTION 1: PYTHON FUNDAMENTALS (Q1–Q30)
Q1. Which Python data type is immutable?
A) List
B) Dictionary
C) Tuple
D) Set
Correct Answer: C) Tuple
Rationale: Tuples are immutable — once created, elements cannot be added, removed, or
changed. Lists are mutable, dictionaries are mutable (keys must be immutable), and sets are
mutable. Immutability makes tuples suitable for dictionary keys and fixed configuration values in
automation scripts .
Q2. What does len("Automation") return?
A) 9
B) 10
C) 11
D) Error
Correct Answer: B) 10
Rationale: len() counts all characters in the string. "Automation" has 10 characters: A-u-t-o-
m-a-t-i-o-n. This function is essential for validating input lengths and processing text data from
logs or configurations .
Q3. Which statement correctly reads an integer from user input?
A) value = input("Enter: ")
B) value = int(input("Enter: "))
,C) value = float(input("Enter: "))
D) value = str(input("Enter: "))
Correct Answer: B) value = int(input("Enter: "))
Rationale: input() always returns a string in Python 3. To store an integer, you must wrap it
with int(). Option A stores a string, C stores a float, and D stores a string (str of a str is
redundant). This is critical for reading numeric configuration values or port numbers .
Q4. What is the output of print(17 // 5)?
A) 3.4
B) 3
C) 4
D) 2
Correct Answer: B) 3
Rationale: // is floor division, which returns the largest integer less than or equal to the
result. 17/5 = 3.4, floored to 3. This differs from / which returns 3.4 as a float. Floor division is
useful for calculating pagination, chunk sizes, or device ID extraction .
Q5. What is the result of 7 % 3?
A) 2
B) 1
C) 3
D) 0
Correct Answer: B) 1
Rationale: % is the modulus operator, returning the remainder. 7 divided by 3 is 2 with
remainder 1. Common uses include checking even/odd (x % 2 == 0) and cycling through values (i
% 7 to wrap indices) .
Q6. Which of the following is a valid Python identifier?
A) 2nd_device
B) device-2
,C) device_2
D) class
Correct Answer: C) device_2
Rationale: Identifiers must start with a letter or underscore, cannot contain hyphens, and
cannot be Python keywords like class. device_2 follows all rules. This matters when naming
variables in automation scripts .
Q7. What does type(3.14) return?
A) <class 'int'>
B) <class 'float'>
C) <class 'str'>
D) <class 'double'>
Correct Answer: B) <class 'float'>
Rationale: 3.14 is a floating-point number. Python has no double type — all decimal
numbers are float. Use type() to verify data types when processing values from external sources
like CSV files .
Q8. What is the output of print(bool(""))?
A) True
B) False
C) Error
D) None
Correct Answer: B) False
Rationale: Empty strings are "falsy" in Python. Non-empty strings are truthy. This is
important when validating user input or checking if a configuration value was provided .
Q9. Which operator checks for equality?
A) =
B) ==
, C) !=
D) =>
Correct Answer: B) ==
Rationale: = assigns a value; == compares for equality. Using = in a condition causes a
SyntaxError. This is one of the most common beginner mistakes and a common exam trap .
Q10. What is the output of "Hello" + " " + "World"?
A) Hello World
B) HelloWorld
C) Hello+World
D) Error
Correct Answer: A) Hello World
Rationale: The + operator concatenates strings. The space in the middle string is included.
Concatenation requires both operands to be strings — mixing str and int raises TypeError .
Q11. What does "Error: " + 404 produce?
A) Error: 404
B) TypeError
C) Error:404
D) ValueError
Correct Answer: B) TypeError
Rationale: Python does not implicitly convert types in concatenation. You must use str(404)
first. This is a frequent error when building log messages or constructing API payloads .
Q12. Which function converts a string to an integer?
A) str()
B) float()
C) int()
D) bool()
Correct Answer: C) int()