Study Guide 2026: Complete Performance
Assessment Solutions with 200+ Practice
Questions, Rationales, and Test-Taking
Strategies to Guarantee a Pass
Question 1: Decorators (Advanced Topic from Top Resource)
What is the output of this code?
python
def decorator(func):
def wrapper():
print("Before")
func()
print("After")
return wrapper
@decorator
def say_hello():
print("Hello")
say_hello()
A. Hello
B. Before then Hello then After
C. Before then After
D. Error (invalid syntax)
Correct Answer: B Before then Hello then After
,Rationale: The decorator wraps the say_hello function, adding behavior before and
after the original function call. This is a frequently tested advanced concept in the
OA .
Question 2: Immutable Types (Multiple Response - Popular
Format)
Select all that apply: Which of the following Python types are immutable?
A. List
B. Tuple
C. String
D. Dictionary
E. Frozenset
Correct Answers: B, C, E (Tuple, String, Frozenset)
Rationale: Immutable objects cannot be changed after creation. This concept
appears consistently in both the PA and OA. Lists and dictionaries are mutable .
Question 3: Exception Handling (Core Topic)
Which keyword is used in Python to catch and handle exceptions?
A. catch/throw
B. try/except
C. do/catch
D. begin/rescue
Correct Answer: B try/except
Rationale: The try/except block is Python's standard exception handling mechanism,
essential for writing robust scripts that can handle errors without crashing .
Question 4: List Methods (PA-Style Task)
What will this code output?
python
numbers = [5, 2, 8, 1, 9]
numbers.sort()
numbers.append(3)
print(numbers[2])
,A. 2
B. 3
C. 5
D. 8
Correct Answer: C 5
Rationale: After sort(), the list becomes [1, 2, 5, 8, 9]. Appending 3 gives [1, 2,
5, 8, 9, 3]. Index 2 is the third element, which is 5. This tests understanding of
sorting, append, and indexing .
Question 5: Dictionary Access (Common OA Pattern)
What is the result of this code?
python
student = {"name": "Alex", "grade": "A", "age": 20}
print(student.get("major", "Undeclared"))
A. None
B. Error (KeyError)
C. "Undeclared"
D. "major"
Correct Answer: C "Undeclared"
Rationale: The .get() method safely accesses dictionary keys, returning the default
value "Undeclared" since "major" doesn't exist. This is a safer alternative to direct key
access .
Question 6: Loops and Range (PA Foundation)
What will this code print?
python
for i in range(3, 8, 2):
print(i, end=" ")
A. 3 4 5 6 7
B. 3 5 7
C. 3 5 7 8
D. 3 5 7 9
Correct Answer: B 3 5 7
, Rationale: range(3, 8, 2) starts at 3, stops before 8, and increments by 2 each step
→ 3, 5, 7. The end=" " prints them on one line with spaces .
Question 7: Leap Year Logic (Real-World Scenario)
Which expression correctly identifies a leap year?
A. year % 4 == 0
B. year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
C. year % 400 == 0
D. year % 4 == 0 and year % 100 != 0
Correct Answer: B year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
Rationale: Leap year rules: divisible by 4, except century years unless divisible by
400. This exact logic appears in OA questions testing conditional logic .
Question 8: String Formatting (Critical for PA Success)
What is the correct f-string syntax to output "Hello, Alice! You are 25 years
old."?
A. print("Hello, {name}! You are {age} years old.")
B. print(f"Hello, {name}! You are {age} years old.")
C. print("Hello, " + name + "! You are " + age + " years old.")
D. print("Hello, %s! You are %d years old." % (name, age))
Correct Answer: B print(f"Hello, {name}! You are {age} years old.")
Rationale: f-strings (formatted string literals) require the 'f' prefix before the string.
This is the modern, recommended approach in Python and appears in PA task 1 .
Question 9: Set Operations (Data Structures)
What will this code output?
python
set1 = {1, 2, 3}
set2 = {2, 3, 4}
print(set1 & set2)
A. {1, 2, 3, 4}
B. {2, 3}