9618/21/O/N/22 question 1: worked solution (October/November 2022, paper 21)
Show as plain textHide plain text
Cambridge AS Level Computer Science 9618 · 10.2 Arrays Worked solution from the Data Types and Structures Paper 2 Problem-solving and Programming booklet, Part 2 of 4. Q19 9618/21/O/N/22 original Q1 Structured · 12 marks Worked solution (a) Write any three benefits: Library routines are tried and tested , so they are free from errors [1] They do a job you may not be able to program yourself, for example encryption [1] They are readily available and so speed up development time [1] (b)(i) Write three points: With arrays the data can be processed, searched or sorted easily, using a loop and an index [1] The program is easier to design, write, test and understand [1] Many values are held under one identifier , so far fewer variables are needed, and it is easier to change when the number of students grows [1] (b)(ii) Purpose: it holds the index that points to one element of the arrays [1] Data type: INTEGER [1] (c) State one error for each statement: Statement Error IF EMPTY ← "" THEN Should be = (comparison), not ← (assignment) Status ← IS_NUM(-23.4) The parameter must be a string (or char), not a real number X ← STR_TO_NUM("37") + 5 NO ERROR Y ← STR_TO_NUM("37" + "5") Wrong operator: strings are joined with &, not + First row correct [1] Second row correct [1] Third row correct [1] Fourth row correct [1] KEY IDEA Arrays give one name and an index for many values, and pseudocode functions need the right operator and the right data type. TOTAL 12 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by Pseudocode Pro. Tap the picture to open it on YouTube.