Thursday Sep 24, 2026 · 1:00–2:00 p.m. · ACAD 707 · closed book / note / watch / phone · laptop with Respondus LockDown Browser · photo ID + pen · written into a browser compiler.
Every word, question, code sample and answer on this page is copied from Adrien’s existing CS1411 Exam 1 prep material (TEST-INTEL.md + PRACTICE.md, built 2026-09-16 from the professor’s Exam 1 Review Sheet and the Gaddis 6e vault book). Nothing here was invented.
From the review sheet, page 2, verbatim:
geeksforgeeks.org/computer-science-fundamentals/difference-between-alu-and-cu/).Chapter mapping (Gaddis 6e, from the vendored textbook TOC):
| Ch | Title | Class coverage note |
|---|---|---|
| 1 | Introduction to Computers and Programming | §1.1–1.5: hardware/software, how computers store data, how a program works (fetch-decode-execute), using Python. No source code in this chapter. |
| 2 | Input, Processing, and Output | §2.1–2.11 per the syllabus schedule (Week 2) |
| 3 | Decision Structures and Boolean Logic | §3.1–3.3 (Week 3), §3.4–3.6 (Week 4) |
| 4 | Repetition Structures | §4.1–4.3 (Week 5), §4.4–4.7 (Week 6) — the chapter the exam lands on |
Review sheet, page 1, verbatim: "The best way to prepare for the exam is to know how to solve all class exercises without looking at the solution. Focus on the following exercises:"
All nine are implemented in codes/ (provenance and reconstruction flags in CODES.md).
In-class evidence these were worked in class — the LECTURE POINTS rosters posted to Canvas show four in-class exercise sessions: Tue Aug 25, Thu Sep 3, Tue Sep 8, Thu Sep 10 (Canvas module 516320; Excel date serials 46259 / 46268 / 46273 / 46275). The syllabus describes the mechanic: "During the lecture, I will assign practice exercises to work on… If you do not have an answer, you are sleeping, or if the quality of your answer is bad, then .5 points will be deducted from your overall grade… recorded in Canvas under the LECTURE POINTS." (Syllabus p.5.) Adrien is at 0.0 on all four sheets — worth knowing before the next one.
| Component | Weight |
|---|---|
| Quizzes | 10 % |
| Two Exams [in class] (15 % each) | 30 % |
| Final Exam (Comprehensive) [in class] | 30 % |
| Programming Labs [in class] | 10 % |
| Programming Assignments [take-home] | 10 % |
| Programming Presentation [in class] | 7 % |
| Class Participation | 3 % |
Letter grades: 90–100 A, 80–89 B, 70–79 C, 60–69 D, 0–59 F. Exam 1 = 15 % of the course grade. Make-ups only for documented emergencies; "Final Exams cannot be made up." "All missed grades will be recorded as zeros." Quizzes are turned in via the Revel platform (Pearson); "Everything else will be turned in via Canvas."
harriscy@uhd.edu, 713-221-8418.//Written by: … //Developed using: Visual Studio 2022).Adrien's brief for this task said the test is "tomorrow (Thu 2026-09-17)". Every piece of evidence I could reach says the CS1411 exam is one week later, Thursday 2026-09-24, and that nothing is being tested on Thu 2026-09-17 — that day carries three submission deadlines instead.
| Claim | Evidence |
|---|---|
| Exam 1 = Thursday, September 24, 2026, 1:00 p.m. – 2:00 p.m. | Canvas announcement #798388, title verbatim: "Exam 1 - Thursday, September 24th, 1:00 p.m. – 2:00 p.m.", posted 2026-09-09T23:38:07Z. Body: "Exam 1 is scheduled to take place: Thursday, September 24th, 1:00 p.m. – 2:00 p.m. Please read the Exam 1 review document." |
| Same date, second source | CS 1411 Exam 1 Review Sheet (Fall 2026) Thursday.pdf (Canvas file 10798588, Canvas module 516315 "Exam 1 Review"), page 1: "Exam 1 is scheduled to take place: Thursday, September 24th, 1:00 p.m. – 2:00 p.m.. You will want to show up early." |
| Same date, third source | Syllabus cs1411-syllabus-fall2026.pdf p.7 tentative schedule puts Exam 1 in Week 6. Semester started Mon 2026-08-17, so Week 6 = Sep 21–25. Sep 24 sits inside it. |
| Nothing on Sep 17 | Canvas announcement list is sorted newest-first; the newest announcement is "9-10 Update", posted 2026-09-10. There is no announcement of any kind after Sep 10, so no online notice of an exam moving to Sep 17. |
| Sep 17 is a deadline day, not a test day | Canvas assignments API, due 2026-09-18T04:59:59Z = Sep 17, 11:59:59 PM CT: Assignment 1 - Turtle Drawing (id 992027), Lottery Simulator Lab - Part 1 (100 pts, id 992048), Lottery Simulator Lab - Part 2 (id 992049). Announcement #796914 (Sep 3): "Assignment 1 - Due Thursday, September 17th, 2026". |
| Also due that night | Revel/Pearson item 3: Decision Structures and Boolean Logic due 2026-09-18T07:00:00Z = Sep 18, 02:00 AM CT (assignment id 1009711, 810 pts, external_tool = Pearson Revel). |
| The canvas calendar feed has no exam at all | user_BOnEpFPmFBrVNopn4vaekw4bgLWWfJGGQBuE8i7Z.ics fetched today: 33 events, zero containing "Exam" for CS1411. Per the known pitfall this is not evidence there is no exam — a paper in-class exam is simply not a Canvas assignment and never enters the feed. |
What this means for Adrien: if he is certain a test is tomorrow, that certainty came from something not published on Canvas (a verbal change in class, or he is mixing up the Sep 17 assignment deadlines with the exam). The corpus and practice material in this folder serve either date. Verify with Prof. Harris before assuming a date change — office N614F, 713-221-8418, or Canvas mail (his stated preferred channel; 24–48 h reply).
Sources for "no newer announcement": Canvas API /api/v1/courses/39984/discussion_topics?only_announcements=true read from the authenticated Chrome session on Adrien's Mac.
/api/v1/courses/39984/quizzes returns an empty list. The chapter quizzes live on Pearson Revel, which is consistent with the syllabus — but it means "is there a quiz tomorrow?" cannot be answered from Canvas for this course.Chapter NN.zip programs, the publisher PPT slides, the "Other Source Code" demo module, and the lab sheets + starter files.Prompt the user to input a number of minutes greater than 60. Output the equivalent number of hours and minutes. Example:Enter the number of minutes: 125→The equivalent time is: 2 hours and 5 minutes
minutes = int(input("Enter the number of minutes: "))
hours = minutes // 60
remaining_minutes = minutes % 60
print("The equivalent time is:", hours, "hours and", remaining_minutes, "minutes")Key ideas: // is integer division (whole hours), % is the remainder (leftover minutes). Verified: input 125 → The equivalent time is: 2 hours and 5 minutes.
Write a program that will output a random number from the set: {2, 4, 6, 8, 10}.
import random
number = random.randrange(2, 12, 2)
print(number)randrange(start, stop, step) — the stop value is excluded, so 12 is never produced. Equivalent alternatives the professor would accept: random.choice([2, 4, 6, 8, 10]) or random.randint(1, 5) * 2. Verified: 40 runs produced only 2, 4, 6, 8, 10.
Output a random letter between A and Z (A and Z inclusive) to the console screen.
import random
print(chr(random.randint(65, 90)))65 is 'A' and 90 is 'Z' in ASCII; chr() converts the number to a character. This is the professor's own posted solution (Random Capital Letter SLN v2.txt), so use exactly this shape. He also posted a second accepted method:
import random
import string
letter = random.choice(string.ascii_uppercase)
print(letter)Create the design using turtle graphics. Usespeed(),penup(),pendown(),goto(…, …),fillcolor(),begin_fill(),end_fill(),done().
The figure is a large unfilled (outline-only) triangle with a solid blue triangle nested inside it, apex up, both sharing the same bottom line — the inner triangle is the outer one at half scale, centred.
import turtle
SIDE = 200
HALF_SIDE = SIDE / 2
HEIGHT = SIDE * 0.8660254
turtle.speed(0)
turtle.hideturtle()
turtle.penup()
turtle.goto(-HALF_SIDE, -HEIGHT / 2)
turtle.pendown()
for i in range(3):
turtle.forward(SIDE)
turtle.left(120)
turtle.penup()
turtle.goto(-HALF_SIDE / 2, -HEIGHT / 2)
turtle.pendown()
turtle.fillcolor("blue")
turtle.begin_fill()
for i in range(3):
turtle.forward(HALF_SIDE)
turtle.left(120)
turtle.end_fill()
turtle.done()Two things the professor listed that are easy to forget: the turn is 120° (exterior angle of an equilateral triangle, 360 / 3) and the fill must be wrapped in begin_fill() … end_fill(). No posted solution exists for this one — this is my reconstruction of the sheet's figure.
Create the design using Python's Turtle graphics.
Four filled circles in a 2×2 grid, each touching its neighbours: top-left green, top-right blue, bottom-left yellow, bottom-right red.
import turtle
RADIUS = 50
turtle.speed(0)
turtle.penup()
turtle.goto(-RADIUS, 0)
turtle.pendown()
turtle.fillcolor("green")
turtle.begin_fill()
turtle.circle(RADIUS)
turtle.end_fill()
turtle.penup()
turtle.goto(RADIUS, 0)
turtle.pendown()
turtle.fillcolor("blue")
turtle.begin_fill()
turtle.circle(RADIUS)
turtle.end_fill()
turtle.penup()
turtle.goto(-RADIUS, -2 * RADIUS)
turtle.pendown()
turtle.fillcolor("yellow")
turtle.begin_fill()
turtle.circle(RADIUS)
turtle.end_fill()
turtle.penup()
turtle.goto(RADIUS, -2 * RADIUS)
turtle.pendown()
turtle.fillcolor("red")
turtle.begin_fill()
turtle.circle(RADIUS)
turtle.end_fill()
turtle.hideturtle()
turtle.done()Geometry worth memorising: with the heading pointing east, circle(r) puts the circle's centre r units to the left (north) of the starting point, so the start points above are the bottoms of each circle. Verified against the sheet's figure: the four centres come out at (±50, ±50) with radius 50 — tangent.
Simulate 2 users rolling dice. Two variables holding values between 2 and 12. Output each player's roll, then who won or that it was a tie.
import random
player1 = random.randint(2, 12)
player2 = random.randint(2, 12)
print("Player 1: ", player1)
print("Player 2: ", player2)
if player1 > player2:
print("Player 1 Wins")
elif player2 > player1:
print("Player 2 Wins")
else:
print("Tie")The trap: the sheet says 2 to 12, so it is randint(2, 12), not randint(1, 12) and not randint(1, 6). Three sample runs on the sheet (6/5 → P1, 6/12 → P2, 8/8 → Tie) all reproduce.
Ask the user for a number 1–10. Useif:/elif:/else:to display the Roman numeral. Input validation: do not accept a number less than 1 or greater than 10.
number = int(input("Input an integer from the range: 1 through 10: "))
if number == 1:
print("The Roman Numeral Equivalent is: I")
elif number == 2:
print("The Roman Numeral Equivalent is: II")
elif number == 3:
print("The Roman Numeral Equivalent is: III")
elif number == 4:
print("The Roman Numeral Equivalent is: IV")
elif number == 5:
print("The Roman Numeral Equivalent is: V")
elif number == 6:
print("The Roman Numeral Equivalent is: VI")
elif number == 7:
print("The Roman Numeral Equivalent is: VII")
elif number == 8:
print("The Roman Numeral Equivalent is: VIII")
elif number == 9:
print("The Roman Numeral Equivalent is: IX")
elif number == 10:
print("The Roman Numeral Equivalent is: X")
else:
print("The number is not valid")This is Adrien's own submitted file, so it already matches what the professor accepted. Note his wording: the sheet's "input validation" for this lab is done with the else branch printing The number is not valid — no loop. Verified: 1–10 all correct, 30 → The number is not valid.
The base program draws a target square at (100, 250)–(125, 275), asks for an angle and a force, launches force * 30 pixels and reports a hit or a miss. The class modification adds hints ("Try a greater angle", "Use less force").Base program — reproduced from the class starter file (identical to textbook Program 3-9):
import turtle
SCREEN_WIDTH = 600
SCREEN_HEIGHT = 600
TARGET_LLEFT_X = 100
TARGET_LLEFT_Y = 250
TARGET_WIDTH = 25
FORCE_FACTOR = 30
PROJECTILE_SPEED = 1
NORTH = 90
SOUTH = 270
EAST = 0
WEST = 180
turtle.setup(SCREEN_WIDTH, SCREEN_HEIGHT)
turtle.hideturtle()
turtle.speed(0)
turtle.penup()
turtle.goto(TARGET_LLEFT_X, TARGET_LLEFT_Y)
turtle.pendown()
turtle.setheading(EAST)
turtle.forward(TARGET_WIDTH)
turtle.setheading(NORTH)
turtle.forward(TARGET_WIDTH)
turtle.setheading(WEST)
turtle.forward(TARGET_WIDTH)
turtle.setheading(SOUTH)
turtle.forward(TARGET_WIDTH)
turtle.penup()
turtle.goto(0, 0)
turtle.setheading(EAST)
turtle.showturtle()
turtle.speed(PROJECTILE_SPEED)
angle = float(input("Enter the projectile's angle: "))
force = float(input("Enter the launch force (1-10): "))
distance = force * FORCE_FACTOR
turtle.setheading(angle)
turtle.pendown()
turtle.forward(distance)
if (turtle.xcor() >= TARGET_LLEFT_X and
turtle.xcor() <= (TARGET_LLEFT_X + TARGET_WIDTH) and
turtle.ycor() >= TARGET_LLEFT_Y and
turtle.ycor() <= (TARGET_LLEFT_Y + TARGET_WIDTH)):
print('Target hit!')
else:
print('You missed the target.')
turtle.done()Verified by execution: angle 68 / force 9 — the combination the sheet gives as a winner — lands at (101.14, 250.34), inside the box. angle 45 / force 3 lands at (63.6, 63.6), a clean miss.
The hint version adds, in the else: branch:
if turtle.xcor() < TARGET_LLEFT_X:
print('Try a greater angle.')
elif turtle.xcor() > (TARGET_LLEFT_X + TARGET_WIDTH):
print('Try a smaller angle.')
if turtle.ycor() < TARGET_LLEFT_Y:
print('Use more force.')
elif turtle.ycor() > (TARGET_LLEFT_Y + TARGET_WIDTH):
print('Use less force.')The extended version (sheet Turtle Target Loop, lab due Sep 22) wraps the whole prompt + launch in a while loop that repeats until the box test passes — see codes/turtle_target_loop.py. If the exam asks for the looped version, that is the shape: initialise a flag, loop while not hit, re-goto(0, 0) each try.
Prompt for a positive integernum; keep prompting until the input is positive; then loop to output every even integer from 0 up to but not includingnum. Sample run:-1,0,10→Output integers ->then0 2 4 6 8(one per line).
num = int(input("Input a positive integer "))
while num <= 0:
num = int(input("Input a positive integer "))
print("Output integers ->")
for i in range(0, num, 2):
print(i)Two loops, two purposes — he will be looking for exactly this: a while for validation and a for with a step for the output. Note range(0, num, 2) stops before num. Verified: -1, 0, 10 gives 0 2 4 6 8.
Sources: the professor's own slide Computer Organization Overview (Canvas, Lecture Notes module 516318) labels the CPU as ALU – Arithmetic Logic Unit / CU – Control Unit; the review sheet links geeksforgeeks.org/computer-science-fundamentals/difference-between-alu-and-cu/, which states: "ALU … performs all the basic arithmetic (addition, subtraction, multiplication, and division) operations and logical operations" and "the main work of the CU is to tell the most efficient method to work … It informs the ALU, I/O devices, and the RAM how to respond to the command that has been sent to the processor."
"When a CPU executes the instructions in a program, it is engaged in a process that is known as the fetch-decode-execute cycle. This cycle, which consists of three steps, is repeated for each instruction in the program."
while = condition-controlled (pretest) — it can execute zero times.for = count-controlled — iterates once per item in a sequence.input() returns a string; convert with int() / float() when you need math.= assigns, == compares, != is "not equal".if/elif/else, Python tests the branches in order and stops at the first true one — that is exactly why the Roman-numeral elif chain works.#. The syllabus itself asks students to note which IDE they used in a comment at the top of a program.:= assigns and returns the value (print(num := 99)), and is used in the book's newer input-validation loops — while (score := int(input('Enter your score: '))) < 0:. Lower priority, but it is on the Chapter 3 and 4 slides.System Request → Planning → Analysis → Design → Implementation → Maintenance. Planning = feasibility study (is it possible? is it profitable?); Analysis = the list of requirements; Design = how each requirement gets implemented; Implementation = code it and test it; Maintenance = updates, security, fixing bugs, new features.
All outputs below were produced by actually running the programs.
n = 0
while n < 5:
print(f'Inside the loop, the value of n is {n}.')
n += 1→ Inside the loop, the value of n is 0. through … is 4. (5 lines, 0→4).
count = 10
while count > 0:
print(count)
count -= 1
print('Blastoff!')→ 10 9 8 7 6 5 4 3 2 1 then Blastoff!
for name in ['Winken', 'Blinken', 'Nod']:
print(name)→ Winken, Blinken, Nod
for n in range(3):
if n == 5:
print('Breaking out of the loop.')
break
print(n)
else:
print(f'After the loop, n is {n}.')→ 0, 1, 2, After the loop, n is 2. (no break happened, so else runs)
n = 100
while n < 5:
print(n)
n += 1
else:
print(f'Now n is {n}.')→ Now n is 100. only — the body never ran, else still ran.
for outer in range(5):
for inner in range(20):
print('*', end='')
if inner == 3:
break
print()→ five lines, each **** (10 stars per row would be the trap if you assumed break exits both loops).
BASE_SIZE = 8
for r in range(BASE_SIZE):
for c in range(r + 1):
print('*', end='')
print()→ 8 lines: 1, 2, 3, 4, 5, 6, 7, 8 stars.
n = 0; while n < 10: n += 1 → prints nothing at all (there is no print inside; the loop just counts). A favourite trick question.
f'{value:,.2f}' gives thousands separators and 2 decimals ($1,234.57).// and %// is integer division (whole hours), % is the remainder (leftover minutes). Verified: input 125 → The equivalent time is: 2 hours and 5 minutes.range()range() rules to have cold: one argument = ending limit; two arguments = start, end; three = start, end, step; and the ending limit is never included.while vs forwhile = condition-controlled (pretest) — it can execute zero times.for = count-controlledfor = count-controlled — iterates once per item in a sequence.360 / sides (120 for a triangle, 90 for a square); begin_fill() must be paired with end_fill(); penup() before goto() or you draw a stray line; turtle.done() at the end.random.randint(1, 100) (int, both ends included), random.random() (float 0.0–1.0), random.uniform(1.5, 10.5) (float in a range), random.choice(list) (one item), random.sample(list, 3) (3 items, no repeats), random.shuffle(list) (reorders in place).input() returns a stringinput() always returns a string. input('Enter a number: ') * 2 repeats the string; you need int(...) or float(...) first.randint vs randrangerandint includes both ends; randrange excludes its stop. Roll Dice wants randint(2, 12).break / loop elseelse runs unless break fired — and break only exits the loop it is inside.if / elif / else orderif/elif/else stops at the first true branch, so elif number == 5 never sees values already handled above it.Traps that cost marks on this exact material
range() excludes the ending value — range(1, 11) is 1–10, range(0, num, 2) stops before num.range(start, stop, step) — three arguments, third is the step. Loop Exercise 0 depends on it.input() is a string. Convert before arithmetic.// vs /: // is integer division (hours), % is the remainder (minutes).randint includes both ends; randrange excludes its stop. Roll Dice wants randint(2, 12).else runs unless break fired — and break only exits the loop it is inside.360 / sides (120 for a triangle, 90 for a square); begin_fill() must be paired with end_fill(); penup() before goto() or you draw a stray line; turtle.done() at the end.if/elif/else stops at the first true branch, so elif number == 5 never sees values already handled above it.num, num1, tries, matched, divisors, player1, and named constants in caps (TARGET_WIDTH, FORCE_FACTOR, MARK_UP). Reuse those names where the exercise implies them.Drill plan for the remaining time (highest value first)
range() shapes) and B3/B4 (validation, sentinel).programiz.com/python-programming/online-compiler/ and the pythonsandbox link once so the first minute of the exam is not spent finding the Run button.codes/ and read the output. Everything in that folder compiles and runs; nothing in it is untested.Write nested loops that print a right triangle of * with 8 rows, growing by one star each row.BASE_SIZE = 8
for r in range(BASE_SIZE):
for c in range(r + 1):
print('*', end='')
print()Output (verified): *, **, ***, … ********. The pair to remember: the inner loop controls the row length, the outer loop controls how many rows, and print() with no arguments ends the row.
Same idea, staircase: 6 steps, each a single # preceded by a growing run of spaces.NUM_STEPS = 6
for r in range(NUM_STEPS):
for c in range(r):
print(' ', end='')
print('#')Ask the user for rows and columns, then print a rectangle of stars.
rows = int(input('How many rows? '))
cols = int(input('How many columns? '))
for r in range(rows):
for c in range(cols):
print('*', end='')
print()Key rule straight from the slide deck: "Total number of iterations in nested loop = number of iterations of inner loop X number of iterations of outer loop."
for vs while vs range() (Chapter 4)Print a table of the numbers 1–10 and their squares.
print('Number\tSquare')
print('--------------')
for number in range(1, 11):
square = number**2
print(f'{number}\t{square}')Use a while loop as a count-controlled loop: print the value of n for n = 0..4.n = 0
while n < 5:
print(f'Inside the loop, the value of n is {n}.')
n += 1The slide deck names the three obligations of a count-controlled while: initialise, compare, update (here n = 0, n < 5, n += 1). Expect a question where one of the three is missing — that's the bug.
range() rules to have cold: one argument = ending limit; two arguments = start, end; three = start, end, step; and the ending limit is never included.
Keep asking for a wholesale cost until it is not negative, then print the retail price at a 2.5 markup.
MARK_UP = 2.5
another = 'y'
while another == 'y' or another == 'Y':
wholesale = float(input("Enter the item's wholesale cost: "))
while wholesale < 0:
print('ERROR: the cost cannot be negative.')
wholesale = float(input('Enter the correct ' +
'wholesale cost: '))
retail = wholesale * MARK_UP
print(f'Retail price: ${retail:,.2f}')
another = input('Do you have another item? ' +
'(Enter y for yes): ')This is the book's retail_with_validation.py, and it is the template for Loop Exercise 0 and the Lottery Part 2 lab: an outer "do it again?" loop, an inner validation loop.
A sentinel value ends the loop; add up the inputs until then; then report the total (and average).
The pattern: prime the read before the loop, test the sentinel in the while condition, and read again at the bottom of the loop body. The book's sum_numbers.py / commission.py do exactly that, and count_commission.py shows the counter-variable version. Expect a question that gives a starting template with only the bottom read missing — forgetting it produces an infinite loop, which the slide deck calls out by name.
break, continue, and the loop else (Chapter 4)What does this print, and why does the else clause run?n = 100
while n < 5:
print(n)
n += 1
else:
print(f'Now n is {n}.')Verified output: just Now n is 100. — the loop body never executed but else still runs, because else on a loop runs whenever the loop ends without break. Contrast with for r in range(3): if r == 5: break — no break happens, so else also runs and prints After the loop, n is 2. Only break suppresses a loop's else.
break inside nested loops:for outer in range(5):
for inner in range(20):
print('*', end='')
if inner == 3:
break
print()Verified output: five lines of ****. break leaves only the loop it is in — the outer loop keeps going, which is the mistake the book flags.
demo_random_number_generation.py)The professor's demo uses six functions — be able to say what each returns: random.randint(1, 100) (int, both ends included), random.random() (float 0.0–1.0), random.uniform(1.5, 10.5) (float in a range), random.choice(list) (one item), random.sample(list, 3) (3 items, no repeats), random.shuffle(list) (reorders in place).
Convert a numeric score to a letter grade with anif-elif-elsechain (bookgrader.py).
Test whether a value is inside a numeric range — slide deck: useandfor inside (x >= 10 and x <= 20), useorfor outside (x < 10 or x > 20).
Put two names in alphabetical order with if name1 < name2: — strings compare character by character using ASCII, and string comparison is case sensitive.f'{value:,.2f}' gives thousands separators and 2 decimals ($1,234.57).//, %, **, and the augmented forms += -= *= /= //= %=.input() always returns a string. input('Enter a number: ') * 2 repeats the string; you need int(...) or float(...) first.