Six original Cambridge-style questions on stepwise refinement and logic statements, with mark-scheme style answers.
Describe the process of stepwise refinement.
A program must "check a password". A valid password is at least 8 characters long and is not the same as the username. Refine the step check the password into detailed steps.
Write a logic statement that is TRUE when the integer variable Day holds a valid day of the month for April (1 to 30 inclusive).
Day >= 1 AND Day <= 30. ✓Day > 0 AND Day < 31). ✓Using the car park pseudocode in this lesson, state the value of Charge output for: (a) 61 minutes, no badge; (b) 400 minutes, no badge; (c) 650 minutes, no badge.
A shop gives a discount if a customer is a member and spends over $50, or if it is their birthday. A programmer writes IsMember AND (Spend > 50 OR IsBirthday). Explain why this is wrong and give a correct statement.
(IsMember AND Spend > 50) OR IsBirthday. ✓Give two benefits of using stepwise refinement when designing an algorithm.
Mark this once you have attempted all six and checked your working. It records a Practiced badge on the topic and adds a one-time bonus. Revealing the solutions alone does not count.