Computer Science (9608) · May/June 2018 · PM 22

Cambridge Computer Science (9608) pm for paper 22, May/June 2018 — 9608/22/M/J/18, file 9608_s18_pm_22.pdf.

Advertisement
Loading the paper…
Text of this paper

www.dynamicpapers.com

Cambridge International Examinations
Cambridge International Advanced Subsidiary and Advanced Level

COMPUTER SCIENCE
Paper 2 Fundamental Problem-solving and Programming Skills

9608/22
May/June 2018

PRE-RELEASE MATERIAL
* 5 9 6 8 3 6 8 4 6 8 *

No Additional Materials are required.
This material should be given to the relevant teachers and candidates as soon as it has been received
at the Centre.
READ THESE INSTRUCTIONS FIRST
Candidates should use this material in preparation for the examination. Candidates should attempt the
practical programming tasks using their chosen high-level, procedural programming language.

This document consists of 6 printed pages and 2 blank pages.
DC (JM) 162738
© UCLES 2018

[Turn over

2

www.dynamicpapers.com

Teachers and candidates should read this material prior to the June 2018 examination for 9608 Paper 2.
Reminders
The syllabus states:

•

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:
o

Visual Basic (console mode)

o

Pascal / Delphi (console mode)

o

Python

Note: A mark of zero will be awarded if a programming language other than those listed is used.
Questions on the examination paper may ask the candidate to write:

•

structured English

•

pseudocode

•

program code

A program flowchart should be considered as an alternative to pseudocode for documenting an
algorithm design.
Candidates should be confident with:

•

the presentation of an algorithm using either a program flowchart or pseudocode

•

the production of a program flowchart from given pseudocode and vice versa

There is an Appendix at the end of this document. Some tasks refer you to this information.
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.
DECLARE <identifier> : <data type>
If Python is the chosen language, each variable’s identifier (name) and its intended data type must be
documented using a comment statement.
Structured English – Variables
An algorithm in pseudocode uses variables, which should be declared. An algorithm in structured
English does not always use variables. In this case, the candidate needs to use the information given
in the question to complete an identifier table. The table needs to contain an identifier, data type and
description for each variable.

© UCLES 2018

9608/22/PRE/M/J/18

www.dynamicpapers.com
Key focus:

3

Pseudocode and program code

TASK 1 – Structured English, flowcharts and program code
Consider examples of processes in a variety of areas, such as:

•
•
•

Key focus:
Key focus:
Pseudocode and program code
Errors
Key focus:

clubs or hobbies
college or school
home or factory

Pseudocode and program code

focus:
KeyKey
focus:

TASK 1.1

Modular programming
Errors
Key focus:
Write an algorithm, using structured English, to describe each of these processes.
Errors

focus:
KeyKey
focus:

Problem
decomposition
Modular
programming

TASK 1.2

Key focus:

programming
Split a process into sub-tasks and consider the advantages ofModular
this approach.

Key focus:
Key focus:
Problem decomposition
Program
flowchart
Key focus:

TASK 1.3

Problem
decomposition
Convert an algorithm written in structured English into a program
flowchart.

focus:a flowchart.
You will need to include some or all of the following whenKey
constructing
•
•
•
•
•
•

input
output
iteration (conditional or count-controlled)
selection (using IF or CASE statements)
sequence
calls to subroutines

Key focus:

Program flowchart
Key focus:
Interpret
modular code to produce a structure c
Program flowchart

focus:
KeyKey
focus:

Different
CASE code
criteria
Interpret
modular
to produce a structure chart

Key focus:

Note: Conditions within a CASE statement may contain a range of criteria as illustrated in the following
Interpret modular code to produce a structure c
flowchart.

Key focus:

Different CASE criteria

Key focus:

Different CASE criteria

CASE OF
<identifier>

OTHERWISE

> UpperLimit
LowerLimit TO
UpperLimit
5

Statement 5

Statement 1
Statement 2
Statement 3
Statement 4

© UCLES 2018

9608/22/PRE/M/J/18

[Turn over

4

www.dynamicpapers.com

TASK 1.4
Convert the program flowchart into pseudocode and then into program code. A list of typical
pseudocode functions can be found in the Appendix.

Key
Key focus:
focus:
Key
focus:and program
Pseudocode
Pseudocode and
program code
code

TASK 1.5

Pseudocode and program code
Consider the different types of error that can occur at different stages of the development cycle.

Key
Key focus:
focus:
Key
focus:
Errors
Errors

Key
TASK
1.6focus:

Errors
Pseudocode and program code
Consider the advantages of modular programming using both built-in and user-defined functions.

Key
Key focus:
focus:
Key
focus:
Modular
Modular programming
programming

Different ways to express CASE criteria
Modular programming

Key focus:
Errors

Key
Key focus:
focus:
Key
focus:
Key
focus:
Problem
Problem decomposition
decomposition

Problem decomposition
Testing
Key
TASK
1.7focus:
Modular programming
Consider ways of testing the complete program, both with and without knowledge of the underlying
Key
Key focus:
focus:
program code.
Key
focus:
Key focus:
Program
Program flowchart
flowchart
Key
focus:
Producing
a structure
chart have been
Consider ways of testing the main program before all of Program
the user-defined
functions
flowchart
completed.
Problem decomposition

Key
Key focus:
focus:
Key
focus:
Key focus:
Interpret
Interpret modular
modular code
code to
to produce
produce aa structure
structure cc

Key focus:

Good
programming
practice
Interpret
modular code
to produce a structure c

Program flowchart

Key
Key focus:
focus:
Key
focus:
Different
Different CASE
CASE criteria
criteria

Key focus:

Interpret modular code to produce a structure chart

Key focus:

Different CASE criteria

© UCLES 2018

9608/22/PRE/M/J/18

Different CASE criteria

Errors

Key focus:

Pseudocode and program code

Key focus:

5

www.dynamicpapers.com
Key focus:
Testing

Key focus:

TASK
2 – Structure
charts and procedure declarations
Modular
programming

Different ways to express CASE criteria

Key focus:

Key focus:

Errors
Key
focus:
TASK 2.1

Producing a structure chart

Key focus:
Problem decomposition
Produce a structure chart for a simple modular program. Include one top-level module and at least two
Key focus:
Key focus: Testing
lower-level
modules.
Modular programming
Pseudocode and
program
code
Key
focus:
Add Key
data arrows
for
both
Boolean
and
non-Boolean
variables.
focus:
Good programming practice
Key foc
Key focus:
Program flowchart
Different
TASKKey
2.2 focus:
Key focus: Producing a structure chart
Problem decomposition
Errors for the modules.
Use the chart to produce pseudocode declarations
Key focus:

Interpret
modular code to produce a structure chart
TASK
2.3 focus:
Key

Key focus:

Key foc

Key focus:

Testing

Good programming practice
Program
flowchartinto program code.Modular programming
Convert
the pseudocode

Key focus:

Key focu

Consider features of the program code that make it easier to read and understand.
Different CASE criteria

Key focus:

Key focus:

Producing

Problem decomposition
TASK 2.4
Interpret modular code to produce a structure chart

Produce pseudocode declarations for a different set of modules, with one top-level module and at least
two lower-level modules, using different sets of parameters.
Key

Key focus:

CASE criteria
TASKDifferent
2.5

Key focus:

Good progr

Program flowchart

Produce a structure chart from the pseudocode procedures produced in Task 2.4.

Key focus:

Interpret modular code to produce a structure chart

Key focus:

Different CASE criteria

© UCLES 2018

9608/22/PRE/M/J/18

focu

[Turn over

www.dynamicpapers.com

6

Appendix
Built-in functions (pseudocode)
Each function returns an error if the function call is not properly formed.
MID(ThisString : STRING, x : INTEGER, y : INTEGER) RETURNS STRING
returns a string of length y starting at position x from ThisString
Example: MID("ABCDEFGH", 2, 3) returns string "BCD"
LENGTH(ThisString : STRING) RETURNS INTEGER
returns the integer value representing the length of string ThisString
Example: LENGTH("Happy Days") returns 10
LEFT(ThisString : STRING, x : INTEGER) RETURNS STRING
returns leftmost x characters from ThisString
Example: LEFT("ABCDEFGH", 3) returns string "ABC"
RIGHT(ThisString : STRING, x : INTEGER) RETURNS STRING
returns rightmost x characters from ThisString
Example: RIGHT("ABCDEFGH", 4) returns string "EFGH"
INT(x : REAL) RETURNS INTEGER
returns the integer part of x
Example: INT(27.5415) returns 27
ASC(ThisChar : CHAR) RETURNS INTEGER
returns the ASCII value of character ThisChar
Example: ASC('A') returns 65
MOD(ThisNum : INTEGER, ThisDiv : INTEGER) RETURNS INTEGER
returns the integer value representing the remainder when ThisNum is divided by ThisDiv
Example: MOD(10,3) returns 1

Operators (pseudocode)
Operator
&
AND
OR
© UCLES 2018

Description
Concatenates (joins) two strings.
Example: "Summer" & " " & "Pudding" produces "Summer Pudding"
Performs a logical AND on two Boolean values.
Example: TRUE AND FALSE produces FALSE
Performs a logical OR on two Boolean values.
Example: TRUE OR FALSE produces TRUE
9608/22/PRE/M/J/18

7
BLANK PAGE

© UCLES 2018

9608/22/PRE/M/J/18

www.dynamicpapers.com

8

www.dynamicpapers.com

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 International
Examinations Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download at www.cie.org.uk after
the live examination series.
Cambridge International Examinations is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of University of Cambridge Local
Examinations Syndicate (UCLES), which is itself a department of the University of Cambridge.

© UCLES 2018

9608/22/PRE/M/J/18

Advertisement