Quiz — Lecture 02

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 makes a line of pseudocode ambiguous?

A2. Why initialise a counter before the loop?

A3. In the password rule (letters, digits, length 8), which test order avoids confusing error messages?

A4. What is a sentinel value?

Section B

B1. Write pseudocode that checks a password rule (at least 8 characters, at least one digit) and prints the FIRST failing reason.

B2. Write the vending machine's accept-coin step so another student could implement it without asking you a question.

Exit ticket

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

  1. Name the three control shapes every pseudocode solution is built from.
  1. What makes a pseudocode line 'testable'?
  1. When is a state table required?

Homework