Back to the Introduction to Computer Science outline The Course Maker
Introduction to Computer Science outline
Week 8 · Practice exam

Practice Midterm — Cumulative (Weeks 1–7) · Objectives 1–5

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 — Weeks 1–7, Objectives 1–5 (computing & first programs · variables, types, expressions, I/O & strings · Booleans & conditionals · while & for loops · functions).
Format: 20 items, 100 points (5 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 midterm (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-exam-week-08-qti.xml (generated by the validated script — parses with 20 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 midterm. It mirrors the live L-midterm-week-08.md blueprint with fresh variants and shares none of its items — use it to rehearse.


Blueprint

# Type Concept Obj
1 Multiple choice Program vs algorithm 1
2 Multiple choice Operator precedence (predict) 1
3 Multiple choice Debugging — missing quotes 1
4 Multiple choice Floor division & modulo (predict) 2
5 Multiple choice int vs float (predict) 2
6 Multiple choice String vs number + (predict) 2
7 Multiple choice String index (predict) 2
8 Multiple choice f-string (predict) 2
9 Multiple choice Boolean logic (predict) 3
10 Multiple choice if/elif/else — which branch (predict) 3
11 True / False Comparison operators 3
12 Matching Logical operator results 3
13 Multiple choice while count (predict) 4
14 Multiple choice range count (predict) 4
15 Multiple choice Nested loop count (predict) 4
16 Multiple choice for over a string (predict) 4
17 Multiple choice Debugging — off-by-one 4
18 Multiple choice Function return (predict) 5
19 Multiple choice No return → None (predict) 5
20 Multiple choice Parameters & arguments (predict) 5

Objective totals: Obj 1 = 3 · Obj 2 = 5 · Obj 3 = 4 · Obj 4 = 5 · Obj 5 = 3 → 20 items, 100 points. The midterm does not reach collections, files, algorithms, recursion, or OOP (Weeks 9–15), which are on the cumulative final.


Questions, key, and feedback

Q1 (Multiple choice). Which statement is true?
- A program is run top to bottom, one statement at a time
- Computers guess what you meant
- An algorithm must be written in Python
- print stores a value for later
Feedback: Programs run top to bottom, literally; an algorithm is language-independent.

Q2 (Multiple choice). What does this print?

print(2 + 6 / 2)
  • 4.0
  • 5.0
  • 4
  • 5
    Feedback: / first: 6/2=3.0, then 2+3.0=5.0 (a float). (Run-verified.)

Q3 (Multiple choice). This crashes. Why?

print(Hello)
  • Hello has no quotes, so Python reads it as an unknown name (NameError)
  • print is capitalized
  • missing a colon
  • nothing is wrong
    Feedback: Without quotes, Hello is treated as a name Python doesn't know: NameError. (Run-verified.)

Q4 (Multiple choice). What does this print?

print(17 // 5, 17 % 5)
  • 3 2
  • 3.4 2
  • 2 3
  • 3 0
    Feedback: 17//5=3 (floor), 17%5=2 (remainder). (Run-verified.)

Q5 (Multiple choice). What does this print?

print(9 / 3)
  • 3
  • 3.0
  • 27
  • 0.33
    Feedback: / always gives a float: 9/3 is 3.0. (Run-verified.)

Q6 (Multiple choice). What does this print?

print("5" + "5")
  • 10
  • 55
  • 25
  • an error
    Feedback: Strings join: '5'+'5' is '55' (not 10). (Run-verified.)

Q7 (Multiple choice). What does this print?

print("PYTHON"[-1])
  • P
  • N
  • O
  • PYTHON
    Feedback: Index -1 is the last character: N. (Run-verified.)

Q8 (Multiple choice). What does this print?

name = "Ada"
print(f"Hi {name}!")
  • Hi {name}!
  • Hi Ada!
  • Hi name!
  • f"Hi Ada!"
    Feedback: An f-string inserts the variable's value: Hi Ada! (Run-verified.)

Q9 (Multiple choice). What does this print?

print(False or (3 > 1))
  • True
  • False
  • 3
  • an error
    Feedback: 3 > 1 is True; False or True is True. (Run-verified.)

Q10 (Multiple choice). What does this print?

age = 16
if age >= 18:
    print('adult')
elif age >= 13:
    print('teen')
else:
    print('child')
  • adult
  • teen
  • child
  • nothing
    Feedback: 16 isn't >= 18 but is >= 13, so 'teen'. (Run-verified.)

Q11 (True / False). The expression 5 >= 5 evaluates to True.
- True
- False
Feedback: True. >= means 'greater than OR equal to', and 5 equals 5. (Run-verified.)

Q12 (Matching). Match each logical expression to its value (True or False).
| Left | Correct match |
|---|---|
| True and False | False |
| True or False | True |
| not True | False |
| 10 > 3 | True |
Feedback: and needs both true; or needs one; not flips. (All run-verified.)

Q13 (Multiple choice). How many times does this print 'hi'?

i = 0
while i < 3:
    print('hi')
    i = i + 1
  • 2
  • 3
  • 4
  • forever
    Feedback: i goes 0,1,2 (three times) then 3 stops it: 3 prints. (Run-verified.)

Q14 (Multiple choice). What does this print?

print(list(range(3)))
  • [1, 2, 3]
  • [0, 1, 2]
  • [0, 1, 2, 3]
  • [3]
    Feedback: range(3) starts at 0 and stops before 3: 0,1,2. (Run-verified.)

Q15 (Multiple choice). How many lines does this print?

for i in range(2):
    for j in range(3):
        print(i, j)
  • 5
  • 6
  • 3
  • 2
    Feedback: The inner loop (3) runs fully for each outer step (2): 2*3 = 6 lines. (Run-verified.)

Q16 (Multiple choice). What does this print?

count = 0
for c in "code":
    count = count + 1
print(count)
  • 3
  • 4
  • 1
  • code
    Feedback: 'code' has 4 characters, so the loop runs 4 times: count is 4. (Run-verified.)

Q17 (Multiple choice). You want to print 1, 2, 3, 4, 5 but this prints 1, 2, 3, 4. What's the fix?

for i in range(1, 5):
    print(i)
  • Change range(1, 5) to range(1, 6) — the stop is exclusive
  • Change print(i) to print(i+1)
  • Use a while loop instead
  • Nothing — it already prints 5
    Feedback: range stop is exclusive, so range(1,6) is needed to include 5.

Q18 (Multiple choice). What does this print?

def square(n):
    return n * n
print(square(5))
  • 10
  • 25
  • 55
  • None
    Feedback: square(5) returns 5*5 = 25. (Run-verified.)

Q19 (Multiple choice). What does this print?

def double(n):
    print(n * 2)
x = double(4)
print(x)
  • 8 then 8
  • 8 then None
  • 8 then 4
  • None then 8
    Feedback: double prints 8 but returns nothing, so x is None. (Run-verified.)

Q20 (Multiple choice). What does this print?

def subtract(a, b):
    return a - b
print(subtract(10, 3))
  • 13
  • 7
  • -7
  • 30
    Feedback: Arguments map in order: a=10, b=3, so 10-3 = 7. (Run-verified.)

Answer key (quick reference)

Q Answer Q Answer
1 A 11 True
2 B 12 1-to-1 (see above)
3 A 13 B
4 A 14 B
5 B 15 B
6 B 16 B
7 B 17 A
8 B 18 B
9 A 19 B
10 B 20 B

Quality gate (self-checked)

  • Structure: 20 items, 5 points each, 100 points; coverage Obj 1 = 3 · Obj 2 = 5 · Obj 3 = 4 · Obj 4 = 5 · Obj 5 = 3.
  • Execution gate: PASS — all 16 predict-the-output / behavior items were re-run in Python and their keyed outputs confirmed (e.g. P2 5.0; P4 3 2; P6 55; P7 N; P8 Hi Ada!; P10 teen; P14 [0, 1, 2]; P18 25; P19 None).
  • 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 exam: 0 items are shared with the live L-midterm-week-08.md (verified by full stem comparison).

Canvas placement block

canvas_object             = Quizzes::Quiz
title                     = "Practice Midterm — Cumulative (Weeks 1–7)"
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"
This is the human-readable exam with its vetted answer key and rationale. The import-ready Classic-QTI version (O-practice-exam-week-08-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