WGU D522 Python for IT Automation
(SKO1): The Complete -Question Q&A
Study Guide with Detailed Rationales
Domain I: Python Fundamentals – Syntax, Variables, Data Types, and
Operators (Questions 1-20)
Q1: What does Python syntax refer to?
A) The runtime environment for executing Python code
B) The set of rules that dictate valid combinations of symbols and keywords
C) The process of converting code to machine language
D) The standard library of built-in modules
Correct Answer: B
Rationale: Python syntax is the set of rules governing how symbols and
keywords combine to form valid programs. Syntax rules cover variable
naming, statement structure, and overall code organization.
Q2: What is the purpose of indentation in Python?
A) To enhance visual appearance
B) To define blocks of code
C) To separate different modules
D) To indicate the end of a program
Correct Answer: B
,Rationale: Unlike languages that use braces {}, Python uses indentation
(spaces or tabs at line starts) to define code blocks. Consistent indentation
is syntactically required.
Q3: What is the output of print("5" + "3")?
A) 8
B) 53
C) 15
D) TypeError
Correct Answer: B
Rationale: The + operator performs string concatenation when both
operands are strings. "5" and "3" are joined to produce "53". No
arithmetic occurs.
Q4: What is the result of 17 // 4?
A) 4.25
B) 4
C) 5
D) 1
Correct Answer: B
Rationale: The // operator performs floor division (integer division),
discarding the remainder. 17 // 4 = 4 because 17 divided by 4 is 4.25,
floored to 4.
Q5: What is the result of 7 % 3?
A) 2.33
B) 2
C) 1
D) 0
,Correct Answer: C
Rationale: The % operator computes the remainder after division. 7 % 3 =
1 because 3 goes into 7 twice (6) with a remainder of 1.
Q6: Which statement checks if variable age is between 18 and 65
inclusive?
A) 18 <= age <= 65
B) age >= 18 and age =< 65
C) age in range(18, 65)
D) 18 <= age < 65
Correct Answer: A
Rationale: Python supports chained comparisons. 18 <= age <=
65 checks both conditions in a single expression. Option C would exclude
65 (range stops before stop value).
Q7: What does the bool() function return for an empty string?
A) True
B) False
C) None
D) Error
Correct Answer: B
Rationale: Empty sequences (strings, lists, tuples) evaluate to False in a
boolean context. Non-empty strings evaluate to True.
Q8: Which operator is used for exponentiation?
A) ^
B) **
C) //
D) *
, Correct Answer: B
Rationale: ** is the exponentiation operator (e.g., 2**3 = 8). ^ is the
bitwise XOR operator, not exponentiation.
Q9: What is the output of print(3 * "Hi")?
A) HiHiHi
B) 3Hi
C) Hi
D) TypeError
Correct Answer: A
Rationale: The * operator repeats a string when used with an integer. "Hi"
* 3 produces "HiHiHi".
Q10: Which function returns the length of a list?
A) length()
B) count()
C) len()
D) size()
Correct Answer: C
Rationale: len() is the built-in function to return the number of items in a
container (list, tuple, string, dictionary, etc.).
Q11: What data type is produced by input("Enter age: ")?
A) int
B) float
C) str
D) bool
Correct Answer: C
(SKO1): The Complete -Question Q&A
Study Guide with Detailed Rationales
Domain I: Python Fundamentals – Syntax, Variables, Data Types, and
Operators (Questions 1-20)
Q1: What does Python syntax refer to?
A) The runtime environment for executing Python code
B) The set of rules that dictate valid combinations of symbols and keywords
C) The process of converting code to machine language
D) The standard library of built-in modules
Correct Answer: B
Rationale: Python syntax is the set of rules governing how symbols and
keywords combine to form valid programs. Syntax rules cover variable
naming, statement structure, and overall code organization.
Q2: What is the purpose of indentation in Python?
A) To enhance visual appearance
B) To define blocks of code
C) To separate different modules
D) To indicate the end of a program
Correct Answer: B
,Rationale: Unlike languages that use braces {}, Python uses indentation
(spaces or tabs at line starts) to define code blocks. Consistent indentation
is syntactically required.
Q3: What is the output of print("5" + "3")?
A) 8
B) 53
C) 15
D) TypeError
Correct Answer: B
Rationale: The + operator performs string concatenation when both
operands are strings. "5" and "3" are joined to produce "53". No
arithmetic occurs.
Q4: What is the result of 17 // 4?
A) 4.25
B) 4
C) 5
D) 1
Correct Answer: B
Rationale: The // operator performs floor division (integer division),
discarding the remainder. 17 // 4 = 4 because 17 divided by 4 is 4.25,
floored to 4.
Q5: What is the result of 7 % 3?
A) 2.33
B) 2
C) 1
D) 0
,Correct Answer: C
Rationale: The % operator computes the remainder after division. 7 % 3 =
1 because 3 goes into 7 twice (6) with a remainder of 1.
Q6: Which statement checks if variable age is between 18 and 65
inclusive?
A) 18 <= age <= 65
B) age >= 18 and age =< 65
C) age in range(18, 65)
D) 18 <= age < 65
Correct Answer: A
Rationale: Python supports chained comparisons. 18 <= age <=
65 checks both conditions in a single expression. Option C would exclude
65 (range stops before stop value).
Q7: What does the bool() function return for an empty string?
A) True
B) False
C) None
D) Error
Correct Answer: B
Rationale: Empty sequences (strings, lists, tuples) evaluate to False in a
boolean context. Non-empty strings evaluate to True.
Q8: Which operator is used for exponentiation?
A) ^
B) **
C) //
D) *
, Correct Answer: B
Rationale: ** is the exponentiation operator (e.g., 2**3 = 8). ^ is the
bitwise XOR operator, not exponentiation.
Q9: What is the output of print(3 * "Hi")?
A) HiHiHi
B) 3Hi
C) Hi
D) TypeError
Correct Answer: A
Rationale: The * operator repeats a string when used with an integer. "Hi"
* 3 produces "HiHiHi".
Q10: Which function returns the length of a list?
A) length()
B) count()
C) len()
D) size()
Correct Answer: C
Rationale: len() is the built-in function to return the number of items in a
container (list, tuple, string, dictionary, etc.).
Q11: What data type is produced by input("Enter age: ")?
A) int
B) float
C) str
D) bool
Correct Answer: C