Professional Documents
Culture Documents
Cambridge International
AS and A level
Computer
Science
Coursebook
CAMBRIDGE
UNIVERSITY PRESS
www.cambridge.org
A catalogue record for this publication is available from the British Library
The past paper questions on pages 107-108 and 316 are taken from the 9608 Specimen papers 1 and 3 respectively
and are reproduced with the permission of Cambridge International Examinations.
All other examination-style questions and comments that appear in this book were written by the authors.
Contents
Contents
Introduction v
Glossary 430
Index 434
Acknowledgements 442
iv
Introduction
Introduction
This full-colour, illustrated textbook has been written by experienced authors specifically for
the Cambridge International AS and A Level Computer Science syllabus (9608).
The presentation of the chapters in this book reflects the content of the syllabus:
• The book is divided into four parts, each of which is closely matched to the corresponding
part of the syllabus.
• Each chapter defines a set of learning objectives which closely match the learning
objectives set out in the syllabus.
• The syllabus defines two assessment objectives: A01 Knowledge with understanding and
A02 Skills. Papers 1 and 3 have a major focus on A01 and Papers 2 and 4 have a major
focus on A02. The chapters in Parts 1 and 3 have been written with emphasis on the
promotion of knowledge and understanding. The chapters in Parts 2 and 4 have been
written with an emphasis on skill development.
The chapters in Parts 1 and 3 have a narrative. We would encourage students to read the
whole chapter first before going back to revisit the individual sections.
The chapters in Parts 2 and 4 contain many more tasks. We would encourage students to
approach these chapters step-by-step. Whenever a task is presented, this should be carried
out before progressing further.
In particular, Chapter 11 (Algorithm design and problem-solving) may be worked through in
v
parallel with Chapter 13 (Programming and data representation). For example, Task 13.03
is based on Worked Example 11.03. After studying this worked example, students may wish
to cover the first part of Chapter 13 and write the program for Task 13.03. This will give the
student the opportunity to test their understanding of an algorithm by implementing it in
their chosen programming language. Then further study of Chapter 11 is recommended
before attempting further tasks in Chapter 13.
Task – exercises
for the student to Question – questions
test their skills. for the student to test
their knowledge and
TASK 1.01
Convert the denary number 374 into a hexadecimal number.
understanding.
Convert the hexadecimal number 3A2C to a denary number.
Discussion Point
What is the two’s complement of the binary value 1000? Are you surprised by this?
! TIP
Converting a negative number expressed in two’s complement form to the
corresponding denary number.
For multiples of bytes, the terminology used has recently changed. Traditionally, computer
scientists have used the terminology kilobyte, megabyte, gigabyte etc. in a way that conflicted Consider the two’s complement binary number 10110001.
with the definition of these prefixes established by the International System of Units (SI).
Following the SI convention, one kilobyte would represent 1000 bytes. Computer scientists Method 1. Convert to the corresponding positive binary number then find the denary
have used one kilobyte to represent 1024 bytes. There have been a number of variations on value
how this was written, for example Kbyte, KB or kB but the basic contradiction remained. In
Converting to two’s complement leaves unchanged the 1 in the least significant bit
order to resolve this unsatisfactory situation, the International Electrotechnical Commission
(IEC) in 1998 proposed a new set of definitions for such quantities. 1024 bytes is now identified
position then changes all of the remaining bits to produce 01001111.
as one kibibyte where the kibi can be considered as representing kilobinary. This proposal has
been accepted by other international standards bodies.
Summary
An image can be stored either in a vector graphic file or in a bitmap file.
●
vii
Exam-style Questions
1 A file contains binary coding. The following are two successive bytes in the file:
10010101 00110011
a One possibility for the information stored is that the two bytes together represent one unsigned integer binary
number.
i Give the denary number corresponding to this. Show your working. [2]
ii Give the hexadecimal number corresponding to this. Show your working. [2]