Quiz — Lecture 14

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. What two parts does a function contract have?

A2. Why prefer return over print inside helpers?

A3. What is a pure helper?

A4. Name one benefit of decomposition beyond reuse.

Section B

B1. Write the contract (PRE/POST) for a phone-number validator.

B2. The log-parsing monolith: name the three functions you would extract and each one's single job.

Exit ticket

Answer one of these on your card in 60 seconds (choose any one):

  1. What makes a function name good?
  1. Why are mutable defaults dangerous?
  1. What does 'refactor without behaviour change' demand?

Homework