Cambridge AS Level Computer Science 9618 · 10.2 Arrays

Q19 · 9618/21/O/N/22 Q1

Worked solution from the Data Types and Structures Paper 2 Problem-solving and Programming booklet, Part 2 of 4.

Q199618/21/O/N/22original Q1Structured · 12 marks
Question 1 from 9618/21/O/N/22

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:

StatementError
IF EMPTY ← "" THENShould 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") + 5NO 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 IDEAArrays 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

Mark scheme for 9618/21/O/N/22 question 1
VIDEO
▶ Whole paper

Video solution of the whole paper · by Pseudocode Pro. Tap the picture to open it on YouTube.

Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.