Cambridge International AS & A Level: Computer Science 9608/22
Cambridge International AS & A Level: Computer Science 9608/22
Cambridge International AS & A Level: Computer Science 9608/22
PRE-RELEASE MATERIAL
* 3 0 7 6 6 2 4 9 9 5 *
This material should be given to the relevant teachers and candidates as soon as it has been
received at the centre.
INSTRUCTIONS
● You should use this material in preparation for the examination.
● You should attempt the practical programming tasks using your chosen high-level, procedural
programming language.
DC (PQ) 211788
© UCLES 2021 [Turn over
2
Teachers and candidates should read this material prior to the June 2021 examination for 9608 Paper 2.
Reminders
• there will be questions on the examination paper which do not relate to this pre-release material.
• you must choose a high-level programming language from this list:
Note: A mark of zero will be awarded if a programming language other than those listed is used.
• structured English
• pseudocode
• program code
Some tasks may need one or more of the built-in functions or operators listed in the Appendix at the
end of this document.
There will also be a similar appendix at the end of the question paper.
Declaration of variables
The syllabus document shows the syntax expected for a declaration statement in pseudocode.
If Python is the chosen language, each variable’s identifier (name) and its intended data type must be
documented using a comment statement.
TASK 1 – Arrays
Introduction
Candidates should be able to write programs to process array data in pseudocode and in their chosen
programming language. Each task should be planned using pseudocode before writing it in program
code.
TASK 1.1
Design a way to store multiple pieces of data about a student in a single string. For example, you could
store each student’s name, email address and date of birth as follows:
Use a 1D array of type STRING to store data about each student in the class. Each element of the
array will store data for one student.
2. prompt and input for student name, email address and date of birth
6. output each element of the array in a suitable format, together with explanatory text such as
column headers.
TASK 1.2
Consider what happens when a student’s details are deleted from the array because the student has
left the class.
Decide on a way of identifying unused array elements and only output elements that contain students’
details. Modify your program to include this.
TASK 1.3
TASK 1.4
Extend Task 1.3 to output a list of all students who have a birthday in a given month.
TASK 1.5
Convert your design to use a 2D array and add additional pieces of data for each student.
For example:
TASK 1.6
Modify your program to work with the new structure and extend the searches to work with any piece of
data.
TASK 2 – Files
Introduction
Candidates should be able to write programs to process text file data in pseudocode and in their
chosen programming language.
Each task should be planned using pseudocode before writing program code.
TASK 2.1
Define a structure for a text file used to store multiple pieces of data about each class member as a
single string. Each line of the file will store data for one student.
Store at least three pieces of data. For example, you could store each student’s ID together with his or
her email address and date of birth as follows:
Define a fixed format for the Student ID, for example, two letters followed by four digits.
Define a fixed format for the date of birth, for example, "DDMMYY"
TASK 2.2
Write a second program to search the file for a given Student ID and output the email address if the ID
was found, or a suitable message if the ID was not found.
TASK 2.3
Modify the search code to perform a substring match on the Student ID. For example, search for all the
Student IDs that begin with "AB".
TASK 2.4
Modify the program to allow the details of additional students to be appended to the file.
TASK 2.5
Consider rules that could be applied to ensure the data entered is acceptable.
Appendix
Each function returns an error if the function call is not properly formed.
Operators (pseudocode)
Operator Description
Concatenates (joins) two strings
&
Example: "Summer" & " " & "Pudding" produces "Summer Pudding"
Performs a logical AND on two Boolean values
AND
Example: TRUE AND FALSE produces FALSE
Performs a logical OR on two Boolean values
OR
Example: TRUE OR FALSE produces TRUE
© UCLES 2021 9608/22/PRE/M/J/21
8
BLANK PAGE
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.