2210/23/O/N/25 question 4: worked solution (October/November 2025, paper 23)

Show as plain text

Cambridge O Level Computer Science 2210 · 7.9 Writing and amending algorithms Worked solution from the Algorithm design and problem-solving Paper 2 Algorithms, Programming and Logic booklet, Part 8 of 8. Q115 2210/23/O/N/25 original Q4 Structured · 14 marks Worked solution (a) Input both numbers, work out the total with the booking fee, and output it. OUTPUT "Please enter the number of adult tickets " INPUT Adult OUTPUT "Please enter the number of child tickets " INPUT Child Total ← (Adult * 12.99) + (Child * 7.99) + 1.99 OUTPUT "The total cost is ", Total Input of the number of adult tickets and child tickets [1] Total of adult and child ticket costs calculated [1] Booking fee of 1.99 added [1] Total output with an appropriate message [1] (b) Put the adult input inside a loop that repeats while the number is too small. REPEAT OUTPUT "You need at least one adult ticket. Enter the number of adult tickets " INPUT Adult UNTIL Adult >= 1 Add a REPEAT ... UNTIL loop (or a WHILE loop) [1] With the correct condition, for example UNTIL Adult >= 1 (or WHILE Adult < 1) [1] With a suitable message asking the user to enter the number again [1] The INPUT of Adult is inside the loop so it is asked again each time [1] (c)(i) The person needs A (tall enough) AND B (old enough) AND NOT C (no medical condition). Write: X = (A AND B) AND (NOT C) A AND B [1] AND NOT C [1] (c)(ii) X is 1 only when A = 1, B = 1 and C = 0. A B C A AND B NOT C X 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 1 0 0 1 1 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 1 1 0 1 1 1 1 1 1 1 0 0 X correct in rows 1 and 2 [1] X correct in rows 3 and 4 [1] X correct in rows 5 and 6 [1] X correct in rows 7 and 8 [1] KEY IDEA Turn the rules into a logic expression (AND for all rules, NOT for the opposite) and use it to fill in the truth table. TOTAL 14 marks Official mark scheme VIDEO ▶ Topic lesson A lesson on this topic · by Mr Bulmer's Learning Zone. Tap the picture to open it on YouTube.