9618/22/O/N/22 question 2: worked solution (October/November 2022, paper 22)

Show as plain text

Cambridge AS Level Computer Science 9618 · 12.2 Program Design Worked solution from the Software Development Paper 2 Problem-solving and Programming booklet, Part 2 of 3. Q16 9618/22/O/N/22 original Q2 Structured · 11 marks Worked solution (a)(i) Write the steps in words, in order: Open Support_List.txt in APPEND mode (and close it at the end) [1] Prompt for and input a student name and mark [1] If the mark is 20 or more, skip to the repeat step [1] If the mark is less than 20, write only the name to the file [1] Repeat for all 35 students [1] (a)(ii) The data in a file is saved permanently , even after the computer is switched off, so it does not need to be typed in again when the program is re-run. [1] (a)(iii) WRITE mode would overwrite the existing data in the file, so the names from the other group tests would be lost. [1] (b) Follow the arrows from each state. From S1, Input-A gives Output-X and goes to S2. At S2, Input-A loops back to S2 with no output. S2 with Input-B gives Output-W and goes to S3. S3 with Input-A gives Output-W and goes to S4. Input Output Next state S1 Input-A Output-X S2 Input-A (none) S2 Input-B Output-W S3 Input-A Output-W S4 Row 2 correct [1] Row 3 correct [1] Row 4 correct [1] Row 5 correct [1] KEY IDEA APPEND adds to a file without losing what is there, and a file keeps its data when the power is off. TOTAL 11 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by Audere Prep. Tap the picture to open it on YouTube.