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

9618/21/M/J/25 · 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 paper20 pages

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

Mark scheme14 pages

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

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

Paper as text

Question paper, page 1

[Turn over Cambridge International AS & A Level This document has 20 pages. Any blank pages are indicated. DC (WW/CT) 342882/4 © UCLES 2025 COMPUTER SCIENCE 9618/21 Paper 2 Fundamental Problem-solving and Programming Skills May/June 2025 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. * 9 6 5 9 0 6 4 2 2 3 * , , * 0000800000001 * ¬WŠ. 4mHuOªEŠ_|6€W ¬C|qW©§“UƒyVCL«¡œ‚ ¥ U•55eu eU u •¥U

Question paper, page 2

2 9618/21/M/J/25 © UCLES 2025 Refer to the insert for the list of pseudocode functions and operators. 1 A program is being developed to help the manager of a shop control the stock. (a) An identifier table has been used during the design stage. Complete the identifier table: Example value Explanation Variable name Data type "Fruit" a category of stock that is sold in the shop 20/02/2025 when an item was sold 12.67 the cost of an item TRUE to indicate if an item is in stock [4] (b) A module Sales() is part of the stock control program. The table contains pseudocode extracts from the module Sales() Each extract may include all or part of: • assignment • selection • iteration (repetition). Complete the table by placing one or more ticks (✓) in each row: Pseudocode extract Assignment Selection Iteration Result CalculateTotal() WHILE IsClosed REPEAT INPUT Value UNTIL Sales[4] > Value IF Sales[Current] <= 150 THEN Discount TRUE ENDIF CASE OF Option [5] * 0000800000002 * , , ĬÕĊ®Ġ´íÈõÏĪÅĊÞú¸þ× ĬÃúòÖĝģõÞîÿ¹û²ÛÙĔĂ ĥÕÅĕõÕĥĕµĥąÅąµĥÕÅÕ DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN

Question paper, page 3

3 9618/21/M/J/25 © UCLES 2025 [Turn over (c) Decomposition has been used to design the program to help the shop manager control the stock. Describe decomposition. … … … … … … [3] * 0000800000003 * , , Ĭ×Ċ®Ġ´íÈõÏĪÅĊÞü¸þ× ĬÃùñÎīğąÛČòðßÊÿÙĤĂ ĥÕµÕµµąõåĕÕÅąÕąĕÕÕ DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN

Question paper, page 4

4 9618/21/M/J/25 © UCLES 2025 2 A program is being developed to calculate the pay of employees working for a company. A function CalculateBonus() calculates bonus pay based on the value of sales. Bonus pay is calculated as shown in the table. Value of sales (in dollars) Bonus pay (in dollars) below 2000 0 between 2000 and 4000 inclusive 10 above 4000 100 A flowchart for the function CalculateBonus() has been designed. START END INPUT ValueOfSales Is ValueOfSales 4000 ? Set BonusPay to 0 Set BonusPay to 10 Set BonusPay RETURN BonusPay 100 to > Is ValueOfSales = 2000 ? > NO NO YES YES * 0000800000004 * , , ĬÕĊ®Ġ´íÈõÏĪÅĊàú¸Ā× ĬÃùôÎġčĄàĆù÷ýĦÝÉĜĂ ĥĥĥÕõµąÕŵåÅÅÕåĕÅÕ DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN

Question paper, page 5

5 9618/21/M/J/25 © UCLES 2025 [Turn over (a) The flowchart contains logic errors. One logic error is that BonusPay will not be set to 10 although the ValueOfSales input is between 2000 and 4000 inclusive. (i) Explain why this error occurs. … … [1] (ii) Explain how this error could be corrected. … … [1] (b) There are different ways to reduce the risk of errors when developing the new program, such as the use of constants. (i) State a value that could be replaced by a constant in the function CalculateBonus() … [1] (ii) Explain how the use of constants helps to reduce the risk of programming errors. … … … … [2] (iii) One other way that can reduce the risk of errors when writing the program is the use of library routines. Explain how library routines can reduce the risk of programming errors. … … [1] * 0000800000005 * , , Ĭ×Ċ®Ġ´íÈõÏĪÅĊàü¸Ā× ĬÃúóÖħđôÙôĈ²ÙĎùÉĬĂ ĥĥĕĕµÕĥµÕÅõÅŵÅÕÕÕ DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN

Question paper, page 6

6 9618/21/M/J/25 © UCLES 2025 (c) All the logic errors have been corrected, and the program has been coded. Identify and describe two other types of error that the program could contain. Type of error … Description … … … Type of error … Description … … … [4] * 0000800000006 * , , ĬÙĊ®Ġ´íÈõÏĪÅĊÝüµþ× ĬÃùóÙĝùúÑ÷õ˹ĦĜġĜĂ ĥµµĕµõĥĕĕåÕÅąµĥĕąÕ DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN

Question paper, page 7

7 9618/21/M/J/25 © UCLES 2025 [Turn over 3 A student has been asked to create a simple guessing game program. This program will generate a random integer value between 1 and 100. It will then repeatedly prompt the user to input an integer value until they input the randomly generated value. The student has written a structured English description: step 1 – randomly generate an integer value between 1 and 100 inclusive step 2 – prompt the user to input an integer value step 3 – output an appropriate message if the value input was too high; then repeat from step 2 step 4 – output an appropriate message if the value input was too low; then repeat from step 2 step 5 – output an appropriate message if the value input was the same value that was randomly generated; then end the program. Write a pseudocode algorithm from this structured English description. Assume no input validation is needed. … … … … … … … … … … … … … … … … … … [8] * 0000800000007 * , , ĬÛĊ®Ġ´íÈõÏĪÅĊÝúµþ× ĬÃúôÑīõĊèāČþĝĎÀġĬĂ ĥµÅÕõĕąõąÕąÅąÕąÕĕÕ DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN

Question paper, page 8

8 9618/21/M/J/25 © UCLES 2025 4 Study the algorithm: DECLARE Chars : ARRAY[1:4] OF CHAR DECLARE I, J : INTEGER DECLARE Key : CHAR I 2 Chars[1] 'D' Chars[2] 'T' Chars[3] 'H' Chars[4] 'R' WHILE I <= 4 //Outer loop Key Chars[I] J I – 1 WHILE J >= 0 AND Chars[J] > Key //Inner loop Chars[J + 1] Chars[J] J J – 1 ENDWHILE Chars[J + 1] Key I I + 1 ENDWHILE (a) The outer loop structure used in the algorithm is not the most appropriate one to use. State the type of loop structure that would be the most appropriate to use and justify why it is the most appropriate. Loop structure … Justification … … [2] * 0000800000008 * ,  , ĬÙĊ®Ġ´íÈõÏĪÅĊßüµĀ× ĬÃúñÑġćÿÓÿăą¿²ĞñĔĂ ĥąĕÕµĕąÕĥõõÅÅÕåÕąÕ DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN

Question paper, page 9

9 9618/21/M/J/25 © UCLES 2025 [Turn over (b) Complete the trace table by dry running the algorithm. The first row has been completed. I Key J Chars[J] Chars [1] [2] [3] [4] 2 'D' 'T' 'H' 'R' [6] * 0000800000009 * ,  , ĬÛĊ®Ġ´íÈõÏĪÅĊßúµĀ× ĬÃùòÙħċïæùîÄěʺñĤĂ ĥąĥĕõõĥµõąåÅŵÅĕĕÕ DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN

Question paper, page 10

10 9618/21/M/J/25 © UCLES 2025 5 Stacks and queues are both abstract data types. A stack uses a top-of-stack pointer to indicate the location of the last item added to the stack. A queue uses two pointers: • a front pointer to indicate the location of the next item to be removed from the queue • a rear pointer to indicate the location of the next item to be added to the queue. A queue can be used to reverse the items stored on a stack. For example, if a stack contains six items: Initial state of the stack: top-of-stack pointer Final state of the stack when the items have been reversed: top-of-stack pointer Describe how the queue could be used to reverse the items that are currently stored on the stack. Your description must include how the pointers are used in both the stack and queue. Assume: • The stack initially contains an unknown number of items. • The queue can store all the items currently stored on the stack. • The queue is initially empty. item 6 item 5 item 4 item 3 item 2 item 1 item 1 item 2 item 3 item 4 item 5 item 6 * 0000800000010 * , , ĬÙĊ®Ġ´íÈõÏĪÅĊÞü·þ× ĬÃûñÜģÿęÍĈČßã´ĊÉĬĂ ĥÕõĕµĕåÕÅÅõąÅõåÕµÕ DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN

Question paper, page 11

11 9618/21/M/J/25 © UCLES 2025 [Turn over … … … … … … … … … … … … … … … … … … … … [7] * 0000800000011 * , , ĬÛĊ®Ġ´íÈõÏĪÅĊÞú·þ× ĬÃüòÔĥăĩìòõĪ÷ÌÎÉĜĂ ĥÕąÕõõŵյåąÅĕÅĕåÕ DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN

Question paper, page 12

12 9618/21/M/J/25 © UCLES 2025 6 A program monitors the speed of vehicles as they move around a large building site. Each vehicle contains a sensor which reads an integer value that represents the speed of the vehicle. The value is expected to be in the range 0 to 60 inclusive. The sensors cannot read values less than 0. A program module has been written to validate the values read by the sensors. (a) A test plan is needed to fully test the module. Complete the table. The first line has been completed for you. Assume the sensors generate only integer values. Type of test data Test data value Expected outcome normal 36 data item is accepted [4] (b) Each sensor used in the system has a unique sensor ID number in the range 1 to 50. The program that is used to monitor the speed of each vehicle reads each sensor value every second and stores this value along with the sensor’s unique ID into a global 2D array Reading The global array Reading has been declared as follows: DECLARE Reading : ARRAY[1:2000, 1:2] OF INTEGER The array contains 4000 elements organised as 2000 rows and 2 columns. Column 1 contains the sensor value, and column 2 contains the sensor ID. When 2000 sensor readings have been taken, the array is full and the system stops taking any more sensor readings until the array has been processed. A procedure Sort() is needed to sort the array into ascending order of sensor value using an efficient bubble sort algorithm. * 0000800000012 * , , ĬÙĊ®Ġ´íÈõÏĪÅĊàü·Ā× ĬÃüóÔğñĠÏðîġÕĨðÙĤĂ ĥĥÕÕµõÅĕµĕÕąąĕĥĕµÕ DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN

Question paper, page 13

13 9618/21/M/J/25 © UCLES 2025 [Turn over Write efficient pseudocode for the procedure Sort() … … … … … … … … … … … … … … … … … … … … … … … … … … [8] * 0000800000013 * , , ĬÛĊ®Ġ´íÈõÏĪÅĊàú·Ā× ĬÃûôÜĩíĐêĊăèāĐìÙĔĂ ĥĥåĕõĕåõåĥąąąõąÕåÕ DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN

Question paper, page 14

14 9618/21/M/J/25 © UCLES 2025 7 A program is being developed to implement a customer loyalty scheme for a coffee shop. The programmer has decided that the following data items need to be stored for each customer: Data item Description customer ID a unique six-digit string points an integer value that is increased by one for every cup of coffee the customer orders When a customer visits the shop and orders coffee, the scheme operates as follows: • The total number of points is increased by the number of coffees ordered. • If just one cup of coffee is ordered and the number of points goes above 10, then: ◦ the cup of coffee they have just ordered is given to them free of charge ◦ the number of points is reduced by 11. • If the order is for multiple coffees and the number of points goes above 10, then: ◦ they get one coffee free of charge for every 11 points ◦ the number of points is reduced by 11 for each free coffee. For example, the: • customer currently has 9 points • customer orders 16 cups of coffee • total number of points now becomes 25 • customer gets 2 free coffees and now has 3 points left. The programmer has defined a program module that is called every time a customer places an order: Module Description CustomerOrder() • called with two integer parameters: ◦ the number of coffees ordered ◦ the current number of points • output a suitable message giving the number of free coffees • return a value for the new points total. * 0000800000014 * , , ĬÕĊ®Ġ´íÈõÏĪÅĊßù¶Ă× ĬÃüòÙħĂĨÜĀĈċÝÅàĩĜĂ ĥÅåÕµõĥÕÅõąÅŵåĕõÕ DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN

Question paper, page 15

15 9618/21/M/J/25 © UCLES 2025 [Turn over (a) Write pseudocode for module CustomerOrder() … … … … … … … … … … … … … … … … … … … … [6] * 0000800000015 * , , Ĭ×Ċ®Ġ´íÈõÏĪÅĊßû¶Ă× ĬÃûñÑġþĘÝúù¾ù­üĩĬĂ ĥÅÕĕõĕąµÕąÕÅÅÕÅÕĥÕ DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN

Question paper, page 16

16 9618/21/M/J/25 © UCLES 2025 (b) A text file Loyalty.txt will be used to store the data items for the loyalty scheme. The data items for each customer will be stored on a separate line of the text file where each data item is separated by a comma: <CustomerID>,<Points> The contents of the text file Loyalty.txt will always be stored in ascending order by customer ID. When the data items are read from or written to the text file Loyalty.txt, they may need to be converted to the appropriate data type. Each customer has a unique customer ID starting at "100001" with this value increasing by one each time a new customer joins the loyalty scheme. When a customer joins the loyalty scheme, they are assigned the next customer ID and value of points is set to 0. For example, if the loyalty scheme has 204 customers and a new customer joins the loyalty scheme, the following line is added to the text file Loyalty.txt: "100205,0" You can assume that the number of customers in the loyalty scheme will never be more than 9000. The programmer has defined a program module as follows: Module Description AddNewCustomers() • called with an integer parameter representing the number of new customers to be added to the loyalty scheme • adds a new line, containing the required information, to the text file Loyalty.txt for each customer added to the loyalty scheme • outputs each new customer ID added to the loyalty scheme (i) Write pseudocode for module AddNewCustomers() Assume that there is at least one customer already in the loyalty scheme. … … … … … … … … * 0000800000016 * , , ĬÕĊ®Ġ´íÈõÏĪÅĊÝù¶Ą× ĬÃûôÑīðđÚøòÅÛđÚùĔĂ ĥõąĕµĕąĕµååÅąÕĥÕõÕ DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN

Question paper, page 17

17 9618/21/M/J/25 © UCLES 2025 [Turn over … … … … … … … … … … … … … … … … … … … … … … [8] * 0000800000017 * , , Ĭ×Ċ®Ġ´íÈõÏĪÅĊÝû¶Ą× ĬÃüóÙĝôġßĂÿĄÿĩþùĤĂ ĥõõÕõõĥõåÕõÅąµąĕĥÕ DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN

Question paper, page 18

18 9618/21/M/J/25 © UCLES 2025 (ii) The requirements for AddNewCustomers() are changed. There may be no existing customers in the loyalty scheme. Explain the changes that will need to be made to the module AddNewCustomers() … … … … … … … … … … … … [4] * 0000800000018 * ,  , ĬÕĊ®Ġ´íÈõÏĪÅĊàù¸Ă× ĬÃúôÜĩøćØïùğ·ē®ÁĬĂ ĥåĥÕµĕåĕĕĕåąąõĥÕÅÕ DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN

Question paper, page 19

19 9618/21/M/J/25 © UCLES 2025 BLANK PAGE * 0000800000019 * ,  , Ĭ×Ċ®Ġ´íÈõÏĪÅĊàû¸Ă× ĬÃùóÔğü÷áĉĈêģīĪÁĜĂ ĥåĕĕõõÅõąĥõąąĕąĕÕÕ DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN

Question paper, page 20

20 9618/21/M/J/25 © UCLES 2025 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 * 0000800000020 * , , ĬÕĊ®Ġ´íÈõÏĪÅĊÞù¸Ą× ĬÃùòÔĥĊòÖćÿáÁÇÌÑĤĂ ĥĕÅĕµõÅÕĥÅąąÅĕåĕÅÕ DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN DO NOT WRITE IN THIS MARGIN

Mark scheme, page 1

This document consists of 14 printed pages. © Cambridge University Press & Assessment 2025 [Turn over Cambridge International AS & A Level COMPUTER SCIENCE 9618/21 Paper 2 Fundamental Problem-solving and Programming Skills May/June 2025 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 2025 series for most Cambridge IGCSE, Cambridge International A and AS Level components, and some Cambridge O Level components.

Mark scheme, page 2

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2025 © Cambridge University Press & Assessment 2025 Page 2 of 14 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 2025 © Cambridge University Press & Assessment 2025 Page 3 of 14 Annotations guidance for centres Examiners use a system of annotations as a shorthand for communicating their marking decisions to one another. Examiners are trained during the standardisation process on how and when to use annotations. The purpose of annotations is to inform the standardisation and monitoring processes and guide the supervising examiners when they are checking the work of examiners within their team. The meaning of annotations and how they are used is specific to each component and is understood by all examiners who mark the component. We publish annotations in our mark schemes to help centres understand the annotations they may see on copies of scripts. Note that there may not be a direct correlation between the number of annotations on a script and the mark awarded. Similarly, the use of an annotation may not be an indication of the quality of the response. The annotations listed below were available to examiners marking this component in this series. Annotations Annotation Meaning Benefit of the doubt To indicate where a key word/phrase/code is missing Incorrect Follow through Indicate a point in an answer Highlighted text To draw attention to a particular aspect or to indicate where parts of an answer have been combined Ignore Not answered question No examples or not enough Not relevant or used to separate parts of an answer Off-page comment Allows comments to be entered at the bottom of the RM marking window and then displayed when the associated question item is navigated to. Repetition Indicates that work or a page has been seen including blank answer spaces and blank pages. Correct

Mark scheme, page 4

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2025 © Cambridge University Press & Assessment 2025 Page 4 of 14 Annotation Meaning Too vague

Mark scheme, page 5

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2025 © Cambridge University Press & Assessment 2025 Page 5 of 14 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 bold word/phrase in bold indicates this is a key word/phrase in the candidates answer and this word/phrase or a word/phrase with a similar meaning must be present

Mark scheme, page 6

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2025 © Cambridge University Press & Assessment 2025 Page 6 of 14 Question Answer Marks 1(a) Example value Explanation Variable name Data type "Fruit" a category of stock that is sold in the shop Category STRING 20/02/2025 when an item was sold DateSold DATE 12.67 the cost of an item (Item)Cost/Price REAL TRUE to indicate if an item is in stock (Item)InStock BOOLEAN Mark as follows: 1 mark per row for each variable name and data type 4 1(b) Pseudocode extract Assignment Selection Iteration Result  CalculateTotal() ✓ WHILE IsClosed ✓ REPEAT INPUT Value UNTIL Sales[4] > Value ✓ ✓ IF Sales[Current] <= 150 THEN Discount  TRUE ENDIF ✓ ✓ CASE OF Option ✓ Mark as follows: One mark for each correct row 5 1(c) Decomposition involves: MP1 Breaking down a problem into sub problems MP2 In order to explain / understand the process/task of how a (stock control) can be managed in more detail MP3 Leading to the concept of the program designed as a series of modules / procedures / functions // or by example of different stock control modules MP4 Makes the program easier to test / debug Max 3 Max 2 if no mention of stock control 3

Mark scheme, page 7

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2025 © Cambridge University Press & Assessment 2025 Page 7 of 14 Question Answer Marks 2(a)(i) MP1 The two decision boxes are in the wrong order // The first decision symbol is wrong MP2 The first decision should check for values greater than or equal to 2000 Max 1 1 2(a)(ii) Explaining how to correct the flowchart. MP1 Swap around the two decision boxes MP2 The first decision box should check for values greater than or equal to 2000 and the second decision box should check for values above 4000 Max 1 1 2(b)(i) 2000 / 4000 / 10 / 100 1 2(b)(ii) MP1 The value cannot be changed // avoids being different in two places MP2 Makes the program easier to understand MP3 Avoids repeatedly writing the same value throughout the program MP4 A change to the value requires a change in only one statement Max 2 2 2(b)(iii) MP1 (The code is) tried and tested so error free MP2 Provides functionality / code that the programmer may find difficult to code themselves Max 1 1 2(c) MP1 Syntax (error) MP2 Rules of programming language // the language grammar was not followed MP3 Run-time (error) MP4 The program performs an illegal operation Mark as follows: One mark for naming each type of error and one mark for the description 4

Mark scheme, page 8

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2025 © Cambridge University Press & Assessment 2025 Page 8 of 14 Question Answer Marks 3 Example solution: DECLARE GeneratedValue : INTEGER DECLARE Guess : INTEGER GeneratedValue  INT(RAND(100)) + 1 REPEAT OUTPUT "Enter a guess between 1 and 100: " INPUT Guess IF Guess > GeneratedValue THEN OUTPUT "Guess was too high" ENDIF IF Guess < GeneratedValue THEN OUTPUT "Guess was too low" ENDIF UNTIL Guess = GeneratedValue OUTPUT "Number guessed correctly" MP1 Declare all variables used MP2 Uses RAND() function MP3 Uses INT() function MP4 Correct syntax for random number between 1 and 100 MP5 Conditional loop until correct number guessed MP6 Prompt and input a guess in a loop MP7 Check if guess is too high in a loop MP8 Check if guess is too low in a loop MP9 Output appropriate message (x2) when the number is not guessed correctly (in the loop) and output correct guess message Max 8 8

Mark scheme, page 9

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2025 © Cambridge University Press & Assessment 2025 Page 9 of 14 Question Answer Marks 4(a) MP1 Count-controlled MP2 The number of iterations required is known 2 4(b) I Key J Chars[J] Chars [1] [2] [3] [4] 2 'D' 'T' 'H' 'R' 'T' 1 'D' 3 'H' 2 'T' 'T' 1 'D' 'H' 4 'R' 3 'T' 'T' 2 'H' (‘R’) 'R' 5 Chars array final values 'D' 'H' 'R' 'T' Mark as follows: MP1, MP2, MP3, MP4, MP5 1 mark per enclosure 6 MP1 MP2 MP3 MP4 MP6 MP5

Mark scheme, page 10

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2025 © Cambridge University Press & Assessment 2025 Page 10 of 14 Question Answer Marks 5 MP1 Pop an item off the stack MP2 Update Stack pointer MP3 Add it to the queue MP4 Update Rear pointer MP5 Repeat until the stack is empty MP6 Remove an item from the queue MP7 Update Front pointer MP8 Push it onto the stack MP9 Update the Stack pointer MP10 Repeat until the queue is empty Max 7 7 Question Answer Marks 6(a) Type of test data Test data value Expected outcome normal 36 data item is accepted boundary/ extreme/ normal 0 / 1 data item is accepted boundary/ extreme/ normal 59 / 60 data item is accepted abnormal >= 61 data item is rejected normal 15 data item is accepted Mark as follows: 1 mark for each row with (Type and Value and Outcome) 4

Mark scheme, page 11

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2025 © Cambridge University Press & Assessment 2025 Page 11 of 14 Question Answer Marks 6(b) Example solution: PROCEDURE Sort() DECLARE Temp, J, Boundary : INTEGER DECLARE NoSwaps : BOOLEAN Boundary  1999 REPEAT NoSwaps  TRUE FOR J  1 TO Boundary IF Reading[J, 1] > Reading[J+1, 1] THEN //first swap sensor value Temp  Reading[J, 1] Reading[J, 1]  Reading[J+1, 1] Reading[J+1, 1]  Temp //now swap corresponding ID Temp  Reading[J, 2] Reading[J, 2]  Reading[J+1, 2] Reading[J+1, 2]  Temp NoSwaps  FALSE ENDIF NEXT J Boundary  Boundary - 1 UNTIL NoSwaps = TRUE ENDPROCEDURE MP1 Procedure heading and ending MP2 Conditional loop correctly formed including Boolean flag declared and initialised MP3 An inner loop MP4 Correct range 1 to 1999 for inner loop MP5 Comparison of element J with J+1 in a loop MP6 Declare Temp variable and swap elements in a loop MP7 Both SensorID and Speed values were swapped in a loop MP8 'No-Swap' mechanism: • Conditional outer loop including flag reset • Flag set in inner loop to indicate swap MP9 Reducing Boundary in the outer loop 8

Mark scheme, page 12

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2025 © Cambridge University Press & Assessment 2025 Page 12 of 14 Question Answer Marks 7(a) Example solution: FUNCTION CustomerOrder(Number, Points : INTEGER) RETURNS INTEGER DECLARE NewPoints, NumberFree: INTEGER NewPoints  Points + Number NumberFree  0 WHILE NewPoints >= 11 AND Number > 0 NumberFree  NumberFree + 1 NewPoints  NewPoints -11 Number  Number - 1 END WHILE OUTPUT "Number of free coffees is: ", NumberFree RETURN NewPoints ENDFUNCTION MP1 Function header and ending and parameters and return type MP2 Number of coffees ordered added to points MP3 Correct calculation of one free coffee MP4 Attempted calculation of multiple free coffees and reduced NewPoints MP5 Output number of free drinks with suitable message MP6 Return of NewPoints 6

Mark scheme, page 13

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2025 © Cambridge University Press & Assessment 2025 Page 13 of 14 Question Answer Marks 7(b)(i) Example solution: PROCEDURE AddNewCustomers(NumToAdd : INTEGER) DECLARE CustomerID : INTEGER DECLARE Count : INTEGER DECLARE Line : STRING DECLARE NewLine : STRING OPENFILE "Loyalty.txt" FOR READ WHILE NOT EOF("Loyalty.txt") READFILE "Loyalty.txt", Line ENDWHILE CLOSEFILE "Loyalty.txt" OPENFILE "Loyalty.txt" FOR APPEND CustomerID  STR_TO_NUM((LEFT(Line, 6)) FOR Count  1 TO NumToAdd CustomerID  CustomerID + 1 OUTPUT CustomerID NewLine  NUM_TO_STR(CustomerID) & ",0" WRITEFILE "Loyalty.txt", NewLine NEXT Count CLOSEFILE "Loyalty.txt" ENDPROCEDURE Mark as follows: MP1 All variables used are declared using the correct type including a string and an integer MP2 Open file in read mode and close (before opening in append mode) MP3 Conditional loop with EOF("Loyalty.txt") MP4 Read Line from file // Count number of records in the file MP5 Open the file in append mode and subsequently close MP6 Extract CustomerID from Line and convert to integer // use count from MP4 to generate last CustomerID stored MP7 A (count controlled) loop for the number of customers to add MP8 Increment CustomerID and output the new CustomerID in loop MP9 Create string for new CustomerID and write to file in loop Max 8 8

Mark scheme, page 14

9618/21 Cambridge International AS & A Level – Mark Scheme PUBLISHED May/June 2025 © Cambridge University Press & Assessment 2025 Page 14 of 14 Question Answer Marks 7(b)(ii) MP1 Check if the text file loyalty.txt exists / is empty MP2 If file does not exist it must be created (using write mode) MP3 If the file has to be created / is empty then set the first CustomerID to 100001 MP4 Write "100001,0" to loyalty.txt (using write mode) MP5 For all but the first customer (to be added to the empty file) use the existing code / module Max 4 4

What you needed in this session

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

A49/75
B42/75
C34/75
D26/75
E19/75