Community resourceWorksheet
J277 2 Paper 2 guided Section B programming scenario
Part 3 of 5 · J277 Paper 2 · Exam transition
A sustained Section B booking scenario taken through all four skills: design, write, test and refine.
Students will:
- design a solution before writing any code
- write a calculation function to a stated specification
- add range validation that rejects unsuitable input
- process a one-dimensional array of bookings
- test a program, then refine an incorrect version
Inside: 8 explanation cells, 4 runnable Python tasks and 3 written answers. 33 marks, about 60 minutes.
Series: J277 Paper 2 · Exam transition, part 3 of 5.
Shared by Coding PathwayVerified teacher
- 15 cells
- About 60 minutes
- CC BY-SA 4.0
- Shared 17 Aug 2026
- Updated 9 Sept 2026
Preview
The whole resource, exactly as a class sees it. Answers and marking are held back.
Guided Section B programming scenario
A school arts festival needs a small booking program. This longer programming scenario practises the four Section B skills: design, write, test and refine.
The program stores an event name, ticket price and number of tickets. It must calculate the booking total, reject unsuitable ticket quantities and analyse a Python list that represents a fixed one-dimensional array of bookings.
The support reduces as you progress. Read each requirement carefully and use the named variables and functions so the checks can run your code with other data.
Complete one numbered stage at a time. Test each stage before moving on so the program never feels like one enormous task.
1. Design the solution
Before writing code, separate what the program receives, what it calculates and what it produces. Then identify where selection, iteration and a subprogram are useful.
Identify two inputs, two processes and two outputs for the festival booking program.
Present six labelled points. Use details from the scenario rather than generic words such as 'data'.
Students type their answer here.
2. Write a calculation function
Complete booking_total(price, quantity). It must multiply the two parameters and return the result. The function should not ask for fresh input because the required data is already supplied through its parameters.
Test it mentally with £7.50 and 4 tickets: the returned value should be 30.0. Hidden checks use other values, so do not fix the answer at 30.
def booking_total(price, quantity):
# Calculate and return the total cost.
pass
3. Add range validation
Festival bookings must contain from 1 to 6 tickets inclusive. Complete valid_quantity(quantity) so it returns True for every accepted whole-number quantity and False otherwise.
The task assumes quantity is already an integer. Concentrate on the inclusive range rule; exception handling for text input is not required here.
def valid_quantity(quantity):
# Return True only for quantities from 1 to 6 inclusive.
pass
4. Process an array of booking quantities
Python lists represent OCR fixed-array tasks in these worksheets. Complete count_large_bookings(quantities). It must inspect every element and return how many quantities are 5 or more.
Use an accumulator that starts at zero, a loop over the supplied list and selection inside the loop. Do not count list positions: the condition must use each stored quantity.
def count_large_bookings(quantities):
count = 0
# Inspect every quantity and count values of 5 or more.
return count
5. Test before trusting the program
A useful test plan states the test data, its type or purpose, the expected result and, after execution, the actual result. Boundary values deserve explicit tests because small comparison mistakes often affect them.
Create four test-plan rows for valid_quantity: one normal, two boundary and one invalid test. Give the input, classification and expected result for each row.
Use integer inputs because the function assumes the type check has already succeeded.
Students type their answer here.
6. Refine an incorrect program
The function below should give a 10% discount when a booking total is £50 or more. It contains a logic error. Run it, inspect the failed boundary behaviour, then correct only the condition or calculation needed.
def discounted_total(total):
if total > 50:
return total * 0.90
else:
return total
Explain how the program you developed demonstrates design, writing, testing and refining.
Give one specific example from the festival scenario for each stage.
Students type their answer here.
Review
Section B does not require one enormous program. Success comes from turning requirements into small, precise algorithms, testing boundary behaviour and correcting faults without breaking working parts.