WGU D522 PYTHON FOR IT
AUTOMATION FINAL EXAM STUDY
GUIDE
1. Which of the following data types in Python is considered immutable?
A. List
B. Dictionary
C. Tuple
D. Set
Answer: C
Conceptual Explanation: Tuples are immutable, meaning their elements cannot be
changed after creation. Lists, Dictionaries, and Sets are all mutable.
2. When using the ‘os’ module, which function is most appropriate for creating a platform-
independent file path?
A. os.mkdir()
B. os.path.join()
C. os.path.abspath()
,D. os.path.exists()
Answer: B
Conceptual Explanation: os.path.join() automatically handles the specific path separators
for different operating systems (e.g., / for Linux/macOS and for Windows).
3. What is the result of the expression 10 // 3 in Python 3?
A. 3.333
B. 3
C. 3.0
D. 1
Answer: B
Conceptual Explanation: The // operator performs floor division, which returns the
largest integer less than or equal to the result of the division.
4. In the ‘re’ module, which character is used to match the start of a string?
A. ^
B. *
C. $
D. +
Answer: A
, Conceptual Explanation: The caret symbol (^) matches the beginning of a string or line in
regular expressions.
5. Which keyword is used to handle exceptions that may occur during the execution of a code
block?
A. catch
B. throw
C. error
D. except
Answer: D
Conceptual Explanation: In Python, the ‘try…except’ block is used to catch and handle
exceptions.
6. When opening a file using open(‘data.txt’, ‘a’), what does the ‘a’ mode represent?
A. Append data to the end
B. Overwrite existing data
C. Read only
D. Open for binary processing
Answer: A
Conceptual Explanation: The ‘a’ mode stands for append, which allows adding data to the
end of a file without deleting existing content.
AUTOMATION FINAL EXAM STUDY
GUIDE
1. Which of the following data types in Python is considered immutable?
A. List
B. Dictionary
C. Tuple
D. Set
Answer: C
Conceptual Explanation: Tuples are immutable, meaning their elements cannot be
changed after creation. Lists, Dictionaries, and Sets are all mutable.
2. When using the ‘os’ module, which function is most appropriate for creating a platform-
independent file path?
A. os.mkdir()
B. os.path.join()
C. os.path.abspath()
,D. os.path.exists()
Answer: B
Conceptual Explanation: os.path.join() automatically handles the specific path separators
for different operating systems (e.g., / for Linux/macOS and for Windows).
3. What is the result of the expression 10 // 3 in Python 3?
A. 3.333
B. 3
C. 3.0
D. 1
Answer: B
Conceptual Explanation: The // operator performs floor division, which returns the
largest integer less than or equal to the result of the division.
4. In the ‘re’ module, which character is used to match the start of a string?
A. ^
B. *
C. $
D. +
Answer: A
, Conceptual Explanation: The caret symbol (^) matches the beginning of a string or line in
regular expressions.
5. Which keyword is used to handle exceptions that may occur during the execution of a code
block?
A. catch
B. throw
C. error
D. except
Answer: D
Conceptual Explanation: In Python, the ‘try…except’ block is used to catch and handle
exceptions.
6. When opening a file using open(‘data.txt’, ‘a’), what does the ‘a’ mode represent?
A. Append data to the end
B. Overwrite existing data
C. Read only
D. Open for binary processing
Answer: A
Conceptual Explanation: The ‘a’ mode stands for append, which allows adding data to the
end of a file without deleting existing content.