Cambridge A Level Computer Science 9618 — 2021 Oct/Nov Paper 2 · Variant 2

9618/22/O/N/21 · 6 questions · 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 2021 Oct/Nov Paper 2 · Variant 2 question paper, page 1 of 20
Page 1 of 20
Cambridge A Level Computer Science 9618 2021 Oct/Nov Paper 2 · Variant 2 question paper, page 2 of 20
Page 2 of 20
Cambridge A Level Computer Science 9618 2021 Oct/Nov Paper 2 · Variant 2 question paper, page 3 of 20
Page 3 of 20
Cambridge A Level Computer Science 9618 2021 Oct/Nov Paper 2 · Variant 2 question paper, page 4 of 20
Page 4 of 20
Cambridge A Level Computer Science 9618 2021 Oct/Nov Paper 2 · Variant 2 question paper, page 5 of 20
Page 5 of 20
Cambridge A Level Computer Science 9618 2021 Oct/Nov Paper 2 · Variant 2 question paper, page 6 of 20
Page 6 of 20
Cambridge A Level Computer Science 9618 2021 Oct/Nov Paper 2 · Variant 2 question paper, page 7 of 20
Page 7 of 20
Cambridge A Level Computer Science 9618 2021 Oct/Nov Paper 2 · Variant 2 question paper, page 8 of 20
Page 8 of 20
Cambridge A Level Computer Science 9618 2021 Oct/Nov Paper 2 · Variant 2 question paper, page 9 of 20
Page 9 of 20
Cambridge A Level Computer Science 9618 2021 Oct/Nov Paper 2 · Variant 2 question paper, page 10 of 20
Page 10 of 20
Cambridge A Level Computer Science 9618 2021 Oct/Nov Paper 2 · Variant 2 question paper, page 11 of 20
Page 11 of 20
Cambridge A Level Computer Science 9618 2021 Oct/Nov Paper 2 · Variant 2 question paper, page 12 of 20
Page 12 of 20
Cambridge A Level Computer Science 9618 2021 Oct/Nov Paper 2 · Variant 2 question paper, page 13 of 20
Page 13 of 20
Cambridge A Level Computer Science 9618 2021 Oct/Nov Paper 2 · Variant 2 question paper, page 14 of 20
Page 14 of 20
Cambridge A Level Computer Science 9618 2021 Oct/Nov Paper 2 · Variant 2 question paper, page 15 of 20
Page 15 of 20
Cambridge A Level Computer Science 9618 2021 Oct/Nov Paper 2 · Variant 2 question paper, page 16 of 20
Page 16 of 20
Cambridge A Level Computer Science 9618 2021 Oct/Nov Paper 2 · Variant 2 question paper, page 17 of 20
Page 17 of 20
Cambridge A Level Computer Science 9618 2021 Oct/Nov Paper 2 · Variant 2 question paper, page 18 of 20
Page 18 of 20
Cambridge A Level Computer Science 9618 2021 Oct/Nov Paper 2 · Variant 2 question paper, page 19 of 20
Page 19 of 20
Cambridge A Level Computer Science 9618 2021 Oct/Nov Paper 2 · Variant 2 question paper, page 20 of 20
Page 20 of 20

Mark scheme10 pages

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

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

Questions as text

Q1 · A programmer applies decomposition to a problem that she has been asked to solve

1 (a) A programmer applies decomposition to a problem that she has been asked to solve. Describe decomposition. ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ............................................................................................................................................. [2] (b) The following pseudocode assigns a value to an element of an array: ThisArray[n] 42 ← Complete the following table by writing the answer for each row. Answer The number of dimensions of ThisArray The technical terms for minimum and maximum values that the variable n may take The technical term for the variable n in the pseudocode statement [3] (c) Complete the pseudocode expressions so that they evaluate to the values shown. Any functions and operators used must be defined in the insert. Expression Evaluates to .......................................... 67 ('C') ......................................... 54 2 * ("27") ................................ 13 (27 / .................................) "Sub" & .................... ("Abstraction" , .................... , ....................) "Subtract" [4] (d) Evaluate the expressions given in the following table. The variables have been assigned values as follows: PumpOn TRUE ← PressureOK TRUE ← HiFlow FALSE ← Expression Evaluates to PressureOK AND HiFlow PumpOn OR PressureOK NOT PumpOn OR (PressureOK AND NOT HiFlow) NOT (PumpOn OR PressureOK) AND NOT HiFlow [2]

Mark scheme: Question Answer Marks 1(a) The process involves: 2 1 Breaking down a problem / task into sub problems / steps / smaller parts 2 In order to explain / understand // easier to solve the problem 3 Leading to the concept of program modules // assigning problem parts to teams Max 2 1(b) 3 Answer The number of dimensions of ThisArray 1 The technical terms for minimum and Lower bound, upper bound maximum values that variable n may take The technical term for the variable n in the Index / Subscript pseudocode expression. One mark per row 1(c) 4 Expression Evaluates to ASC('C') 67 2 * STR_TO_NUM ("27") 54 INT(27 / 2) 13 "Sub" & MID("Abstraction" , 4 , 5) "Subtract" One mark per row Function names must be exactly as shown 1(d) 2 Expression Evaluates to PressureOK AND HiFlow FALSE PumpOn OR PressureOK TRUE NOT PumpOn OR (PressureOK AND NOT HiFlow) TRUE NOT (PumpOn OR PressureOK) AND NOT HiFlow FALSE 1 mark for any two rows correct 2 marks for all rows correct.

More questions on Programming Basics

Q2 · An algorithm will: 1

2 (a) An algorithm will: 1. input an integer value 2. jump to step 6 if the value is zero 3. sum and count the positive values 4. sum and count the negative values 5. repeat from step 1 6. output the two sum values and the two count values. Draw a program flowchart on the following page to represent the algorithm. Note that variable declarations are not required in program flowcharts. [5] (b) A software company is working on a project to develop a website for a school. The school principal has some ideas about the appearance of the website but is unclear about all the details of the solution. The principal would like to see an initial version of the website. (i) Identify a life cycle method that would be appropriate in this case. Give a reason for your choice. Life cycle method .............................................................................................................. Reason .............................................................................................................................. ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... [2] (ii) The website project has progressed to the design stage. State three activities that will take place during the design stage of the program development life cycle. 1 ........................................................................................................................................ 2 ........................................................................................................................................ 3 ........................................................................................................................................ [3]

Mark scheme: 2(a) 5 One mark for each outlined group. Note: • Sum and increment steps (bottom-right rectangles) may be in reverse order in which case sum group will have two output lines • Max 4 for non-working solution 2(b)(i) One mark for each: 2 Life cycle method: Iterative // Rapid Application Development (RAD) Reason: Provides a working model / prototype at an early stage for the principal to approve / review 2(b)(ii) Decisions will be made regarding: 3 • Data structures • Algorithms / flowcharts / pseudocode • Program structure (modules) / use of library routines / module - team allocation • User interface // Web-page layout / content (for given scenario) • Testing method / plan • Choice of programming language / program environment Max 3

More questions on Program Design

Q3 · A programmer is writing a program to help manage clubs in a school

3 A programmer is writing a program to help manage clubs in a school. Data will be stored about each student in the school and each student may join up to three clubs. The data will be held in a record structure of type Student. The programmer has started to define the fields that will be needed as shown in the following table. Field Typical value Comment StudentID "CF1234" Unique to each student Email "Carmen47@xyzmail.com" Contains letters, numbers and certain symbols Club_1 1 Any value in the range 1 to 99 inclusive Club_2 14 Any value in the range 1 to 99 inclusive Club_3 27 Any value in the range 1 to 99 inclusive (a) (i) Write pseudocode to declare the record structure for type Student. ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ..................................................................................................................................... [3] (ii) A 1D array Membership containing 3000 elements will be used to store the student data. Write pseudocode to declare the Membership array. ........................................................................................................................................... ..................................................................................................................................... [2] (iii) Some of the elements of the array will be unused. Give an appropriate way of indicating an unused array element. ........................................................................................................................................... ..................................................................................................................................... [1] (iv) Some students are members of less than three clubs. State one way of indicating an unused club field. ........................................................................................................................................... ..................................................................................................................................... [1] (b) A procedure GetIDs() will: • prompt and input the number of a club • output the StudentID of all the students who are members of that club • output a count of all students in the given club. Write pseudocode for the procedure GetIDs(). ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ............................................................................................................................................. [7]

Mark scheme: 3(a)(i) Pseudocode: 3 TYPE Student DECLARE StudentID : STRING DECLARE Email : STRING DECLARE Club_1 : INTEGER DECLARE Club_2 : INTEGER DECLARE Club_3 : INTEGER ENDTYPE Mark as follows: • One mark for TYPE and ENDTYPE • One mark for StudentID and Email fields as STRING • One mark for all Club fields as INTEGER 3(a)(ii) DECLARE Membership : ARRAY [1:3000] OF Student 2 One mark per underlined phrase 3(a)(iii) One mark for any one of: 1 • Assign a value (of the corrrect data type) outside the normal range to one of the fields • Assign an empty string to the StudentID field / Email field • or value out of range to any club field 3(a)(iv) A number outside the range 1 to 99 1 3(b) PROCEDURE GetIDs() 7 DECLARE Index : INTEGER DECLARE ThisClub, Count : INTEGER OUTPUT "Please Input Club Number: " INPUT ThisClub Count ← 0 FOR Index ← 1 TO 3000 IF Membership[Index].Club_1 = ThisClub OR __ Membership[Index].Club_2 = ThisClub OR __ Membership[Index].Club_3 = ThisClub THEN Count ← Count + 1 OUTPUT Membership[Index].StudentID ENDIF NEXT Index OUTPUT "There are ", Count, " Students in the club" ENDPROCEDURE Mark as follows: 1 Declare and initialise Count 2 Prompt and Input club number before the loop 3 Loop through 3000 elements 4 Compare one club field with number input 5 Compare all Club fields with number input 6 If number found, OUTPUT of StudentID field and increment Count 7 Final OUTPUT of Count outside the loop Note: Max 6 if procedure heading and ending missing or incorrect (but allow array as parameter)

More questions on Data Types and Records

Q4 · The following is a procedure design in pseudocode

4 The following is a procedure design in pseudocode. Line numbers are given for reference only. 10 PROCEDURE Check(InString : STRING) 11 DECLARE Odds, Evens, Index : INTEGER 12 13 Odds 0 ← 14 Evens 0 ← 15 Index 1 ← 16 17 WHILE Index <= LENGTH(InString) 18 IF STR_TO_NUM(MID(InString, Index, 1)) MOD 2 <> 0 THEN 19 Odds Odds + 1 ← 20 ELSE 21 Evens Evens + 1 ← 22 ENDIF 23 Index Index + 1 ← 24 ENDWHILE 25 26 CALL Result(Odds, Evens) 27 ENDPROCEDURE (a) Complete the following table by giving the answers, using the given pseudocode. Answer A line number containing a variable being incremented The type of loop structure The number of functions used The number of parameters passed to STR_TO_NUM() The name of a procedure other than Check() [5] (b) The pseudocode includes several features that make it easier to read and understand. Identify three of these features. 1 ................................................................................................................................................ 2 ................................................................................................................................................ 3 ................................................................................................................................................ [3] (c) (i) The loop structure used in the pseudocode is not the most appropriate. State a more appropriate loop structure and justify your choice. Loop structure ................................................................................................................... Justification ....................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... [2] (ii) The appropriate loop structure is now used. Two lines of pseudocode are changed and two lines are removed. Write the line numbers of the two lines that are removed. ........................................................................................................................................... ..................................................................................................................................... [1]

Mark scheme: 4(a) 5 Answer A line number containing a variable being incremented 19 / 21 / 23 The type of loop structure pre-condition The number of functions used 3 The number of parameters passed to function 1 STR_TO_NUM() The name of a procedure other than Check() Result 4(b) One mark per point: 3 • Meaningful variable names • Indentation / white space / blank lines • Capitalisation of keywords 4(c)(i) One mark per point: 2 Structure: A count-controlled loop Justification: The number of iterations is known // repeats for the length of InString 4(c)(ii) 15, 23 1 One mark for both line numbers

More questions on Constructs

Q5 · A company has several departments

5 A company has several departments. Each department stores the name, email address and the status of each employee in that department in its own text file. All text files have the same format. Employee details are stored as three separate data strings on three consecutive lines of the file. An example of the first six lines of one of the files is as follows: File line Comment 1 First employee name 2 First email address 3 First employee status 4 Second employee name 5 Second email address 6 Second employee status A procedure MakeNewFile() will: • take three parameters as strings: ○ an existing file name ○ a new file name ○ a search status value • create a new text file using the new file name • write all employee details to the new file where the employee status is not equal to the search status value • count the number of sets of employee details that were in the original file • count the number of sets of employee details that were written to the new file • produce a summary output. An example summary output is as follows: File Marketing contained 54 employee details 52 employee sets of details were written to file NewMarketingList (a) Write pseudocode for the procedure MakeNewFile(). ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ............................................................................................................................................. [7] (b) An alternative format could be used for storing the data. A text file will still be used. (i) Describe the alternative format. ........................................................................................................................................... ..................................................................................................................................... [1] (ii) State one advantage and one disadvantage of the alternative format. Advantage ......................................................................................................................... ........................................................................................................................................... Disadvantage .................................................................................................................... ........................................................................................................................................... [2]

Mark scheme: 5(a) PROCEDURE MakeNewFile(OldFile, NewFile, Status : STRING) 7 DECLARE Line1, Line2, Line3 : STRING DECLARE NumCopied, NumRecs : INTEGER NumRecs ← 0 NumCopied ← 0 OPENFILE OldFile FOR READ OPENFILE NewFile FOR WRITE WHILE NOT EOF(OldFile) READFILE OldFile, Line1 READFILE OldFile, Line2 READFILE OldFile, Line3 NumRecs ← NumRecs + 1 IF Line3 <> Status THEN WRITEFILE NewFile, Line1 WRITEFILE NewFile, Line2 WRITEFILE NewFile, Line3 NumCopied ← NumCopied + 1 ENDIF ENDWHILE OUTPUT "File " , OldFile , " contained " , NumRecs ,__ " employee details" OUTPUT Numcopied , " employee sets of details were __ written to file", NewFile CLOSEFILE OldFile CLOSEFILE NewFile ENDPROCEDURE Mark as follows: 1 Procedure heading and ending, including parameters 2 OPEN OldFile for READ and NewFile for WRITE and subsequently CLOSE both files 3 Conditional loop until EOF(OldFile) 4 Read three lines from OldFile in a loop 5 Compare 3rd line read with Status parameter and if not equal write 3 lines to NewFile in a loop 6 Count number of sets read and those written in a loop 7 Final output including both counts and file names with suitable text after a loop Note: MP6: Both counts must have been declared and initialised 5(b)(i) Store all three items on one line 1 5(b)(ii) One mark per point: 2 Advantage: Fewer file operations required Disadvantage: Algorithm to combine / extract individual data items is more complex

More questions on Files

Q6 · A mobile phone has a touchscreen

6 A mobile phone has a touchscreen. The screen is represented by a grid, divided into 800 rows and 1280 columns. The grid is represented by a 2D array Screen of type INTEGER. An array element will be set to 0 unless the user touches that part of the screen. Many array elements will set to 1 by a single touch of a finger or a stylus. The following diagram shows a simplified touchscreen. The dark line represents a touch on the screen. All grid elements that are wholly or partly inside the outline will be set to 1. These elements are shaded. The element shaded in black represents the centre point of the touch. 11 6 A program is needed to find the coordinates (the row and column) of the centre point. The centre point on the diagram shown is row 6, column 11. Assume: • the user may only touch one area at a time • screen rotation does not affect the touchscreen. The programmer has decided to use global values CentreRow and CentreCol as coordinate values for the centre point. The programmer has started to define program modules as follows: Module Description • Searches for the first row that has an array element set to 1 FirstRowSet() • Returns the index of that row (1 is the first row) • Returns −1 if there are no elements set to 1 • Searches for the last row that has an array element set to 1 LastRowSet() • Returns the index of that row • Returns −1 if there are no elements set to 1 • Searches for the first column that has an array element set to 1 FirstColSet() • Returns the index of that column (1 is the first column) • Returns −1 if there are no elements set to 1 • Searches for the last column that has an array element set to 1 LastColSet() • Returns the index of that column • Returns −1 if there are no elements set to 1 (a) Write efficient pseudocode for the module FirstRowSet(). ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... (b) Describe a feature of your solution to part (a) that indicates the pseudocode represents an efficient algorithm. ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ............................................................................................................................................. [2] (c) The programmer decides to produce a single search module FindSet(), which will be able to perform each of the individual searches performed by the first four modules in the table. (i) Outline the changes needed to convert one of the existing modules into this single module. ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ..................................................................................................................................... [2] (ii) Give one possible advantage and one possible disadvantage of combining the four searches into a single module. Advantage ......................................................................................................................... ........................................................................................................................................... Disadvantage .................................................................................................................... ........................................................................................................................................... [2]

Mark scheme: 6(a) FUNCTION FirstRowSet() RETURNS INTEGER 7 DECLARE Row, Col : INTEGER DECLARE Found : BOOLEAN // array is 1280 × 800 Row ← 1 Found ← FALSE WHILE Row <= 800 AND Found = FALSE // top to bottom Col ← 1 WHILE Col <= 1280 AND Found = FALSE // left to right IF Screen[Row,Col] = 1 THEN Found ← TRUE // end function as soon as first // found ENDIF Col ← Col + 1 ENDWHILE Row ← Row + 1 ENDWHILE IF Found = FALSE THEN // nothing found Row ← 0 ENDIF RETURN Row - 1 ENDFUNCTION Mark as follows: 1 Function heading and ending and return type 2 (Conditional) outer loop 1 to 800 (row) 3 (Conditional) inner loop 1 to 1280 // 1280 to 1 (column) 4 Reference Screen element and test for = 1 // <> 0 5 and if true save row number and exit loops 6 Increment index variables in both inner and outer loop 7 Return Row number or −1, following a reasonable attempt 6(b) One mark for: 2 • (A flag is used to) exit the loops // iteration is terminated • as soon as a Screen element with value 1 is found 6(c)(i) One mark for: 2 • Parameter(s) need to be passed to the module to identify the type of search • Search algorithm is controlled by (global) variables / parameters Alternative: • The search algorithms from the original modules are included in the new module • The new module needs to return / store the four values (the results of the four searches) 6(c)(ii) One mark for advantage and one for disadvantage: 2 Advantage: (max 1) • Only have to change one module if specification changes • Less repetitive code / fewer lines of code • Aids re-usability Disadvantage: (max 1) • Single module more complex / more error prone / more difficult to debug ... • Single module cannot be split among programmers / teams Max 2 6(d) PROCEDURE GetCentre () 6 DECLARE StartRow, EndRow, StartCol, EndCol : INTEGER StartRow ← FirstRowSet() IF StartRow = -1 THEN CentreRow ← -1 // no 'touch' detected ELSE EndRow ← LastRowSet() StartCol ← FirstColSet() EndCol ← LastColSet() CentreRow ← INT((StartRow + EndRow)/2) CentreCol ← INT((StartCol + EndCol)/2) ENDIF ENDPROCEDURE Mark as follows: 1 Call <any Set function> and check for -1 // check for no element set 2 ...and if so set CentreRow to –1 3 Call all 4 Set functions to get 'extremity' values 4 Calculate centre row and centre column 5 Use of INT() function or DIV operator on values from MP4 6 Assign calculated values to CentreRow and CentreCol Note: Max 5 if procedure heading and ending missing or incorrect (ignore array if passed as a parameter) or any local variables are undefined or of incorrect type

More questions on Structured Programming

What was in this paper

The subtopics covered by these 6 questions, and how many questions each got. Open one in a new tab to see every Cambridge question on it.

What you needed in this session

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

A44/75
B36/75
C29/75
D22/75
E15/75