CS109 Midterm 1
Monday, July 13th, in-class
Logistics
The first CS109 midterm is a 75-minute, closed book, closed calculator/computer exam. You are, however, allowed to bring 3 pages (front and back) of notes in the exam, written by hand with a pen or pencil (no iPad writing, please). Make sure to practice before the exam.
Where to Go
The exam location is in the regular classroom, CoDa B80
Coverage
The midterm puts special emphasis on the material from the first two problem sets. This includes material in lecture up to and including class on Wednesday, July 8th.
Answer Format
You are going to be solving probability questions by hand. To that extent we are not interested in numeric answers, but rather in formulaic answers. It is fine for your answers to include summations, products, factorials, exponentials, and combinations, unless the question specifically asks for a numeric quantity or closed form. Where numeric answers are required, the use of fractions is fine. You must show your work. Any explanation you provide of how you obtained your answer can potentially allow us to give you partial credit for a problem. For example, describe the distributions and parameter values you used, where appropriate.
Problems Fair Game for Midterm
1
You are responsible for material from Lectures 1–10 (through
Probabilistic Models). The old midterms cover a range of topics,
and some of them include problems that use material we have
not yet covered. This guide lists, for each exam, which
problems are fair game and which you should skip. Exams are listed
newest first.
In scope (Lectures 1–10)
Counting and combinatorics; axioms of probability; conditional
probability and Bayes’ theorem for discrete events; independence and
conditional independence; discrete random variables (Bernoulli, Binomial,
Geometric, Negative Binomial, Poisson); expectation, variance, and
moments (including linearity of expectation and indicator variables);
continuous random variables (Uniform, Exponential); the Normal/Gaussian
distribution (including the normal approximation to the binomial and the
Poisson); and joint distributions and probabilistic models (joint and
marginal distributions, covariance, adding random variables, sums of
independent Gaussians).
Not in scope: Bayesian inference — computing
a posterior or updated belief over an unknown, model or hypothesis
selection, and any inference that uses a continuous likelihood. Ordinary
Bayes’ theorem for discrete events (Lecture 2) is still fair game; what
is excluded is the Lecture 11 material of updating a full belief
distribution. Also out of scope, as before: Beta distributions, the
Central Limit Theorem, and sampling-based estimation.
Unless a specific part is flagged below, every problem on the
exam is fair game.
Winter 2026
(PDF [])
Fair game except where noted.
- Literary Randomness — Poisson, Normal, exponential
- Art Museum Security Code — counting
- Fraud Detection — Bayes’ theorem (discrete), conditional independence
- Let There Be Light — Poisson, variance
- Footprints in the Caves of Lascaux — part (a) is fair game (a Normal
probability). Skip part (b): it asks for a posterior
belief over height (inference).
- TicketWizard — normal approximation to the binomial, Poisson
Fall 2025
(PDF [])
Fair game except where noted.
- Counting Rain Drops — Poisson, truncated Poisson
- Vibrant Variables — parts (b) and (c) are fair game (Normal/binomial,
Poisson). Skip part (a): it asks for the variance of a
Beta posterior.
- Word Identification — SKIP. Bayesian inference
(posterior over words).
- Variance Reduction Sampling — parts (a)–(c) are fair game (Bernoulli,
expectation, variance). Skip part (d): the distribution
of a sample average (Central Limit Theorem).
- Outlier Detection for Code in Place — SKIP. Bayesian
inference with continuous likelihoods.
- Random Molecules — independence, indicator variables, expectation
- The Golden Coin — geometric and binomial
Winter 2025
(PDF [])
Fair game except where noted.
- What a Time to Be Alive — Poisson, Bernoulli, normal approximation,
law of total probability
- Vibrant Variables — Poisson, exponential, uniform
- Board Game Analysis — probability, expectation, variance
- Rival Production — part (a) is fair game (a probability calculation).
Skip parts (b) and (c): they build a posterior belief
over N (inference).
- Accidental Caps-Lock Press — part (a) is fair game (a Normal
probability). Skip parts (b) and (c): they infer a
posterior from a continuous observation.
- The Large Language Model That Keeps on Trying — geometric,
conditional probability
Fall 2024
(PDF [])
Fair game except where noted.
- Adventure is Out There — Bernoulli, Bayes’ theorem (discrete),
expectation
- Chance Encounters — modeling with geometric, Poisson,
Poisson-binomial, normal approx
- Bingo! — counting
- The Driftwood Random Variable — custom discrete RV, normalizing
constant, E and Var
- True Random — Normal, inverse Φ
- DNA Mutation Clock — parts (a), (b), and (d) are fair game (Poisson,
binomial, probability). Skip part (c): it builds a
posterior belief over the number of years (inference).
Fall 2023
(PDF [])
Fair game except where noted.
- Measure of Variety — probability, Poisson, expectation
- GPT Generation — probability, counting, geometric, variance
- Era’s Tour — exponential, binomial, Poisson approximation
- How Many Coin Flips? — SKIP. Bayesian inference
(posterior over the number of flips).
- Auto Morse Code Detection — parts (a) and (b) are fair game (a Normal
probability; computing a prior). Skip parts (c) and
(d): they infer a posterior from a continuous observation.
Fall 2022
(PDF [])
Fair game except where noted.
- Weather Prediction — estimating probability from data,
independence
- Down to Lunch — Poisson, binomial
- Random Edges — counting, PMF, variance
- Expressed Trait — Poisson
- Mixing up Gaussians — part (a) is fair game (a law-of-total-probability
calculation). Skip part (b): it infers a posterior from
a continuous observation.
- Bayesian Viral Load Test — parts (a) and (b) are fair game
(probability, Poisson approximation). Skip part (c): it
builds a posterior belief over the viral load (inference).
Winter 2022
(PDF [])
Fair game except where noted.
- Stanford Life — independence, Poisson
- Midterm Theory — conditional probability
- Algorithmic Analysis — counting
- ASL Fingerspelling — conditional probability, independence
- Binary Spoof — binomial, Bayes’ theorem (discrete)
- PSetApp Answer Checker — part (a) is fair game (a Normal
probability). Skip part (b): it infers a posterior from
a continuous observation.
- Beyond the Binomial — Poisson-binomial (different p per trial)
Fall 2021
(PDF [])
Fair game except where noted.
- Color.com — counting, binomial, Poisson approximation
- Doodle Poll — binomial, independence
- I Heard That! — only part (d) is fair game (a Normal probability).
Skip parts (a)–(c): they update a belief about whether
the baby can hear (inference).
- Sleep and Dreams — Poisson, expectation, exponential, uniform
- Longest Sequence of Heads — counting, PMF, recursion
Spring 2019
(PDF [])
Fair game except where noted.
- Enigma Machine — counting
- Daycare.ai — binomial, expectation
- µ Girls — exponential, Poisson process, independence
- Name2Age — SKIP. Bayesian inference (posterior over
birth year).
- Grades are not Normal — parts (a)–(c) are fair game (Normal and
given-density probabilities). Skip part (d): Bayesian
model selection.
Fall 2018
(PDF [])
Fair game except where noted.
- Random Writer — counting, binomial
- Race Condition — Poisson
- Algorithmic Fairness — joint probability table, marginal/conditional
probability
- Traffic Light — continuous RV, expectation, variance, uniform
- Drug Effectiveness — part (a) is fair game (Bayes’ theorem with a
discrete observation). Skip part (b): it infers a
posterior from a continuous (Gaussian) observation.
- Simulation Accuracy — normal approximation to a binomial
proportion
Fall 2017
(PDF [])
Fair game except where noted.
- Alpha TicTacToe — counting, probability
- Wisdom of the Crowds — binomial, normal approximation
- 500 year floodplanes — Poisson
- Gaussian Mixture Model — parts (a)–(c) are fair game (Normal
probabilities, law of total probability). Skip part
(d): it infers which species from a continuous observation.
- Curse of Dimensionality — uniform, independence
- Goodbye integral (Monte Carlo Integration) — SKIP.
Sampling-based estimation, covered after the midterm.
Spring 2017
(PDF [])
Fair game except where noted.
- Spotify — counting, probability
- Secure Passwords — counting, geometric, expectation
- Shazam — counting, binomial, Bayes’ theorem (discrete)
- Recaptcha — parts (a) and (b) are fair game (a Normal probability; a
uniform PDF). Skip part (c): it infers a posterior from
a continuous observation.
- Exponentials — exponential distribution, CDF of a max
- Eleven-eleven — Poisson, normal approximation, probit function
Spring 2016
(PDF [])
Fair game except where noted.
- Card game — counting, probability, expectation
- Sampling a median — counting, binomial
- Netflix Tearjerker — conditional independence, Bayes’ theorem
(discrete)
- Wind energy — Normal, normal approximation to the binomial, sum of
Gaussians
- Autonomous car — SKIP. Bayesian inference for a
continuous quantity (posterior PDF).
- Ride sharing — Poisson, expectation, exponential
What about the Phi table? I am not going to make you look up values from a phi table. Instead you can leave your answer in terms of phi (the CDF of the standard normal). For example $\Phi(\frac{3}{4})$ is a fine final answer. This was not the case in the past so you will see questions which ask for a numeric answer in the practice exams.
Essential Practice
We recommend working through at least one practice midterm exam under realistic conditions (timed) before you take the midterm. Note: You should not expect that a TA will have prepared to answer these problems in office hours (there are far too many for them to prep them all). If you ask about one of this problems on the Ed forum or in office hours please be ready to give the full context, and be aware that the TA might not be able to prioritize them. This is especially true if you ask about them more than a week before the exam.
Also note that different content has been emphasized in prior quarters. So there may be questions on these exams that will cover content not emphasized in this quarter of CS109. Feel free to ask on Ed if you want to double check about any topics.
Extra Practice