Back to the Introduction to Computer Science outline The Course Maker
Introduction to Computer Science outline
Week 4 · Quiz

Week 4 — Quiz (auto-graded) · Booleans & Conditionals

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
Objective tested: Objective 3 — comparison & logical operators; truth tables & precedence; if/elif/else and which branch runs; the =-vs-== debug.
Points: 10 (1 each) · Assignment group: Quizzes (10% of grade) · Due: end of Module 4.

This is the human-readable quiz with its vetted answer key and feedback. The import-ready Classic QTI is in F-quiz-week-04-qti.xml (generated by the shared validated script — parses with 10 items, every single-answer item exactly one correct). Execution gate: PASS — every "what does this print?" / "which branch runs?" key below was produced by actually running the code in Python, not hand-traced. The Canvas placement block is at the bottom of this file.


Blueprint

# Type Concept Objective
1 Multiple choice Predict the result — comparison operator (7 >= 10) 3
2 Multiple choice Predict the resultand/or/not precedence (True or False and False) 3
3 Multiple choice Truth table — for what inputs is A and B true? 3
4 Multiple choice Which branch runs / what printsif/elif/else program 3
5 Multiple answer True statements about Booleans, conditionals, and precedence 3
6 Matching Boolean expression → True / False 3
7 Multiple choice Debuggingif x = 5: (the =-vs-== bug) 3
8 True / False "elif order never changes which branch runs" misconception 3
9 Multiple choice Predict the result — the signature not (3 > 2) 3
10 Multiple choice Which branch runs — boundary value with >= (elif-order trace) 3

No trick questions; distractors are plausible mis-traces (reading and/or left-to-right, flipping a boundary >=/>, treating = as comparison, expecting more than one branch to run).


Questions, key, and feedback

Q1 (MC). What does this program print?

print(7 >= 10)
  • A. True
  • B. False
  • C. 10
  • D. an error
    Feedback: >= means "greater than or equal to." 7 is neither greater than 10 nor equal to 10, so the result is the Boolean False. (Run-verified: False.)

Q2 (MC). What does this program print?

print(True or False and False)
  • A. False
  • B. True
  • C. an error
  • D. None
    Feedback: Precedence is notandor. The and runs first: False and False is False; then True or False is True. Reading left-to-right (which would wrongly give False) is the classic mistake. (Run-verified: True.)

Q3 (MC). The expression A and B is True
- A. when at least one of A, B is True
- B. only when both A and B are True
- C. only when both A and B are False
- D. always
Feedback: and requires both sides to be True; if either side is False, the whole expression is False. (Option A describes or, not and.)

Q4 (MC). What does this program print?

x = 7
if x > 10:
    print("big")
elif x > 5:
    print("medium")
else:
    print("small")
  • A. big
  • B. medium
  • C. small
  • D. medium and small
    Feedback: Python checks conditions top to bottom and runs the first true one. 7 > 10 is False; 7 > 5 is True, so it prints medium and skips the else. Only one branch ever runs. (Run-verified: medium.)

Q5 (Multiple answer — select all that apply). Which of the following statements are true?
- A. == compares two values and produces True or False
- B. In an if/elif/else chain, only the first branch whose condition is True runs
- C. = and == mean the same thing
- D. not is evaluated before and, and and before or
- E. print(3 > 5) displays True
Feedback: == produces a Boolean (A); only the first true branch runs (B); precedence is notandor (D). C is false= stores, == compares. E is false3 > 5 is False. (Run-verified: print(3 > 5)False.)

Q6 (Matching). Match each expression to the value Python prints for it.
| Expression | Correct value |
|---|---|
| 5 == 5 | True |
| 5 != 5 | False |
| not (3 > 2) | False |
| 3 > 2 or 1 > 5 | True |
Feedback: 5 == 5True; 5 != 5False (5 is equal to 5, so "not equal" is false); not (3 > 2)False (3 > 2 is True, and not True is False); 3 > 2 or 1 > 5True (or needs only one true side). (All run-verified.)

Q7 (MC). This program does not run:

x = 5
if x = 5:
    print("match")

What is wrong, and how do you fix it?
- A. Nothing is wrong; it prints match
- B. = is assignment; a condition needs == to compare, so use if x == 5:
- C. The colon : should be removed
- D. print must be capitalized
Feedback: A single = stores a value and is not allowed inside a condition, so Python raises SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?. A comparison needs the double ==. The fix is if x == 5:, which then prints match. (Hook: = puts a value IN; == ASKS a question.)

Q8 (True / False). "The order of the conditions in an if/elif/else chain never changes which branch runs."
- True
- False
Feedback: False. Python runs the first branch whose condition is True, so order matters. A broad condition like score >= 60 placed before score >= 90 will catch a 95 first and print the wrong branch. Order from most specific (highest threshold) to least.

Q9 (MC). What does this program print?

print(not (3 > 2))
  • A. True
  • B. False
  • C. an error
  • D. not True
    Feedback: Work inside-out: 3 > 2 is True, and not True is False. The parentheses make Python evaluate the comparison first, then flip it. (Run-verified: False.)

Q10 (MC). What does this program print?

score = 60
if score >= 90:
    print("A")
elif score >= 60:
    print("D or better")
else:
    print("F")
  • A. A
  • B. D or better
  • C. F
  • D. nothing
    Feedback: 60 >= 90 is False, so Python moves on; 60 >= 60 is True (the >= includes the boundary value 60), so it prints D or better and skips the else. With > instead of >=, a score of exactly 60 would fall through to F. (Run-verified: D or better.)

Answer key (quick reference)

Q Answer
1 B (False)
2 B (True)
3 B
4 B (medium)
5 A, B, D
6 5 == 5→True / 5 != 5→False / not (3 > 2)→False / 3 > 2 or 1 > 5→True
7 B
8 False
9 B (False)
10 B (D or better)

Quality gate (self-checked): each single-answer item has exactly one correct option; the multiple-answer item keys A, B, D (and requires C and E unselected); the matching item pairs four expressions to their True/False values. Execution gate: PASS — the keys for the predict-the-result items (Q1 False; Q2 True; Q9 False), the which-branch items (Q4 medium; Q10 D or better), and the matching values (Q6) were each produced by running the code in Python, not hand-traced. Distractors are plausible mis-traces (Q2 False = left-to-right; Q10 A or F = mishandling the >= boundary; Q7 "nothing's wrong" = treating = as comparison).


Item-bank entries (for variants + the midterm/final)

All ten items are tagged course=CSCI1101 · week=4 · objective=3 · topic=booleans-and-conditionals and deposited in Item Bank: Week 4 — Booleans & Conditionals. The midterm (Week 8) and the per-term variant updates draw fresh items from this bank. (Tags: q1 comparison, q2 logical-precedence, q3 and-truth-table, q4 which-branch, q5 true-statements, q6 expr-value-match, q7 debug-eq-vs-assign, q8 elif-order, q9 not-precedence, q10 boundary-ge.)

Canvas placement block

canvas_object   = Quizzes::Quiz
title           = "Week 4 Quiz — Booleans & Conditionals"
assignment_group = "Quizzes"
points_possible = 10
grading_type    = points
due_offset_days = 6        # 6 days after module start
published       = true
shuffle_answers = true
ai_permitted    = false    # AI is not permitted on quizzes
provenance      = "~ Prof. Okafor's edition · Fall 2026 · built with thecoursemaker.com"
This is the human-readable quiz with its vetted answer key and rationale. The import-ready Classic-QTI version (F-quiz-week-04-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