Cambridge IGCSE Computer Science (9-1) 0984 — 2021 May/June Paper 2 · Variant 2
0984/22/M/J/21
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.
Question paper16 pages
















Mark scheme13 pages
Answers below. Sit the paper first if you are practising.













Paper as text
Question paper, page 1
This document has 16 pages. Any blank pages are indicated. Cambridge IGCSE™(9–1) COMPUTER SCIENCE 0984/22 Paper 2 Problem-solving and Programming May/June 2021 1 hour 45 minutes You must answer on the question paper. No additional materials are needed. INSTRUCTIONS ● Answer all questions. ● Do not attempt Tasks 1, 2 and 3 in the copy of the pre-release material on page 2; these are for information only. ● Use a black or dark blue pen. You may use an HB pencil for any diagrams or graphs. ● 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. ● Calculators must not be used in this paper. INFORMATION ● The total mark for this paper is 50. ● 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. * 5 6 9 6 4 5 1 8 6 0 * DC (LO) 214516 © UCLES 2021 [Turn over
Question paper, page 2
2 0984/22/M/J/21 © UCLES 2021 Section A You are advised to spend no longer than 40 minutes answering this section. Here is a copy of the pre-release material. DO NOT attempt Tasks 1, 2 and 3 now. Use the pre-release material and your experience from attempting the tasks before the examination to answer Question 1. Pre-release material An electric mountain railway makes four return trips every day. In each trip the train goes up the mountain and back down. The train leaves from the foot of the mountain at 09:00, 11:00, 13:00 and 15:00. The train returns from the top of the mountain at 10:00, 12:00, 14:00 and 16:00. Each train has six coaches with eighty seats available in each coach. Passengers can only purchase a return ticket; all tickets must be purchased on the day of travel. The cost is $25 for the journey up and $25 for the journey down. Groups of between ten and eighty passengers inclusive get a free ticket for every tenth passenger, provided they all travel together (every tenth passenger travels free). Passengers must book their return train journey, as well as the departure train journey, when they purchase their ticket. Passengers can return on the next train down the mountain or a later train. The last train from the top of the mountain has two extra coaches on it. The train times are displayed on a large screen, together with the number of tickets still available for each train. Every time a ticket is booked the display is updated. When a train is full, the word ‘Closed’ is displayed instead of the number of tickets available. Write and test a program or programs for the electric mountain railway. • Your program or programs must include appropriate prompts for the entry of data; data must be validated on entry. • Error messages and other output need to be set out clearly and understandably. • All variables, constants and other identifiers must have meaningful names. You will need to complete these three tasks. Each task must be fully tested. Task 1 – Start of the day. Write a program to set up the screen display for the start of the day. Initialise suitable data structure(s) to total passengers for each train journey and total the money taken for each train journey. Each train journey must be totalled separately. There are four journeys up and four journeys down every day. Task 2 – Purchasing tickets. Tickets can be purchased for a single passenger or a group. When making a purchase, check that the number of tickets for the required train journeys up and down the mountain is available. If the tickets are available, calculate the total price including any group discount. Update the screen display and the data for the totals. Task 3 – End of the day. Display the number of passengers that travelled on each train journey and the total money taken for each train journey. Calculate and display the total number of passengers and the total amount of money taken for the day. Find and display the train journey with the most passengers that day.
Question paper, page 3
3 0984/22/M/J/21 © UCLES 2021 [Turn over 1 All variables, constants and other identifiers must have meaningful names. (a) Identify and give the data type and use of one array that you could have used for Task 1. Array … Data type … Use … [3] (b) Describe two validation checks that could be used when inputting the number of tickets to buy for Task 2. For each validation check give one example of normal data and one example of erroneous data. Validation check 1 … … … Normal data … Erroneous data … Validation check 2 … … … Normal data … Erroneous data … [6]
Question paper, page 4
4 0984/22/M/J/21 © UCLES 2021 (c) Write an algorithm for the part of Task 2 that inputs the tickets required, calculates the total price for the ticket(s) purchased by a passenger including a group discount (if applicable) and updates the data structures used for the totals. Use either pseudocode, programming statements or a flowchart. … … … … … … … … … … … … … … … … … … … … … … … … … …
Question paper, page 5
5 0984/22/M/J/21 © UCLES 2021 [Turn over … … … … … … … … … … … … … … … … … … … … … … … … … … [6]
Question paper, page 6
6 0984/22/M/J/21 © UCLES 2021 (d) Explain how your program completed Task 3. Include any programming statements that you have used and fully explain the purpose of each statement. … … … … … … … … … … … … … … … … … … … … … … … [5]
Question paper, page 7
7 0984/22/M/J/21 © UCLES 2021 [Turn over Section B starts on page 8
Question paper, page 8
8 0984/22/M/J/21 © UCLES 2021 Section B 2 (a) Write an algorithm in pseudocode to input 500 positive whole numbers. Each number input must be less than 1000. Find and output the largest number input, the smallest number input and the range (difference between the largest number and smallest number). … … … … … … … … … … … … … … … … … … … … … … … … … [6]
Question paper, page 9
9 0984/22/M/J/21 © UCLES 2021 [Turn over (b) Describe how the algorithm could be changed to make testing less time-consuming. … … … … [2] 3 (a) Draw the most appropriate flowchart symbol for each pseudocode statement. Pseudocode statement Flowchart symbol IF Number = 20 PRINT Number Number ← Number + 1 [3] (b) State the type of each pseudocode statement. For example, X ← X + Y is totalling. IF Number = 20 … PRINT Number … Number ← Number + 1 … [3]
Question paper, page 10
10 0984/22/M/J/21 © UCLES 2021 4 This algorithm checks passwords. • Each password must be 8 or more characters in length; the predefined function Length returns the number of characters. • Each password is entered twice, and the two entries must match. • Either Accept or Reject is output. • An input of 999 stops the process. REPEAT OUTPUT "Please enter password" INPUT Password IF Length(Password) >= 8 THEN INPUT PasswordRepeat IF Password <> PasswordRepeat THEN OUTPUT "Reject" ELSE OUTPUT "Accept" ENDIF ELSE OUTPUT "Reject" ENDIF UNTIL Password = 999 (a) Complete the trace table for the algorithm using this input data: Secret, Secret, VerySecret, VerySecret, Pa55word, Pa55word, 999, 888 Password PasswordRepeat OUTPUT [3]
Question paper, page 11
11 0984/22/M/J/21 © UCLES 2021 [Turn over (b) Explain how the algorithm could be extended to allow three attempts at inputting the matching password. Any pseudocode statements used in your answer must be fully explained. … … … … … … … … [4] 5 A one-dimensional array dataArray[1:20] needs each element set to zero. (a) Write a pseudocode routine that sets each element to zero. Use the most suitable loop structure. … … … … … … … … [3] (b) Explain why you chose this loop structure. … … [1]
Question paper, page 12
12 0984/22/M/J/21 © UCLES 2021 6 A database table, PLANT, is used to keep a record of plants sold by a nursery. The table has these fields: • NAME – name of plant • FLOWER – whether the plant flowers (True) or not (False) • POSITION – shade, partial shade or sun • SIZE – small, medium or large • PRICE – price in $ • NUMBERSOLD – how many sold A query-by-example grid has been completed to display only the price, name and number sold of small plants that do not flower. Field: NAME PRICE NUMBERSOLD SIZE FLOWER POSITION Table: PLANT Sort: Show: 3 3 3 Criteria: = "shade" or: Identify the errors in the query-by-example grid. … … … … … … Rewrite the corrected query-by-example grid. Field: Table: Sort: Show: Criteria: or: [5]
Question paper, page 13
13 0984/22/M/J/21 © UCLES 2021 BLANK PAGE
Question paper, page 14
14 0984/22/M/J/21 © UCLES 2021 BLANK PAGE
Question paper, page 15
15 0984/22/M/J/21 © UCLES 2021 BLANK PAGE
Question paper, page 16
16 0984/22/M/J/21 © UCLES 2021 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 the Cambridge Assessment Group. Cambridge Assessment is the brand name of the University of Cambridge Local Examinations Syndicate (UCLES), which itself is a department of the University of Cambridge. BLANK PAGE
Mark scheme, page 1
This document consists of 13 printed pages. © UCLES 2021 [Turn over Cambridge IGCSE™ (9–1) COMPUTER SCIENCE 0984/22 Paper 2 May/June 2021 MARK SCHEME Maximum Mark: 50 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 2021 series for most Cambridge IGCSE™, Cambridge International A and AS Level components and some Cambridge O Level components.
Mark scheme, page 2
0984/22 Cambridge IGCSE (9–1) – Mark Scheme PUBLISHED May/June 2021 © UCLES 2021 Page 2 of 13 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 descriptors 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.
Mark scheme, page 3
0984/22 Cambridge IGCSE (9–1) – Mark Scheme PUBLISHED May/June 2021 © UCLES 2021 Page 3 of 13 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 4
0984/22 Cambridge IGCSE (9–1) – Mark Scheme PUBLISHED May/June 2021 © UCLES 2021 Page 4 of 13 Please note the following further points: The words in bold in the mark scheme are important text that needs to be present, or some notion of it needs to be present. It does not have to be the exact word, but something close to the meaning. If a word is underlined, this exact word must be present. A single forward slash means this is an alternative word. A double forward slash means that this is an alternative mark point. Ellipsis (…) on the end of one-mark point and the start of the next means that the candidate cannot get the second mark point without being awarded the first one. If a MP has ellipsis at the beginning, but there is no ellipsis on the MP before it, then this is just a follow-on sentence and can be awarded without the previous mark point.
Mark scheme, page 5
0984/22 Cambridge IGCSE (9–1) – Mark Scheme PUBLISHED May/June 2021 © UCLES 2021 Page 5 of 13 Question Answer Marks Section A 1(a) Array TrainUpPassengers // TrainUpPassengers[] Data type Integer/int Use storing the number of passengers on the train journeys up Many correct answers, this is an example. 3 1(b) One mark for description, one mark for normal data and one mark for erroneous data for two checks Validation check (type check) to check that the number entered is a whole number / integer Normal data 34 Erroneous data two // 1.5 Validation check (range check) to check that the value of the number entered is between 1 and 80 / 480 inclusive Normal data 34 Erroneous data 99 // 500 Validation check (presence check) to check that a value has been entered Normal data 34 // any data entered Erroneous data “” // blank // no data entered Validation check (length check) to check that a value has 3 digits or fewer // between 1 and 3 digits Normal data 345 Erroneous data 3456 Many correct answers, the data are examples only. 6
Mark scheme, page 6
0984/22 Cambridge IGCSE (9–1) – Mark Scheme PUBLISHED May/June 2021 © UCLES 2021 Page 6 of 13 Question Answer Marks 1(c) Any six from: MP1 Input number of tickets MP2 Input train up mountain and train down mountain MP3 Suitable prompts seen for inputs that are included MP4 Check that tickets are available on selected train(s) MP5 If available calculate price of tickets … MP6 … calculation includes discount if required MP7 Update total passengers / seats available for a train MP8 Update total passengers / seats available for up train and down train MP9 Update total cost for a train MP10 Update total cost for up train and down train Example answers OUTPUT "How many tickets" INPUT NoTickets OUTPUT "Which Train up the mountain? 1, 2, 3 or 4" INPUT UpNumber OUTPUT "Which Train down the mountain? 1, 2, 3 or 4" INPUT DownNumber IF (DownNumber = 4 AND TrainUp[UpNumber] + NoTickets <= 480 AND TrainDown[DownNumber] + NoTickets <= 640) OR (TrainUp[UpNumber] + NoTickets <= 480 AND TrainDown[DownNumber] + NoTickets <= 480) THEN Cost ← (NoTickets – NoTickets DIV 10) * 50 TrainUp[UpNumber] ← TrainUp[UpNumber] + NoTickets TrainDown[DownNumber] ← TrainUp[DownNumber] + NoTickets TrainUpTotal[UpNumber] ← TrainUpTotal[UpNumber] + Cost / 2 TrainDownTotal[DownNumber] ← TrainDownTotal[DownNumber] + Cost / 2 ENDIF 6
Mark scheme, page 7
0984/22 Cambridge IGCSE (9–1) – Mark Scheme PUBLISHED May/June 2021 © UCLES 2021 Page 7 of 13 Question Answer Marks 1(c) Yes Yes START OUTPUT "Tickets" INPUT Tickets Cost ← (NoTickets – NoTickets DIV 10) * 50 TrainUp[UpNo] ← TrainUp[UpNo] + NoTickets TrainDown[DownNo] ← TrainUp[DownNo] + NoTickets TrainUpTotal[UpNo] ← TrainUpTotal[UpNo] + Cost / 2 TrainDownTotal[DownNo] ← TrainDownTotal[DownNo] + Cost / 2 END Is Tickets <= UpTickets[UpNo] AND Tickets <= DownTickets[DownNo]? No OUTPUT "Up Train" INPUT UpNo OUTPUT "Down Train" INPUT DownNo
Mark scheme, page 8
0984/22 Cambridge IGCSE (9–1) – Mark Scheme PUBLISHED May/June 2021 © UCLES 2021 Page 8 of 13 Question Answer Marks 1(d) Explanation Any five from: MP1 How the program displayed the number of passengers for a journey ... MP2 … how completed for all trains MP3 How the program displayed the amount of money taken for a journey … MP4 … how completed for all trains MP5 How the program calculated the total number of passengers MP6 How the program calculated the total money taken MP7 How the program attempted to select the train journey with the most passengers MP8 How the program attempted to dealt with more than one train being the most popular MP9 How the program displayed the results with suitable messages Programming statements must be given with each explanation. 5
Mark scheme, page 9
0984/22 Cambridge IGCSE (9–1) – Mark Scheme PUBLISHED May/June 2021 © UCLES 2021 Page 9 of 13 Question Answer Marks Section B 2(a) Any six from: MP1 Initialisation of large and small variables e.g. Large ← 0 Small ← 1000 MP2 Use of a loop for 500 entries // or 499 if initialisation done on first correct entry MP3 Input with prompt MP4 Attempt at checking the range of 1 to 999 for input MP5 … working range check MP6 Checking for a whole number MP7 Selecting largest number MP8 Selecting smallest number MP9 Calculating the range MP10 Outputting the largest, smallest and range with message Large ← 0 Small ← 1000 FOR Count ← 1 TO 500 REPEAT OUTPUT "Enter a whole number between 1 and 999" INPUT Number UNTIL Number >= 1 AND Number < 1000 AND Number = Number DIV 1 IF Number < Small THEN Small ← Number ENDIF IF Number > Large THEN Large ← Number ENDIF NEXT Range ← Large – Small OUTPUT "Largest number is ", Large, " Smallest number is ", Small, " Range of numbers is ", Range 6
Mark scheme, page 10
0984/22 Cambridge IGCSE (9–1) – Mark Scheme PUBLISHED May/June 2021 © UCLES 2021 Page 10 of 13 Question Answer Marks 2(b) One mark for action required and one mark for method used Reduce the amount of numbers entered By decreasing the final value of the loop or Remove the need to input values By using random numbers / a previously populated array 2 3(a) Pseudocode statement Flowchart symbol IF Number = 20 PRINT Number Number ← Number + 1 3 3(b) IF Number = 20 selection PRINT Number output Number ← Number + 1 counting 3
Mark scheme, page 11
0984/22 Cambridge IGCSE (9–1) – Mark Scheme PUBLISHED May/June 2021 © UCLES 2021 Page 11 of 13 Question Answer Marks 4(a) One mark for each correct column Password PasswordRepeat OUTPUT (Please enter password) Secret Reject (Please enter password) Secret Reject (Please enter password) VerySecret VerySecret Accept (Please enter password) Pa55word Pa55word Accept (Please enter password) 999 Reject 3
Mark scheme, page 12
0984/22 Cambridge IGCSE (9–1) – Mark Scheme PUBLISHED May/June 2021 © UCLES 2021 Page 12 of 13 Question Answer Marks 4(b) Any four from: • Position: before INPUT PasswordRepeat // at start • …use a (variable) counter (for number of tries) or flag • … initialise variable counter or flag • Position after IF Length(Password) >= 8 THEN or after INPUT PasswordRepeat • … insert REPEAT/WHILE/(conditional) loop • Position after OUTPUT "Reject" • … add one to counter (for number of tries) • … output a message "Try again" • … add INPUT PasswordRepeat • Position after OUTPUT "Accept" • … reset flag to show password matched • Position after ENDIF • … (insert UNTIL/ENDWHILE)to exit the loop after three tries or if the repeated password matches the original 4 Question Answer Marks 5(a) One mark for: • Use of FOR loop • Working loop with correct number of Iterations • Correct assignment FOR Count ← 1 TO 20 dataArray[Count] ← 0 NEXT (Count) 3 5(b) (A FOR loop has) a fixed number of repetitions // No need to manage the loop counter // no need to use another variable for the array index 1
Mark scheme, page 13
0984/22 Cambridge IGCSE (9–1) – Mark Scheme PUBLISHED May/June 2021 © UCLES 2021 Page 13 of 13 Question Answer Marks 6 Any three from: • TABLE row not completed • POSITION column not required // POSITION criteria not required • No criteria set in the size column • No criteria set in the flower column Field: SIZE PRICE FLOWER NUMBERSOLD NAME Table: PLANT PLANT PLANT PLANT PLANT Sort: Show: Criteria: ="small" False or: OR Field: SIZE PRICE FLOWER NUMBERSOLD NAME POSITION Table: PLANT PLANT PLANT PLANT PLANT PLANT Sort: Show: Criteria: ="small" = False or: One mark for correct rows Field, Table and Show One mark for correct Criteria row 5