Worked solution from the Software Development Paper 2 Problem-solving and Programming booklet, Part 1 of 3.
Set the counts and totals to zero first. Then loop: input, stop on zero, and otherwise add to the positive or negative count and total.
START
Set PosCount, NegCount to 0
Set PosTotal, NegTotal to 0
INPUT NextNum
Is NextNum = 0 ? YES → OUTPUT PosCount, NegCount
OUTPUT PosTotal, NegTotal
END
NO → Is NextNum > 0 ?
YES → Increment PosCount
Set PosTotal to PosTotal + NextNum
NO → Increment NegCount
Set NegTotal to NegTotal + NextNum
go back to INPUT NextNumSTART, then the counts set to 0 and the totals set to 0 before the loop [1]
INPUT NextNum inside the loop, followed by a decision Is NextNum = 0 ? [1]
Decision Is NextNum > 0 ? with the positive and negative counts incremented on the correct branches [1]
Sum steps: PosTotal + NextNum on the positive branch and NegTotal + NextNum on the negative branch, then back to the input [1]
On YES (zero), output both counts and both totals, then END [1]
The count and sum steps may be in either order. A flowchart that does not work scores at most 4.
The principal does not know all the details and wants an early version.
Life cycle method: iterative (or rapid application development, RAD) [1]
Reason: it gives a working model / prototype early so the principal can review it and say what to change [1]
Any three of these design activities:
Decide the data structures [1]
Decide the algorithms (flowcharts or pseudocode) or the program structure into modules [1]
Design the user interface or web-page layout (or the test plan, or the choice of programming language) [1]
▶ Whole paper
Video solution of the whole paper · by CS BY AQIB KHAN. Tap the picture to open it on YouTube.
Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.