9618/22/O/N/21 question 2: worked solution (October/November 2021, paper 22)
Show as plain textHide plain text
Cambridge AS Level Computer Science 9618 · 12.1 Program Development Life cycle Worked solution from the Software Development Paper 2 Problem-solving and Programming booklet, Part 1 of 3. Q1 9618/22/O/N/21 original Q2 Structured · 10 marks Worked solution (a) 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 NextNum START, 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. (b)(i) 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] (b)(ii) 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] KEY IDEA Initialise before the loop, test for the stop value straight after the input, and choose an iterative method when the customer needs to see an early version. TOTAL 10 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by CS BY AQIB KHAN. Tap the picture to open it on YouTube.