Cambridge A Level Computer Science 9618 — 2024 May/June Paper 2 · Variant 1

9618/21/M/J/24 · 75 marks · ≈84 min

The question paper and its mark scheme, free to read here and free to download. This is Cambridge’s own paper, exactly as it was sat.

← All Computer Science papersWhat was in this paper?

Question paper24 pages

Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 1 of 24
Page 1 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 2 of 24
Page 2 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 3 of 24
Page 3 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 4 of 24
Page 4 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 5 of 24
Page 5 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 6 of 24
Page 6 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 7 of 24
Page 7 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 8 of 24
Page 8 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 9 of 24
Page 9 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 10 of 24
Page 10 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 11 of 24
Page 11 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 12 of 24
Page 12 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 13 of 24
Page 13 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 14 of 24
Page 14 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 15 of 24
Page 15 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 16 of 24
Page 16 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 17 of 24
Page 17 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 18 of 24
Page 18 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 19 of 24
Page 19 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 20 of 24
Page 20 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 21 of 24
Page 21 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 22 of 24
Page 22 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 23 of 24
Page 23 of 24
Cambridge A Level Computer Science 9618 2024 May/June Paper 2 · Variant 1 question paper, page 24 of 24
Page 24 of 24

Mark scheme12 pages

Answers below. Sit the paper first if you are practising.

Mark scheme, page 1 of 12
Page 1 of 12
Mark scheme, page 2 of 12
Page 2 of 12
Mark scheme, page 3 of 12
Page 3 of 12
Mark scheme, page 4 of 12
Page 4 of 12
Mark scheme, page 5 of 12
Page 5 of 12
Mark scheme, page 6 of 12
Page 6 of 12
Mark scheme, page 7 of 12
Page 7 of 12
Mark scheme, page 8 of 12
Page 8 of 12
Mark scheme, page 9 of 12
Page 9 of 12
Mark scheme, page 10 of 12
Page 10 of 12
Mark scheme, page 11 of 12
Page 11 of 12
Mark scheme, page 12 of 12
Page 12 of 12

Paper as text

Question paper, page 1

This document has 24 pages. Any blank pages are indicated. [Turn over Cambridge International AS & A Level COMPUTER SCIENCE 9618/21 Paper 2 Fundamental Problem-solving and Programming Skills May/June 2024 2 hours You must answer on the question paper. You will need: Insert (enclosed) INSTRUCTIONS ● Answer all questions. ● Use a black or dark blue pen. ● Write your name, centre number and candidate number in the boxes at the top of the page. ● Write your answer to each question in the space provided. ● Do not use an erasable pen or correction fluid. ● Do not write on any bar codes. ● You may use an HB pencil for any diagrams, graphs or rough working. ● Calculators must not be used in this paper. INFORMATION ● The total mark for this paper is 75. ● The number of marks for each question or part question is shown in brackets [ ]. ● No marks will be awarded for using brand names of software packages or hardware. ● The insert contains all the resources referred to in the questions. * 8 4 1 6 1 0 0 9 4 2 * DC (PQ/CGW) 329348/4 © UCLES 2024

Question paper, page 2

2 9618/21/M/J/24 © UCLES 2024 Refer to the insert for the list of pseudocode functions and operators. 1 An algorithm is developed in pseudocode before being coded in a programming language. (a) The following table shows four valid pseudocode assignment statements. Complete the table by giving an appropriate data type to declare each of the variables A, B, C and D. Assignment statement Data type A LEFT(MyName, 1) B Total * 2 C INT(ItemCost) / 3 D "Odd OR Even" [4] (b) Other variables in the program have example values as shown: Variable Value Sorted False Tries 9 ID "ZGAC001" Complete the table by evaluating each expression, using the example values. Expression Evaluates to Tries < 10 AND NOT Sorted Tries MOD 4 TO_LOWER(MID(ID, 3, 1)) LENGTH(ID & "xx") >= Tries [4]

Question paper, page 3

3 9618/21/M/J/24 © UCLES 2024 [Turn over (c) The variable names A, B, C and D in part (a) are not good programming practice. (i) State why these variable names are not suitable. … … [1] (ii) Identify one problem that these variable names might cause. … … [1] (iii) The choice of suitable variable names is one example of good programming practice. Give one other example. … … [1]

Question paper, page 4

4 9618/21/M/J/24 © UCLES 2024 2 An algorithm has three steps. It will: 1. repeatedly input a pair of numeric values A and B 2. count the number of pairs that are input until A has been greater than B 10 times 3. output the number of pairs that were input. (a) Complete the program flowchart. START END INPUT A, B Yes No [5]

Question paper, page 5

5 9618/21/M/J/24 © UCLES 2024 [Turn over (b) Step 1 of the algorithm is changed. A variable ThisSequence is used to enter a sequence of 10 pairs of numeric values, using a single input statement. Following the input of ThisSequence the revised algorithm will extract the pairs of numbers. Describe the variable ThisSequence and how the numbers are extracted. … … … … [2]

Question paper, page 6

6 9618/21/M/J/24 © UCLES 2024 3 The diagram shows an Abstract Data Type (ADT) representation of a linked list after data items have been added. • PS is the start pointer. • PF is the free list pointer. • Labels Df, Dc, Db and Dy represent the data items of nodes in the list. • Labels Fg, Fh, Fm and Fw represent the data items of nodes in the free list. • The symbol Ø represents a null pointer. Df PS Dc Db Dy Ø Fg PF Fh Fm Fw Ø (a) Describe the linked list immediately after initialisation, before any data items are added. … … … … … … [3]

Question paper, page 7

7 9618/21/M/J/24 © UCLES 2024 [Turn over (b) A program will be written to include a linked list to store alphanumeric user IDs. The design uses two variables and two 1D arrays to implement the linked list. Each array element contains data of a single data type and not a record. The statements below describe the design. Complete the statements. The two variables will be of type … . The two variables will be used as … to the arrays. The values stored in the two variables will indicate … … . The first 1D array will be of type … . The first 1D array will be used to … . The second 1D array will be of type … . The second 1D array will be used to … . [5]

Question paper, page 8

8 9618/21/M/J/24 © UCLES 2024 4 A global 1D array Data contains 100 elements of type integer. A function Check() will: • total the element values in odd index locations (1, 3, 5 ... 97, 99) • total the element values in even index locations (2, 4, 6 ... 98, 100) • return one of three strings ‘Odd’, ‘Even’ or ‘Same’ to indicate which total is the greater, or whether the totals are the same. Write pseudocode for the function Check(). … … … … … … … … … … … … … … … … … … … … … … [6]

Question paper, page 9

9 9618/21/M/J/24 © UCLES 2024 [Turn over BLANK PAGE

Question paper, page 10

10 9618/21/M/J/24 © UCLES 2024 5 A global 1D array of strings contains three elements which are assigned values as shown: Data[1] "aaaaaa" Data[2] "bbbbbb" Data[3] "cccccc" Procedure Process() manipulates the values in the array. The procedure is written in pseudocode as follows: PROCEDURE Process(Format : STRING) DECLARE Count, Index, L : INTEGER DECLARE Result : STRING DECLARE C : CHAR Result "****" FOR Count 1 TO LENGTH(Format) STEP 2 C MID(Format, Count, 1) L STR_TO_NUM(MID(Format, Count + 1, 1)) Index (Count + 1) DIV 2 CASE OF C 'X' : Result TO_UPPER(Data[Index]) 'Y' : Result TO_LOWER(Data[Index]) 'Z' : Result "**" & Data[Index] ENDCASE Data[Index] LEFT(Result, L) NEXT Count ENDPROCEDURE

Question paper, page 11

11 9618/21/M/J/24 © UCLES 2024 [Turn over (a) Complete the trace table by dry running the procedure when it is called as follows: CALL Process("X3Y2W4") Count C L Index Result Data[1] Data[2] Data[3] [6] (b) The procedure is to be modified. If variable C is assigned a value other than 'X', 'Y' or 'Z', then procedure Error() is called and passed the value of variable C as a parameter. This modification can be implemented by adding a single line of pseudocode. (i) Write the single line of pseudocode. … [1] (ii) State where this new line should be placed. … [1]

Question paper, page 12

12 9618/21/M/J/24 © UCLES 2024 6 Three points on a grid form a triangle with sides of length A, B and C as shown in the example: 10 y x 9 8 7 6 5 4 1 0 2 3 4 5 6 7 8 9 10 A C B 3 2 1 A triangle is said to be right-angled if the following test is true (where A is the length of the longest side): A2 = B2 + C2 A2 means A multiplied by A, for example 32 means 3 × 3 which evaluates to 9 You can calculate A2, B2 and C2 by using the coordinates of the endpoints of each line. For example, B2 is calculated as follows: 10 y x 9 8 7 6 5 4 1 0 2 3 4 5 6 7 8 9 10 B P2 P2 P1 P1 3 2 1 (x1, y1) (x1, y1) (x2, y2) (x2, y2) The endpoints, P1 and P2, have the coordinates (3, 2) and (6, 6). The value B2 is given by the formula: B2 = (x1 − x2)2 + (y1 − y2)2 In this example: B2 = (3 − 6)2 + (2 − 6)2 B2 = (–3)2 + (–4)2 B2 = 9 + 16 B2 = 25

Question paper, page 13

13 9618/21/M/J/24 © UCLES 2024 [Turn over (a) A function IsRA() will: • take three sets of integers as parameters representing the coordinates of the three endpoints that form a triangle • return TRUE if the endpoints form a right-angled triangle, otherwise return FALSE. In pseudocode, the operator ‘^’ represents an exponent, which is the number of times a value is multiplied by itself. For example, the expression Value2 may be written in pseudocode as Value ^ 2 Complete the pseudocode for the function IsRA(). FUNCTION IsRA(x1, y1, x2, y2, x3, y3 : INTEGER) RETURNS BOOLEAN … … … … … … … … … … … … … … … … ENDFUNCTION [6]

Question paper, page 14

14 9618/21/M/J/24 © UCLES 2024 (b) The test used to check if a triangle is right-angled can be written in two ways: A2 = B2 + C2 or A = √(B2 + C2) The symbol √ represents the square root operation. For example, √81 = 9 A new function SQRT() is written to perform the square root operation. The function takes an integer number as a parameter and returns a positive real value representing the square root of the number. During testing it is found that the SQRT() function returns a value that is only accurate to 4 decimal places. For example, SQRT(25) returns 5.0000125 rather than the correct value of 5.0 The function IsRA() from part (a) is modified to use the new SQRT() function to test if a triangle is right-angled. Describe a problem that might occur when using the modified IsRA() function and suggest a solution that still allows the SQRT() function to be used. Problem … … Solution … … [2]

Question paper, page 15

15 9618/21/M/J/24 © UCLES 2024 [Turn over BLANK PAGE

Question paper, page 16

16 9618/21/M/J/24 © UCLES 2024 7 A fitness club has a computerised membership system. The fitness club offers a number of different exercise classes. The following information is stored for each club member: name, home address, email address, mobile phone number, date of birth and the exercise(s) they are interested in. (a) When an exercise class is planned, a new module will send personalised text messages to each member who has expressed an interest in that exercise. Members wishing to join the class send a text message back. Members may decide not to receive future text messages by replying with the message ‘STOP’. The process of abstraction is used to filter out unnecessary information. (i) State one advantage of applying abstraction to this problem. … … [1] (ii) Identify three items of information that will be required by the new module. Justify your choices with reference to the given scenario. Item 1 required … Justification … … Item 2 required … Justification … … Item 3 required … Justification … … [3] (iii) Identify two operations that would be required to process data when the new module receives a text message back from a member. Operation 1 … … Operation 2 … … [2]

Question paper, page 17

17 9618/21/M/J/24 © UCLES 2024 [Turn over (b) The structure chart illustrates part of the membership program: Sub-A Sub-B P1 T1 P2 Name Update Sub-C A Data item notes: • Name contains the name of a club member • P1 and T1 are of type real. (i) Explain the meaning of the diamond symbol (labelled with the letter A) in the chart. … … … … [2] (ii) Write the pseudocode module headers for Sub-A and Sub-B. Sub-A … … Sub-B … … [4]

Question paper, page 18

18 9618/21/M/J/24 © UCLES 2024 8 A teacher is designing a program to process pseudocode projects written by her students. Each student project is stored in a text file. The process is split into a number of stages. Each stage performs a different task and creates a new file named as shown: File name Comment MichaelAday_src.txt student project file produced by student Michael Aday MichaelAday_S1.txt file produced by stage 1 MichaelAday_S2.txt file produced by stage 2 The teacher has defined the first program module as follows: Module Description DeleteComment() • called with a parameter of type string representing a line of pseudocode from a student’s project file • returns the line after removing any comments Note on comments: A comment starts with two forward slash characters and includes all the remaining characters on the line. The following example shows a string before and after the comment has been removed: Before: IF X2 > 13 THEN //check if limit exceeded After: IF X2 > 13 THEN

Question paper, page 19

19 9618/21/M/J/24 © UCLES 2024 [Turn over (a) Complete the pseudocode for module DeleteComment(). FUNCTION DeleteComment(Line : STRING) RETURNS STRING … … … … … … … … … … … … … … … … … … … … … … ENDFUNCTION [8]

Question paper, page 20

20 9618/21/M/J/24 © UCLES 2024 (b) A second module is defined: Module Description Stage_1() • called with a parameter of type string representing a student name • creates a new stage 1 file • copies each line from the student’s project file to the stage 1 file after removing any comment from each line • does not write blank lines to the stage 1 file • returns the number of lines written to the stage 1 file Write pseudocode for module Stage_1(). Module DeleteComment() must be used in your solution. … … … … … … … … … … … … … … … … … … … …

Question paper, page 21

21 9618/21/M/J/24 © UCLES 2024 … … … … … … … … [7]

Question paper, page 22

22 9618/21/M/J/24 © UCLES 2024 BLANK PAGE

Question paper, page 23

23 9618/21/M/J/24 © UCLES 2024 BLANK PAGE

Question paper, page 24

24 9618/21/M/J/24 © UCLES 2024 Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the publisher will be pleased to make amends at the earliest possible opportunity. To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download at www.cambridgeinternational.org after the live examination series. Cambridge Assessment International Education is part of Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge Local Examinations Syndicate (UCLES), which is a department of the University of Cambridge. BLANK PAGE

Mark scheme, page 1

This document consists of 12 printed pages. © Cambridge University Press & Assessment 2024 [Turn over Cambridge International AS & A Level COMPUTER SCIENCE 9618/21 Paper 2 Fundamental Problem-solving and Programming Skills May/June 2024 MARK SCHEME Maximum Mark: 75 Published This mark scheme is published as an aid to teachers and candidates, to indicate the requirements of the examination. It shows the basis on which Examiners were instructed to award marks. It does not indicate the details of the discussions that took place at an Examiners’ meeting before marking began, which would have considered the acceptability of alternative answers. Mark schemes should be read in conjunction with the question paper and the Principal Examiner Report for Teachers. Cambridge International will not enter into discussions about these mark schemes. Cambridge International is publishing the mark schemes for the May/June 2024 series for most Cambridge IGCSE, Cambridge International A and AS Level and Cambridge Pre-U components, and some Cambridge O Level components.

Mark scheme, page 2

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2024 © Cambridge University Press & Assessment 2024 Page 2 of 12 Generic Marking Principles These general marking principles must be applied by all examiners when marking candidate answers. They should be applied alongside the specific content of the mark scheme or generic level descriptions for a question. Each question paper and mark scheme will also comply with these marking principles. GENERIC MARKING PRINCIPLE 1: Marks must be awarded in line with:  the specific content of the mark scheme or the generic level descriptors for the question  the specific skills defined in the mark scheme or in the generic level descriptors for the question  the standard of response required by a candidate as exemplified by the standardisation scripts. GENERIC MARKING PRINCIPLE 2: Marks awarded are always whole marks (not half marks, or other fractions). GENERIC MARKING PRINCIPLE 3: Marks must be awarded positively:  marks are awarded for correct/valid answers, as defined in the mark scheme. However, credit is given for valid answers which go beyond the scope of the syllabus and mark scheme, referring to your Team Leader as appropriate  marks are awarded when candidates clearly demonstrate what they know and can do  marks are not deducted for errors  marks are not deducted for omissions  answers should only be judged on the quality of spelling, punctuation and grammar when these features are specifically assessed by the question as indicated by the mark scheme. The meaning, however, should be unambiguous. GENERIC MARKING PRINCIPLE 4: Rules must be applied consistently, e.g. in situations where candidates have not followed instructions or in the application of generic level descriptors. GENERIC MARKING PRINCIPLE 5: Marks should be awarded using the full range of marks defined in the mark scheme for the question (however; the use of the full mark range may be limited according to the quality of the candidate responses seen). GENERIC MARKING PRINCIPLE 6: Marks awarded are based solely on the requirements as defined in the mark scheme. Marks should not be awarded with grade thresholds or grade descriptors in mind.

Mark scheme, page 3

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2024 © Cambridge University Press & Assessment 2024 Page 3 of 12 Mark scheme abbreviations / separates alternative words / phrases within a marking point // separates alternative answers within a marking point underline actual word given must be used by candidate (grammatical variants accepted) max indicates the maximum number of marks that can be awarded ( ) the word / phrase in brackets is not required, but sets the context Note: No marks are awarded for using brand names of software packages or hardware.

Mark scheme, page 4

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2024 © Cambridge University Press & Assessment 2024 Page 4 of 12 Question Answer Marks 1(a) Assignment statement Data type A  LEFT(MyName, 1) CHAR / STRING B  Total * 2 INTEGER / REAL C  INT(ItemCost) / 3 REAL D  "Odd OR Even" STRING One mark per row 4 1(b) Expression Evaluates to Tries < 10 AND NOT Sorted TRUE Tries MOD 4 1 TO_LOWER(MID(ID, 3, 1)) 'a' // "a" LENGTH(ID & "xx") >= Tries TRUE One mark per row 4 1(c)(i) The names do not reflect / indicate the purpose of the variable // the names are not meaningful 1 1(c)(ii) They make the program more difficult to understand / debug / maintain 1 1(c)(iii) One mark from:  Indentation / use of white space  Capitalisation of keywords  Use of comments  Use of modular programming  Use of local variables Note: max 1 mark 1

Mark scheme, page 5

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2024 © Cambridge University Press & Assessment 2024 Page 5 of 12 Question Answer Marks 2(a) One mark per outlined region: 1 Initialise both counts 2 Increment Tries every time a pair is input 3 Compare A > B and increment Count if TRUE 4 Test for Count = 10 (10th time A > B) – MUST include Yes / No labels 5 If so output Tries, otherwise loop 5 2(b) One mark per point: 1 A (variable of type) string will be input // by example e.g. “67,72” 2 A special / identified character would need to be used to separate each numeric value // all numbers are fixed length 2

Mark scheme, page 6

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2024 © Cambridge University Press & Assessment 2024 Page 6 of 12 Question Answer Marks 3(a) One mark per point: 1 The PS contains a null pointer 2 The PF points to the first element on the free list 3 All the nodes are on the free list 3 3(b) Max 2 marks for 'Variables': The two variables will be of type Integer The two variables will be used as pointers / indexes to the arrays. The values stored in the two variables will indicate the first element in each list The first 1D array will be of type String The first 1D array will be used to store the values // data items // User IDs The second 1D array will be of type Integer The second 1D array will be used to store the pointers // point to next item Mark as follows: One mark for each of the first three rows One mark for both Array 1 rows One mark for both Array 2 rows 5

Mark scheme, page 7

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2024 © Cambridge University Press & Assessment 2024 Page 7 of 12 Question Answer Marks 4 Example: FUNCTION Check() RETURNS STRING DECLARE Odd, Even, Index : INTEGER Odd  0 Even  0 FOR Index  1 TO 100 IF Index MOD 2 = 0 THEN Even  Even + Data[Index] ELSE Odd  Odd + Data[Index] ENDIF NEXT Index ENDFUNCTION Mark as follows: 1. Function heading, ending and return type 2. Declare local variables Odd, Even and Index as integers 3. Initialise Odd and Even 4. Loop for 100 iterations // through array 5. Sum Odd and Even element values in a loop 6. Compare Odd and Even after the loop and Return appropriate string 6

Mark scheme, page 8

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2024 © Cambridge University Press & Assessment 2024 Page 8 of 12 Question Answer Marks 5(a) One mark per zone. 6 5(b)(i) OTHERWISE : CALL Error(C) 1 5(b)(ii) After the 'Z' clause in the CASE construct // before the ENDCASE 1

Mark scheme, page 9

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2024 © Cambridge University Press & Assessment 2024 Page 9 of 12 Question Answer Marks 6(a) FUNCTION IsRA(x1, y1, x2, y2, x3, y3 : INTEGER) RETURNS BOOLEAN DECLARE Len1, Len2, Len3 : INTEGER Len1  (x1 - x2) ^ 2 + (y1 - y2) ^ 2 Len2  (x1 - x3) ^ 2 + (y1 - y3) ^ 2 Len3  (x2 - x3) ^ 2 + (y2 - y3) ^ 2 IF (Len1 = Len2 + Len3) OR__ (Len2 = Len1 + Len3) OR__ (Len3 = Len1 + Len2) THEN RETURN TRUE ELSE RETURN FALSE ENDIF ENDFUNCTION Mark as follows: 1 Calculate the square of the length of at least one side 2 Calculation of all three lengths squared correctly 3 One correct comparison of square of three lengths 4 All three comparisons… 5 combined using logical operators / nested IF // completely correct selection 6 Return result correctly in both cases 6 6(b) 1 mark for statement of problem: Problem:  The function will return an incorrect value // the test will fail 1 mark for solution: Solution:  Round the calculated values (to a known number of decimal places)  Define a threshold below which any difference can be ignored 2 Question Answer Marks 7(a)(i) To make the solution easier to design / implement / solve 1

Mark scheme, page 10

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2024 © Cambridge University Press & Assessment 2024 Page 10 of 12 Question Answer Marks 7(a)(ii) One mark per item and justification Item: mobile phone number Justification: to send the text message Item: name Justification: to personalise the text message Item: exercise interest Justification: to determine whether this member would be interested 3 7(a)(iii) Examples include:  Add a member to a list of those interested in the new class  Remove the member from future SMS messages  Read/process Message  Identify who from One mark for each. Max 2 marks 2 7(b)(i) Means that Update calls (one of) either Sub-A, Sub-B or Sub-C One mark for each point:  reference to selection / decision / if  naming all four modules correctly 2 7(b)(ii) PROCEDURE Sub-A (Name : STRING, BYREF P2 : BOOLEAN) FUNCTION Sub-B (P1 : REAL) RETURNS REAL One mark per underlined part in each case 4

Mark scheme, page 11

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2024 © Cambridge University Press & Assessment 2024 Page 11 of 12 Question Answer Marks 8(a) FUNCTION DeleteComment(Line : STRING) RETURNS STRING DECLARE NewLine, TwoChars : STRING DECLARE Count, TrimTo : INTEGER CONSTANT Comment = "//" NewLine  Line TrimTo  0 Count  1 WHILE Count < LENGTH(Line) AND TrimTo = 0 TwoChars  MID(Line, Count, 2) // extract 2 chars IF TwoChars = Comment THEN TrimTo  Count ENDIF Count  Count + 1 ENDWHILE IF TrimTo <> 0 THEN NewLine  LEFT(Line, TrimTo - 1) ENDIF RETURN NewLine ENDFUNCTION Mark as follows: 1 Loop to length of Line (parameter) // length of Line -1 2 Terminate loop on first double slash 3 Attempt to extract one/two characters in a loop 4 Check for "//" after attempt at extraction in a loop 5 Record start position of comment // Calculate amount of trim required 6 Attempt to trim Line from start of comment 7 Completely correct trimmed Line from start of comment 8 Return Line after a reasonable overall attempt 8

Mark scheme, page 12

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2024 © Cambridge University Press & Assessment 2024 Page 12 of 12 Question Answer Marks 8(b) Example: FUNCTION Stage_1(StudentName : STRING) RETURNS INTEGER DECLARE OldFile, NewFile, Line : STRING DECLARE Count : INTEGER OldFile  StudentName & "_src.txt" NewFile  StudentName & "_S1.txt" OPENFILE OldFile FOR READ OPENFILE NewFile FOR WRITE Count  0 WHILE NOT EOF(OldFile) READFILE OldFile, Line Line  DeleteComment(Line) IF LENGTH(Line) <> 0 THEN WRITEFILE NewFile, Line Count  Count + 1 ENDIF ENDWHILE CLOSEFILE OldFile CLOSEFILE NewFile RETURN Count ENDFUNCTION Mark as follows: 1 Generate filenames condone missing “_” 2 Open both files in correct modes and subsequently close 3 Loop to EOF(OldFile) 4 Read a line from OldFile and execute DeleteComment()in a loop 5 Skip blank lines after DeleteComment()in a loop 6 Write Line to stage 1 file and increment Count 7 Return the number of lines after a reasonable attempt at counting 7

What you needed in this session

Cambridge’s own grade thresholds for 2024 May/June, Paper 2 · Variant 1. A higher threshold means an easier paper — the bar moves with how the cohort did.

A47/75
B40/75
C33/75
D27/75
E21/75