Practice Final — Cumulative (All Objectives 1–8)
Course: Introduction to Computer Science — CS1 / Programming Fundamentals in Python (CSCI 1101) · Silver Oak University (fictional sample) · Prof. Okafor
Scope: Cumulative — all 8 objectives, Weeks 1–15: computing & errors · variables/types/expressions · I/O & strings · Booleans & conditionals · loops · functions · lists/tuples/dicts/sets · strings/files/exceptions · algorithms, recursion & intro OOP.
Format: 25 items, 100 points (4 points each) · auto-gradable only (multiple-choice, multiple-answer, matching, true/false) with predict-the-output, debugging, and Boolean-result items. AI is not permitted on the practice final (ungraded rehearsal).
Points: 100 · Assignment group: Practice (ungraded) (0% — rehearsal) · Window: opens at the start of the module; due 6 days later · allowed attempts: 1.
Human-readable exam with its vetted answer key and one-line feedback. Import-ready Classic QTI 1.2 in
O-practice-final-week-16-qti.xml(generated by the validated script — parses with 25 items, every single-answer item exactly one correct). Execution gate: PASS — every keyed output/result was produced by running the code.This is the ungraded practice final. It mirrors the live
L-final-week-16.mdblueprint with fresh variants and shares none of its items — use it to rehearse.
Blueprint
| # | Type | Concept | Obj |
|---|---|---|---|
| 1 | Multiple choice | Precedence (predict) | 1 |
| 2 | Multiple choice | Errors | 1 |
| 3 | Multiple choice | print commas (predict) | 1 |
| 4 | Multiple choice | Float division (predict) | 2 |
| 5 | Multiple choice | Floor division (predict) | 2 |
| 6 | Multiple choice | Slicing (predict) | 2 |
| 7 | Multiple choice | type conversion (predict) | 2 |
| 8 | Multiple choice | Boolean (predict) | 3 |
| 9 | Multiple choice | if/elif/else (predict) | 3 |
| 10 | True / False | Boolean result | 3 |
| 11 | Multiple choice | while (predict) | 4 |
| 12 | Multiple choice | range (predict) | 4 |
| 13 | Multiple choice | for over string (predict) | 4 |
| 14 | Multiple choice | function return (predict) | 5 |
| 15 | Multiple choice | scope | 5 |
| 16 | Matching | Function terms | 5 |
| 17 | Multiple choice | list method (predict) | 6 |
| 18 | Multiple choice | dict KeyError (predict) | 6 |
| 19 | Multiple choice | tuple immutability | 6 |
| 20 | Multiple choice | string method (predict) | 7 |
| 21 | Multiple choice | string immutability (predict) | 7 |
| 22 | Multiple choice | exception type | 7 |
| 23 | Multiple choice | Big-O | 8 |
| 24 | Multiple choice | recursion (predict) | 8 |
| 25 | Multiple choice | OOP attribute (predict) | 8 |
Objective totals: Obj 1 = 3 · Obj 2 = 4 · Obj 3 = 3 · Obj 4 = 3 · Obj 5 = 3 · Obj 6 = 3 · Obj 7 = 3 · Obj 8 = 3 → 25 items, 100 points. Cumulative over the whole course.
Questions, key, and feedback
Q1 (Multiple choice). What does this print?
print(2 * 5 - 3)
- 4
- 7 ✅
- 13
- -1
Feedback: 2*5=10 first, then 10-3=7.
Q2 (Multiple choice). A program runs print("hi" (missing close paren). What error?
- NameError
- SyntaxError ✅
- ValueError
- no error
Feedback: A missing ) breaks the grammar: SyntaxError.
Q3 (Multiple choice). What does this print?
print("a", "b", "c")
- abc
- a b c ✅
- a,b,c
- 'a' 'b' 'c'
Feedback: Commas put a single space between the items: a b c.
Q4 (Multiple choice). What does this print?
print(15 / 5)
- 3
- 3.0 ✅
- 75
- 0.33
Feedback: / always gives a float: 15/5 is 3.0.
Q5 (Multiple choice). What does this print?
print(20 // 6)
- 3 ✅
- 3.33
- 2
- 4
Feedback: // floors the result: 20//6 is 3.
Q6 (Multiple choice). What does this print?
s = "PROGRAM"
print(s[2:5])
- OGR ✅
- OGRA
- ROG
- GRA
Feedback: [2:5] takes indices 2,3,4: O, G, R.
Q7 (Multiple choice). What does this print?
print(int('7') + 3)
- 73
- 10 ✅
- an error
- 7
Feedback: int('7') is the number 7, plus 3 is 10.
Q8 (Multiple choice). What does this print?
print(True and False)
- True
- False ✅
- None
- an error
Feedback: and needs BOTH true; one is False, so False.
Q9 (Multiple choice). What does this print?
x = 100
if x >= 90:
print('A')
elif x >= 80:
print('B')
else:
print('C')
- A ✅
- B
- C
- nothing
Feedback: 100 >= 90 is true, so the first branch runs: A.
Q10 (True / False). The expression (2 > 1) or (1 > 2) evaluates to True.
- True ✅
- False
Feedback: True — or needs only one true part, and 2 > 1 is true.
Q11 (Multiple choice). What does this print?
n = 5
count = 0
while n > 0:
count += 1
n -= 1
print(count)
- 4
- 5 ✅
- 6
- forever
Feedback: It loops while n is 5,4,3,2,1 — five times — so count is 5.
Q12 (Multiple choice). What does this print?
print(list(range(1, 6)))
- [1, 2, 3, 4, 5] ✅
- [1, 2, 3, 4, 5, 6]
- [0, 1, 2, 3, 4, 5]
- [1, 6]
Feedback: range(1,6) is 1..5 (stop 6 excluded).
Q13 (Multiple choice). What does this print?
n = 0
for c in "python":
n += 1
print(n)
- 5
- 6 ✅
- 1
- python
Feedback: 'python' has 6 letters, so the loop runs 6 times.
Q14 (Multiple choice). What does this print?
def add_one(n):
return n + 1
print(add_one(9))
- 10 ✅
- 91
- 9
- None
Feedback: add_one(9) returns 9+1 = 10.
Q15 (Multiple choice). What happens?
def f():
y = 10
f()
print(y)
- prints 10
- prints None
- NameError (y is local to f) ✅
- prints 0
Feedback: y is local to f; using it outside raises NameError.
Q16 (Matching). Match each Python keyword or term to its meaning.
| Left | Correct match |
|---|---|
| def | Begins a function definition |
| return | Sends a value back to the caller |
| argument | A value passed into a call |
| None | What a function with no return gives back |
Feedback: def defines; return sends back; an argument is passed in; no return gives None.
Q17 (Multiple choice). What does this print?
nums = [3, 1, 2]
nums.append(4)
print(nums)
- [3, 1, 2]
- [3, 1, 2, 4] ✅
- [4, 3, 1, 2]
- [1, 2, 3, 4]
Feedback: .append(4) adds 4 to the END of the list.
Q18 (Multiple choice). What does this print?
d = {"x": 1}
try:
print(d["y"])
except KeyError:
print("no key")
- 1
- no key ✅
- y
- None
Feedback: d['y'] is a missing key (KeyError), so the except runs: no key.
Q19 (Multiple choice). What happens if you try t = (1, 2); t[0] = 9?
- t becomes (9, 2)
- TypeError — tuples are immutable ✅
- t becomes [9, 2]
- nothing
Feedback: Tuples can't be changed; assigning to an element raises TypeError.
Q20 (Multiple choice). What does this print?
print("a,b,c".split(","))
- ['a', 'b', 'c'] ✅
- 'abc'
- ['a,b,c']
- a b c
Feedback: .split(',') breaks the string at commas into a list of 3 strings.
Q21 (Multiple choice). What does this print?
s = "hi"
s.upper()
print(s)
- HI
- hi ✅
- Hi
- an error
Feedback: Strings are immutable: .upper() returns a NEW string; s is unchanged unless you reassign it.
Q22 (Multiple choice). Which exception does int('hello') raise?
- ValueError ✅
- KeyError
- TypeError
- SyntaxError
Feedback: Converting non-numeric text with int() raises ValueError.
Q23 (Multiple choice). Linear search through a list of n items has which time complexity?
- O(1)
- O(log n)
- O(n) ✅
- O(n squared)
Feedback: Linear search may check every item: O(n).
Q24 (Multiple choice). What does this print?
def countdown(n):
if n == 0:
print('done')
return
print(n)
countdown(n - 1)
countdown(2)
- 2 1 done ✅
- done 2 1
- 2 1 0
- 1 2 done
Feedback: Prints 2, then 1, then the base case prints done last.
Q25 (Multiple choice). What does this print?
class Box:
def __init__(self, size):
self.size = size
b = Box(7)
print(b.size)
- 7 ✅
- Box
- size
- AttributeError
Feedback: init stored self.size = 7, so b.size is 7.
Answer key (quick reference)
| Q | Answer | Q | Answer |
|---|---|---|---|
| 1 | B | 14 | A |
| 2 | B | 15 | C |
| 3 | B | 16 | 1-to-1 (see above) |
| 4 | B | 17 | B |
| 5 | A | 18 | B |
| 6 | A | 19 | B |
| 7 | B | 20 | A |
| 8 | B | 21 | B |
| 9 | A | 22 | A |
| 10 | True | 23 | C |
| 11 | B | 24 | A |
| 12 | A | 25 | A |
| 13 | B |
Quality gate (self-checked)
- Structure: 25 items, 4 points each, 100 points; coverage Obj 1 = 3 · 2 = 4 · 3 = 3 · 4 = 3 · 5 = 3 · 6 = 3 · 7 = 3 · 8 = 3.
- Execution gate: PASS — all 20 predict-the-output / behavior items were re-run in Python and their keyed outputs confirmed (e.g. P1 7; P4 3.0; P6 OGR; P11 5; P17 [3, 1, 2, 4]; P18 no key; P20 ['a', 'b', 'c']; P24 countdown; P25 7).
- Single-answer integrity: every multiple-choice and true/false item has exactly one correct option; matching items pair one-to-one; multiple-answer items key the exact set.
- Integrity vs. the practice final: 0 items are shared with the live
L-final-week-16.md(verified by full stem comparison).
Canvas placement block
canvas_object = Quizzes::Quiz
title = "Practice Final — Cumulative"
assignment_group = "Practice (ungraded)"
points_possible = 100
grading_type = points
available_from_offset_days = 0
due_offset_days = 6
published = true
allowed_attempts = 1
shuffle_answers = true
ai_permitted = false
provenance = "~ Prof. Okafor's edition · Fall 2026 · built with thecoursemaker.com"
O-practice-final-week-16-qti.xml) ships inside the course's .imscc package — it lands in the Canvas gradebook on import.~ Prof. Okafor's edition · Fall 2026 · built with thecoursemaker.com