Quiz — Lecture 13
Section A from memory, one line each. Section B shows your reasoning - marks are for method, not final answers. Answers are discussed in class; the exit ticket goes on a card.
Section A
A1. When is a dictionary the right structure rather than a list?
A2. What does tally.get(w, 0) do?
A3. Which set operation answers 'in both rosters'?
A4. What is the cost of x in some_list vs x in some_set?
Section B
B1. Tally 'mississippi': give the dictionary and the two most frequent letters with a tie rule.
B2. CS = {ada, bo}, DS = {bo, cy}: express and compute 'exactly one course'.
Exit ticket
Answer one of these on your card in 60 seconds (choose any one):
- When do you choose a dictionary over a list?
- What single operation do sets make O(1)-ish and lists O(n)?
- Restate the consensus rule of cs-052 precisely.
Homework
- Before: skim the four student pages; attempt case 1 on paper.
- After: write a five-line pseudocode solution for any case you did not
- Enrichment (optional): the stretch question on each case page.