9618/23/M/J/25 question 1: worked solution (May/June 2025, paper 23)

Show as plain text

Cambridge AS Level Computer Science 9618 · 11.3 Structured Programming Worked solution from the Programming Paper 2 Problem-solving and Programming booklet, Part 3 of 3. Q89 9618/23/M/J/25 original Q1 Structured · 14 marks Worked solution (a)(i) Write any two of these: A task that is repeated can be written once and reused or called from several places [1] A specific task can be coded as its own module, which makes the program simpler [1] Also accepted: a module may already be available, or testing, debugging and maintenance are easier (a)(ii) Write one of these: A local variable can only be used inside the module where it is declared, but a global variable can be used by the whole program [1] A local variable uses memory only while its module runs, but a global variable uses memory all the time the program runs (also accepted). (a)(iii) Write any two of these: The same variable name can be reused in other modules [1] The module is self-contained, so it cannot accidentally change a variable outside it [1] Also accepted: it helps modularisation, or the memory can be reused when the module is not running (b) Use the insert's functions to complete each row: Expression Evaluates to CHR(68) 'D' MONTH(04/02/2025) 2 NOT TRUE FALSE STR_TO_NUM(MID("Court1.4Upper", 6, 3)) 1.4 CHR [1] MONTH (or DAY(...) - 2, or YEAR(...) - 2023) [1] NOT (or FALSE = TRUE) [1] STR_TO_NUM around the MID function [1] MID("Court1.4Upper", 6, 3) , which starts at character 6 and takes 3 characters [1] (c) Choose the type from how each value is used: Variable Data type MemberCount INTEGER TotalTakings REAL BookingConfirmed BOOLEAN MemberDOB DATE MemberCount is a whole number: INTEGER [1] TotalTakings is money with decimals: REAL [1] BookingConfirmed has two states: BOOLEAN [1] MemberDOB is a date: DATE [1] KEY IDEA Modules and local variables keep code reusable and safe; pick data types from how the value is used. TOTAL 14 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by Awab Aqib. Tap the picture to open it on YouTube.