AS · Practice questions · Stepwise refinement

Keep refining.

Six original Cambridge-style questions on stepwise refinement and logic statements, with mark-scheme style answers.

Original questions All questions on this page are original work, written in the Cambridge AS & A Level style. They are not from past papers. They test the same concepts and skills the syllabus rewards.
Keep these straight

Outline, refine, code.

01
Explain
[2 marks]

Describe the process of stepwise refinement.

  • The algorithm is first written as a few high-level steps; each step is broken down into smaller, more detailed steps. ✓
  • This is repeated (level by level) until each step is detailed enough to be programmed. ✓
02
Apply
[4 marks]

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.

  • Input the username and the password. ✓
  • Find the length of the password (LENGTH). ✓
  • Check the length is at least 8 AND the password is not equal to the username. ✓
  • If both are true output an accepted message, otherwise output a rejected message (and ask again). ✓
03
Write
[2 marks]

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. ✓
  • Both comparisons complete and joined with AND (accept Day > 0 AND Day < 31). ✓
04
Calculate
[3 marks]

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) (61 + 59) DIV 60 = 2 hours, so 0.0. ✓
  • (b) 459 DIV 60 = 7 hours; (7 − 2) × 1.50 = 7.50. ✓
  • (c) 709 DIV 60 = 11 hours; 9 × 1.50 = 13.50, more than 12.00, so 12.00. ✓
05
Analysis
[3 marks]

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.

  • It only gives a birthday discount to members, but the rule gives it to anyone on their birthday. ✓
  • Example: a non-member on their birthday gives FALSE AND (... OR TRUE) = FALSE. ✓
  • Correct: (IsMember AND Spend > 50) OR IsBirthday. ✓
06
Recall
[2 marks]

Give two benefits of using stepwise refinement when designing an algorithm.

  • A large problem is tackled in small, manageable steps, so it is easier to understand and design. ✓
  • The final steps convert directly into code / errors are easier to find; parts can be shared between programmers or turned into modules. ✓

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.