Functions & control
Expressions, scope, conditionals, loops, return vs. print, and short-circuit behavior. Predict exact output and side effects.
CS 61A moves quickly from Python fundamentals into abstraction, recursion, data structures, interpreters, and software design. This field guide turns the course outline into a steady weekly plan—and a concrete way to prepare for exams.
The course is about managing program complexity, not memorizing one language. Python is the main tool; Fall 2026 also introduces Gleam, SQL, and a TypeScript application project.
| Component | Fall 2026 format | How to approach it |
|---|---|---|
| Midterm 1 | 20 points · paper | Early fundamentals; precise tracing and code writing. |
| Midterm 2 | 20 points · computer-based | Through linked lists; code implementation and output prediction. |
| Midterm 3 | 45 points · paper | Later topics; follow the published scope announcement. |
| Final | 75 points · paper | Treat it as cumulative unless staff announces a narrower scope. |
| Quizzes | 10 points · best 5 of 8 | Usually a short variant of a homework problem. |
| Homework | 10 points | Weekly practice; know why each solution works. |
| Four projects | 100 points total | Larger synthesis assignments; plan around checkpoints. |
| Lab + discussion | 10 points each | Complete work and follow the section's attendance rules. |
Fall 2026 projects: Hog, Cats (computer-aided typing), Ants vs. SomeBees, and 4Animator. A two-week software-application unit is new in Fall 2026. Follow the live collaboration and AI rules: the general syllabus prohibits AI tools from filling in or correcting assignment code; the AI-focused project has its own instructions.
Most weeks, lab includes a 10-minute, one-problem computer quiz based on a slight variation of homework. Re-solve the relevant homework problem from a blank page after you finish it. Practice quizzes, when released, appear on PrairieLearn. The best five of eight count in Fall 2026.
For every topic, practice two moves: predict what code does, then write a small program that does something similar. Strong understanding means you can trace, explain, and construct.
Expressions, scope, conditionals, loops, return vs. print, and short-circuit behavior. Predict exact output and side effects.
Call frames, lexical scope, closures, and functions passed or returned. Draw the parent frame and each call frame.
State a base case, make progress toward it, and combine results. Sketch the call tree before simplifying.
Lists, tuples, strings, dictionaries, and abstract data types. Use an interface without depending on its representation.
Shared references, identity vs. equality, mutation vs. rebinding. Draw boxes and arrows before and after changes.
Representations, recursive traversal, and transformations. Work through a tiny structure one pointer or branch at a time.
Instances, methods, self, class attributes, and lookup. Track which object owns an attribute and which method runs.
yield, suspended state, and nested iteration. Trace one next call at a time.
Immutability, functions, algebraic data types, and recursive processing of structured values.
Syntax vs. values, evaluation rules, and environments. Understand how an evaluator breaks down an expression.
Filtering, joins, grouping, and aggregation. Be explicit about the rows that remain after each operation.
Break features into parts, understand module boundaries, and verify code against requirements with tests and careful reading.
Topic order and exam scope vary. The course calendar and staff announcements are authoritative. See the Fall 2026 calendar and syllabus.
These original examples model the kinds of reasoning CS 61A develops. Work each one on paper first. Open the answer only after you have a prediction and can explain your steps.
def make_adder(x):
def add(y):
return x + y
return add
plus_three = make_adder(3)
print(plus_three(4))
Draw the function object and its parent frame. What value does x have when add runs?
It displays 7. Calling make_adder(3) creates a frame where x is 3, then returns add. The returned function keeps that frame as its parent. When plus_three(4) runs, its own frame binds y to 4; the free name x is found in the parent frame, so 3 + 4 is 7.
def digit_sum(n):
if n < 10:
return n
return digit_sum(n // 10) + n % 10
print(digit_sum(527))
List the argument to each recursive call, then compute the displayed value.
It displays 14. The calls reduce the number: digit_sum(527) becomes digit_sum(52) + 7, then digit_sum(5) + 2 + 7. The base case returns 5, giving 5 + 2 + 7 = 14. Each call removes one rightmost digit, so the input gets closer to the base case.
a = [1, 2]
b = a
a.append(3)
a = [0]
print(a)
print(b)
Track the list objects separately from the variable names. Does rebinding a change the object referenced by b?
It displays [0], then [1, 2, 3]. Initially, a and b refer to the same list. append mutates that shared list. The later assignment a = [0] makes a refer to a new list; b still refers to the original, now mutated list.
A tree is represented as a non-empty Python list: the first item is the label, and each remaining item is a branch represented by another tree. A leaf has no branches. Write count_leaves(tree), which returns the number of leaves.
def count_leaves(tree):
branches = tree[1:]
if not branches:
return 1
return sum(count_leaves(branch) for branch in branches)Why: a tree with no branches contributes one leaf. Otherwise, its leaves are exactly the leaves in its branches, so recursively count each branch and add the results. For example, [1, [2], [3, [4]]] has two leaves: [2] and [4].
def steps():
print("start")
yield 2
print("middle")
yield 5
g = steps()
print("A", next(g))
print("B", next(g))
Write the complete output in order. Remember that creating a generator does not run its body.
start
A 2
middle
B 5The first next begins execution, prints start, and pauses at yield 2. After the outer print displays A 2, the second next resumes after that yield, prints middle, and pauses at yield 5.
For more practice, use the current course's past exams and topic-sorted questions. Always follow your semester's exam scope.
The official course study guide recommends starting early, spreading study over multiple days, solving problems actively, and reflecting on your reasoning. Use past exams after you understand the basics.
List announced topics and mark each green, yellow, or red. Revisit videos/readings for red topics, then try worksheet problems closed-book.
Focus on one family at a time: environments, recursion, mutation, trees. Record the key idea and your near-misses.
Take a timed practice exam under realistic conditions. Sort errors into concept, tracing, edge case, syntax, or timing.
Redo misses from a blank page, review a one-page concept sheet, sleep, and plan your exam time.
Assume the final is cumulative until staff posts a narrower scope. Start by repairing weak spots from all midterms, then alternate old and newer topics so you can switch problem-solving modes.
Projects are not side activities. They account for a third of the Fall 2026 points and make you combine ideas into programs larger than a single exam question. The syllabus describes projects as larger assignments that combine course ideas in interesting ways.
| Order | Fall 2026 project | What it lets you practice | How it is organized |
|---|---|---|---|
| 1 | Hog Dice-game simulator | Control flow, functions, higher-order functions, separating rules from simulation, and strategy functions. | Build game rules first, then add strategies; the checkpoint asks for an early working phase. |
| 2 | Cats Typing and autocorrect | Strings and sequences, functional abstraction, recursion/edit distance, memoization, then client/server multiplayer. | Progress from typing metrics to autocorrect and then multiplayer; a checkpoint precedes the later phase. |
| 3 | Ants vs. SomeBees Tower-defense simulation | Use this project to consolidate classes, inheritance, mutation, object collaboration, and simulation logic as those topics arrive in the course. | The course calendar schedules it after mutation, classes, and inheritance. Check the live project spec for required phases and checkpoints. |
| 4 | 4Animator Application project | Software/application design, web technologies, multiple components, code reading, testing, and verification with AI-agent tools. | Concludes the course after foundational programming units; Fall 2026 lists a checkpoint and standard/TypeScript paths. |
How the work is organized: Within a project, questions are grouped into phases that usually build on earlier functions. Follow that order, make a small piece work before adding the next one, and treat checkpoints as real milestones rather than last-minute submissions. The semester calendar also places the projects after the relevant concepts have begun appearing in lecture, lab, discussion, and homework.
Pair programming is encouraged where allowed; alternate roles and ensure both partners can explain the whole result. Follow the current semester's collaboration and AI policy. Fall 2026 requires Provenance logs and restricts AI on the standard projects; the final AI-assisted project has specific, separate instructions, so follow its live spec.
Reddit is self-selected and mixes semesters. Treat it as lived experience, not a guarantee about difficulty, grading, or course policy.
Students often describe exams as harder than homework and lecture examples. Take that as a reason to practice unfamiliar variants, not only complete assigned coding.
A former student and TA recommends moving from memorizing syntax to practicing problem solving: explain solutions to peers, group similar problem types, and revisit them later from scratch.
First-time programmers report mixed outcomes. Some say consistent effort worked well; others found the pace demanding. Plan extra practice and ask for help early.
Office hours, CSM tutoring, HKN reviews, and study groups come up often. Check which resources are active in your semester.
Claims that 61A is a “weeder” or that everyone must complete a particular number of practice exams are opinions. The official grading page says there is no curve and publishes fixed thresholds.
This guide references the Fall 2026 public course offering. The official syllabus, calendar, resources, and studying guide are primary sources. Reddit links are student perspectives only. HKN's public course guide is a useful overview but was last edited in 2020, so live course information takes precedence.