CSC 141 / QUIZ 2 / UNGRADED PRACTICE

A little practice before Tuesday.

Twelve short questions to help you prepare for Quiz 2. Predict first, choose an answer, then read the explanation.

Quiz: Tuesday, September 29, 2026, 11:00–11:15 AM.
Classes 6–7. Ten multiple-choice questions on nested decisions, testing, and debugging.

These are different questions from the graded quiz. Practice as often as you like. No name, student ID, or submission is required; this page does not record a grade.

Course home · Quiz 1 practice

What to review

For each snippet, trace the conditions from top to bottom, track which branch runs, and write the exact output before checking it. The quiz will not ask you to write a complete program.

01 What does this program print?
bridge_open = False
has_pass = True
if bridge_open:
    if has_pass:
        print("Cross")
    else:
        print("Wait")
else:
    print("Closed")
02 What does this program print?
score = 85
if score >= 80:
    print("Pass")
elif score >= 90:
    print("Honors")
else:
    print("Fail")
03 A rule charges nothing for fewer than 10 items, $1 each for 10 through 20 items inclusive, and a different rate above 20. Which set of inputs tests both boundaries?
04 Which line is missing something Python needs to parse it?
05 What happens when this program runs and the user types 20?
age = input("Age: ")
is_adult = age >= 18
06 A rule gives a discount for totals of $100 or more. What is discount for total = 100 in this code?
total = 100
if total > 100:
    discount = True
else:
    discount = False
07 What does this program print for level = 25?
level = 25
if level >= 20:
    print("High")
if level >= 10:
    print("Medium")
08 A rule gives a senior discount at age 65 or older. Which three ages best test this boundary?
09 When a program crashes with a traceback, what is the most useful place to look first?
10 What happens when this program runs with member = False?
member = False
if member:
    price = 4
print(f"Price: ${price:.2f}")
11 For an if/elif/else with three branches, what is the minimum number of test cases needed to run every branch at least once?
12 What does this program print?
minutes = 60
if minutes < 30:
    fee = 0.0
elif minutes <= 60:
    fee = 2.0
else:
    fee = 4.0
print(fee)