Back to the Introduction to Computer Science outline The Course Maker
Introduction to Computer Science outline
Week 16 · Final exam

Final Exam — Cumulative (All Objectives 1–8)

Introduction to Computer Science · CSCI 1101 Fall 2026 · Prof. Okafor Fictional sample

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 final.
Points: 100 · Assignment group: Final (25% of the course grade) · 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 L-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 live final. Its paired ungraded rehearsal — O-practice-final-week-16.md — mirrors this blueprint with fresh variants and shares none of these items.


Blueprint

# Type Concept Obj
1 Multiple choice Precedence (predict) 1
2 Multiple choice Errors 1
3 Multiple choice String concat (predict) 1
4 Multiple choice Float division (predict) 2
5 Multiple choice Modulo (predict) 2
6 Multiple choice Slicing (predict) 2
7 Multiple choice input() type 2
8 Multiple choice Boolean (predict) 3
9 Multiple choice if/elif/else (predict) 3
10 True / False = vs == 3
11 Multiple choice for accumulator (predict) 4
12 Multiple choice range (predict) 4
13 Multiple choice nested loop (predict) 4
14 Multiple choice function return (predict) 5
15 Multiple choice no return → None (predict) 5
16 Matching Function terms 5
17 Multiple choice list aliasing (predict) 6
18 Multiple choice set dedup (predict) 6
19 Multiple choice dict lookup (predict) 6
20 Multiple choice string method (predict) 7
21 Multiple choice try/except (predict) 7
22 Multiple choice exception type 7
23 Multiple choice Big-O 8
24 Multiple choice recursion (predict) 8
25 Multiple choice OOP method (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(3 + 4 * 2)
  • 14
  • 11
  • 10
  • 24
    Feedback: 4*2=8 first, then 3+8=11 (× before +).

Q2 (Multiple choice). Which error does opening a file that doesn't exist raise — and which does using an unquoted, undefined word like Hello raise?
- both SyntaxError
- FileNotFoundError and NameError, respectively
- both ValueError
- both NameError
Feedback: A missing file is FileNotFoundError; an unknown name is NameError.

Q3 (Multiple choice). What does this print?

print("3" + "4")
  • 7
  • 34
  • 12
  • an error
    Feedback: Strings join: '3'+'4' is '34'.

Q4 (Multiple choice). What does this print?

print(8 / 4)
  • 2
  • 2.0
  • 32
  • 0.5
    Feedback: / always gives a float: 8/4 is 2.0.

Q5 (Multiple choice). What does this print?

print(13 % 4)
  • 3
  • 1
  • 4
  • 3.25
    Feedback: 13 = 3*4 + 1, so the remainder is 1.

Q6 (Multiple choice). What does this print?

s = "COMPUTER"
print(s[0:4])
  • COMP
  • COMPU
  • OMPU
  • COM
    Feedback: [0:4] takes indices 0,1,2,3 (stop excluded): COMP.

Q7 (Multiple choice). After x = input(), what type is x?
- int
- str
- float
- bool
Feedback: input() always returns a string; convert with int() for math.

Q8 (Multiple choice). What does this print?

print(not (5 < 3))
  • True
  • False
  • 5
  • an error
    Feedback: 5 < 3 is False; not False is True.

Q9 (Multiple choice). What does this print?

n = 0
if n > 0:
    print('positive')
elif n < 0:
    print('negative')
else:
    print('zero')
  • positive
  • negative
  • zero
  • nothing
    Feedback: 0 is neither > 0 nor < 0, so the else runs: zero.

Q10 (True / False). Using a single = inside an if condition (like if x = 5:) is a SyntaxError.
- True
- False
Feedback: True — = assigns; a condition needs == to compare.

Q11 (Multiple choice). What does this print?

total = 0
for i in range(1, 5):
    total += i
print(total)
  • 10
  • 15
  • 4
  • 5
    Feedback: range(1,5) is 1,2,3,4; sum is 10.

Q12 (Multiple choice). What does this print?

print(list(range(2, 8, 2)))
  • [2, 4, 6]
  • [2, 4, 6, 8]
  • [2, 3, 4, 5, 6, 7]
  • [0, 2, 4, 6]
    Feedback: Start 2, step 2, stop 8 (excluded): 2,4,6.

Q13 (Multiple choice). How many times does this print a star?

for i in range(3):
    for j in range(2):
        print('*')
  • 5
  • 6
  • 3
  • 2
    Feedback: 3 outer × 2 inner = 6.

Q14 (Multiple choice). What does this print?

def triple(n):
    return n * 3
print(triple(4))
  • 7
  • 12
  • 43
  • None
    Feedback: triple(4) returns 4*3 = 12.

Q15 (Multiple choice). What does this print?

def show(x):
    print(x)
r = show(9)
print(r)
  • 9 then 9
  • 9 then None
  • 9 then 0
  • None then 9
    Feedback: show prints 9 but has no return, so r is None.

Q16 (Matching). Match each term to its meaning.
| Left | Correct match |
|---|---|
| Parameter | A variable in the function definition |
| Argument | A value passed in when calling |
| return | Hands a value back to the caller |
| Local scope | A variable only visible inside its function |
Feedback: Parameters are in the definition; arguments are passed in; return hands a value back; local variables stay inside.

Q17 (Multiple choice). What does this print?

a = [1, 2]
b = a
b.append(3)
print(a)
  • [1, 2]
  • [1, 2, 3]
  • [3]
  • an error
    Feedback: b = a aliases the SAME list, so appending to b changes a too.

Q18 (Multiple choice). What does this print?

print(len({1, 2, 2, 3, 3, 3}))
  • 6
  • 3
  • 2
  • 1
    Feedback: A set keeps only unique values: {1,2,3}, length 3.

Q19 (Multiple choice). What does this print?

ages = {"Ada": 30, "Lin": 25}
print(ages["Lin"])
  • 25
  • 30
  • Lin
  • KeyError
    Feedback: ages['Lin'] looks up the value for key 'Lin': 25.

Q20 (Multiple choice). What does this print?

print("hello".upper())
  • hello
  • HELLO
  • Hello
  • an error
    Feedback: .upper() returns a new uppercased string: HELLO.

Q21 (Multiple choice). What does this print?

try:
    print(int('x'))
except ValueError:
    print('caught')
  • x
  • caught
  • 0
  • crashes
    Feedback: int('x') raises ValueError, so the except runs: caught.

Q22 (Multiple choice). Which exception does looking up a missing dictionary key raise?
- ValueError
- KeyError
- IndexError
- FileNotFoundError
Feedback: A missing dict key raises KeyError.

Q23 (Multiple choice). Binary search on a sorted list has which time complexity?
- O(1)
- O(log n)
- O(n)
- O(n squared)
Feedback: Binary search halves the list each step: O(log n).

Q24 (Multiple choice). What does this print?

def fact(n):
    if n == 0:
        return 1
    return n * fact(n - 1)
print(fact(4))
  • 24
  • 12
  • 4
  • RecursionError
    Feedback: 4! = 432*1 = 24 (base case n==0 stops it).

Q25 (Multiple choice). What does this print?

class Dog:
    def __init__(self, name):
        self.name = name
    def speak(self):
        return self.name + ' barks'
print(Dog('Rex').speak())
  • Rex barks
  • barks
  • Dog barks
  • AttributeError
    Feedback: init stores self.name='Rex'; speak() returns 'Rex barks'.

Answer key (quick reference)

Q Answer Q Answer
1 B 14 B
2 B 15 B
3 B 16 1-to-1 (see above)
4 B 17 B
5 B 18 B
6 A 19 A
7 B 20 B
8 A 21 B
9 C 22 B
10 True 23 B
11 A 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. Q1 11; Q4 2.0; Q6 COMP; Q11 10; Q17 [1, 2, 3]; Q18 3; Q20 HELLO; Q21 caught; Q24 24; Q25 Rex barks).
  • 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 O-practice-final-week-16.md (verified by full stem comparison — same objectives, different programs and values).

Canvas placement block

canvas_object             = Quizzes::Quiz
title                     = "Final Exam — Cumulative (All Objectives)"
assignment_group          = "Final"
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"
This is the human-readable exam with its vetted answer key and rationale. The import-ready Classic-QTI version (L-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