33% found this document useful (3 votes)
1K views40 pages

Cambridge International AS and A Level Computer Science Revision Guide

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
33% found this document useful (3 votes)
1K views40 pages

Cambridge International AS and A Level Computer Science Revision Guide

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

Tony Piper

Cambridge International
AS and A level
Computer
Science
Revision Guide

i
University Printing House, Cambridge CB2 8BS, United Kingdom
One Liberty Plaza, 20th Floor, New York, NY 10006, USA
477 Williamstown Road, Port Melbourne,VIC 3207, Australia
4843/24, 2nd Floor, Ansari Road, Daryaganj, Delhi – 110002, India
79 Anson Road, #06–04/06, Singapore 079906

Cambridge University Press is part of the University of Cambridge.


It furthers the University’s mission by disseminating knowledge in the pursuit of
education, learning and research at the highest international levels of excellence.

www.cambridge.org
Information on this title: education.cambridge.org
© Cambridge University Press 2016
This publication is in copyright. Subject to statutory exception
and to the provisions of relevant collective licensing agreements,
no reproduction of any part may take place without the written
permission of Cambridge University Press.
First published 2016
20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4
Printed in Dubai by Oriental Press
A catalogue record for this publication is available from the British Library
ISBN 9781107547544 Paperback
Cambridge University Press has no responsibility for the persistence or accuracy
of URLs for external or third-party internet websites referred to in this publication,
and does not guarantee that any content on such websites is, or will remain,
accurate or appropriate. Information regarding prices, travel timetables, and other
factual information given in this work is correct at the time of first printing but
Cambridge University Press does not guarantee the accuracy of such information
thereafter.
...........................................................................................................................................................................................
NOTICE TO TEACHERS IN THE UK
It is illegal to reproduce any part of this work in material form (including
photocopying and electronic storage) except under the following circumstances:
(i) where you are abiding by a licence granted to your school or institution by the
Copyright Licensing Agency;
(ii) where no such licence exists, or where you wish to exceed the terms of a licence,
and you have gained the written permission of Cambridge University Press;
(iii) where you are allowed to reproduce without permission under the provisions
of Chapter 3 of the Copyright, Designs and Patents Act 1988, which covers, for
example, the reproduction of short passages within certain types of educational
anthology and reproduction for the purposes of setting examination questions.
...........................................................................................................................................................................................

The past paper questions used 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 author.
Cambridge International Examinations bears no responsibility for the example answers to questions taken from
its past question papers which are contained in this publication.

ii
Contents
Revision Guidelines PART III ADVANCED THEORY
PART I THEORY FUNDAMENTALS Chapter 13 Data representation 133

Chapter 1 Information representation 2 Chapter 14 Communication and Internet


technologies 146
Chapter 2 Communication and Internet
technologies 12 Chapter 15 Hardware 160

Chapter 3 Hardware 30 Chapter 16 System software 175

Chapter 4 Processor fundamentals 41 Chapter 17 Security 192

Chapter 5 System software 55 Chapter 18 Monitoring and control systems 200

Chapter 6 Security, privacy and data integrity 60


Chapter 7 Ethics and ownership 67
PART IV FURTHER PROBLEM-
SOLVING AND
Chapter 8 Database and data modelling 74
PROGRAMMING SKILLS
Chapter 19 Computational thinking and
PART II FUNDAMENTAL problem solving 209
PROBLEM-SOLVING AND Chapter 20 Algorithm design methods 236
PROGRAMMING SKILLS
Chapter 21 Further programming 245
Chapter 9 Algorithm design and problem-
solving 88 Chapter 22 Software development 274

Chapter 10 Data representation 97


Answers 283
Chapter 11 Programming 106
Chapter 12 Software development 126

iii
Revision guidelines primary key and a foreign key’. However, it is a much better
assessment of your ability if you are able to apply this to a
given simple practical scenario. The question style you are
more likely to face is:
Revision, by the nature of the word, implies re-visiting 1 Which attribute would be the primary key for table X?
content and topics that you have studied throughout the
2 How is the relationship formed using a foreign key to
year. What you already have in terms of resources to help
table Y?
you with your revision will largely determine the way in
which you set about and plan your revision programme. Computing is a practical subject – probably second only to
engineering – and so it is reasonable that your computing
Key issues include:
examination papers should reflect this, with questions that
• Have you got a copy of the textbook you have followed require answers which apply your knowledge in the context
throughout your course? of practical scenarios.
• Did you use it as your course progressed to make your
own notes?
Past examination paper
• Has your teacher provided you with notes as each topic
has been covered? questions
• Have you worked through worksheets prepared by your Looking at as many previous questions as possible can
teacher? be a very valuable part of revision. Many examples from
All of these are a good starting point and your first revision Cambridge past papers have been carefully selected
task is to gather together all the materials you have produced and included at the end of each section in the course
and accumulated throughout the course. Organise them in textbook. (Cambridge International Examinations bears no
the same way as the 9608 syllabus, that is, by section and responsibility for the example answers to questions taken
subsection. from its past question papers which are contained in this
publication.)
Your teacher will be able to supply you with further past
When should I start revising? papers and specimen papers and guide you to relevant
questions for the topic you are revising.
Start as early as possible. Examinations are generally a
stressful time and so you need to do everything possible to So, you’ve trawled through and organised the materials you
make this a ‘stress-free’ experience. have produced throughout the course – what next?

A trawl through all the materials you have should establish:


• what topics you have clear notes for and where you Specific revision materials
do not
• topics where you can do lots of practice, for example, Cambridge International AS and A
the number systems content in Part 1, 1.01 Level Computing Revision Guide
• topics about which you are definitely confident
This book should provide you with a helpful structure to
• topics that you are not confident with – you probably plan your revision around. The organisation of this guide
‘put it off ’ when the content was covered in lessons. is similar to the course textbook and it has frequent ‘test
yourself ’ questions as you work through each chapter.

Preparing for examination


Revision cards
You must not have large gaps in your understanding
and you need the skills to apply your knowledge. Both These are a favourite with students and have the obvious
are important. The trend generally for all advanced level advantage that you can carry them around with you and
examinations is away from questions which only ask dip into them in any odd five minutes you can find. Cards
you to reproduce basic knowledge, for example giving a are available in different colours and so you could easily
basic definition. For a question about database design a develop a system to code cards on the same general topic
knowledge question could be ‘State what is meant by a in the same colour.

iv
The figures below are for Chapter 8, on databases: How will you organise the cards?
• a separate set for each section
Database design Card 1 (of 10) • a separate set for each topic
Attribute – Data item recorded as part of a database
design. There are some clear links between content in, for
Entity – In database design, something about which we example, Part 1 and Part 3. Assembly language is
record data, for example, a Customer. Entities are introduced in Section 1 and then studied in more depth
implemented as tables. in Part 3. Can you have a system with your revision cards
Primary key – An attribute (or combination of which allows for this?
attributes) chosen to ensure that all the records in a
table are unique.
Relationship – A link between two tables, which can be:
• One-to-one – uncommon
Mind maps
• One-to-many – the most common
• Many-to-many – cannot be implemented with Mind maps provide an effective way to break the content
relational database software down into manageable amounts and if you are a person
who ‘thinks visually’ then you will probably take to mind-
mapping. My experience is that students tend to be
Database design Card 2 (of 10) polarised into ‘I like using them’ or ‘I hate them’ but I have
Foreign key – An attribute in a table which links back to found that students do agree they are a useful revision
the same primary key attribute in a second table. tool. A simple example for (some of) the database content
Candidate key – Attribute(s) which are unique in a table for Chapter 8 is shown below:
and so are a ‘candidate’ to be used as the primary key.
Secondary key – An attribute other than the primary key
for which an index has been created.

Entity – In database design, something Entity-Relationship (E-R) diagram


about which we record data, for example,
a Customer. Entities are implemented as CUSTOMER places ORDER
tables.
Attribute – Data item recorded as part of
a database design, for example, Customer
Address.
Primary key – An attribute (or combination
of attributes) chosen to ensure that all the
records in a table are unique.

Secondary key – An attribute for which an


index has been created other than the
primary key.

Databases One-to-one which are uncommon.

One-to-many which are the most common.

Many-to-many which cannot be


implemented with relational database
Relationship – A link between two tables software.
Foreign key – an attribute in a table which
links back to the same primary key attribute
in a second table. This is how relationships
are implemented – linking a primary key in
one table to a foreign key in another table.

Data Defination and Data Manipulation Normalisation Flat files vs. Databases - DMBS
Language

v
Also there is available on the World Wide Web free mind- to bury problems and topic areas about which you are
mapping software and this usually has features which are unsure. Your revision buddy may be confident about it
very appropriate for revision: and after five minutes of him or her talking it through,
something about which you have been unclear for six
• the expansion of branches (to see detail)
months, may become clear for the first time. Failing that,
• the collapsing of branches (to see the ‘big picture’) be honest that you are unsure and seek help from your
• the inclusion of graphics. teacher. Problems do not go away and solve themselves
– you must be pro-active in plugging the gaps in your
knowledge and understanding.
How do I revise?
What time of day?
On the day – examination
technique
There are all sorts of conflicting evidence about when
your brain is at its most receptive! You will need to decide Reading the paper
what time of day seems to work best for you and how
long each session should be. It is sensible to read the entire paper before you start to
attempt any of the questions. This will give you a good idea
as to the questions you are confident about and those
Shall I revise on my own? which may need more time spent on them. The number
of marks is a good indicator of how long you should
Maybe, but it will be much less daunting if you team up spend on each question. Get used to planning how you
with a fellow student – a ‘revision buddy’ – and revise will divide your time for questions through an examination
together. This could include: paper using the marks as a guide. It is a good idea to read
• sharing the work of producing the revision cards or back through your answers once you finish.
mind maps
• testing each other on some basic definitions and the Layout of the paper
factual knowledge of a topic.
Where questions are displayed in an answer booklet, the
amount of space provided is an indicator of the length of
I do lots of past examination answer the examiner is expecting.
questions Is it important to answer the questions in a paper in
order? No, you can answer the questions in any order.
Consider carefully what ‘doing examination questions’ As a general rule questions which are considered less
actually means for you. It is tempting to look at a demanding will be at the start of the paper.
question then, talking to yourself, recite the answer you
would give – then move on to another question. That
might be sufficient but, remember, the examination is a Understanding the question
written paper; why not spend the extra time in writing
out the answer on rough paper? That way when you read command words
it back it may be clear that there are some points which
you have omitted or some points where the meaning is Some questions will have a short introduction (called the
unclear. ‘stem’ of the question) and this will apply to all parts of the
questions which follow. Specific questions will each have
a keyword which is the indicator as to the style of answer
Seek advice expected.
Questions starting ‘Define ...’, ‘State ...’,‘Give ...’ or ‘Name …’
You need to be confident with all the syllabus content all require an answer of only one or a few words giving a
(remember, there is no choice of questions) so don’t try short and concise answer.

vi
For example: For example:
Give the attributes for the Loan table below, showing Describe how an assembly language program is
the primary key. translated into machine code. [2]
You should not create a LoanID for this table. A question starting ‘Explain ...’ wants not only a
description but an answer that contains some
Loan (............., ............,
reasoning.
.............., ..............) [2]
For example:
A question starting ‘Describe ...’ wants more detail. The
indicator of precisely how much detail is the number Explain why an interpreter has better diagnostics
of marks for the question: a three-mark question will features than compiler software. [2]
usually require three different points to be made.
A sample examination question is shown below:

(a) State what is meant by a real-time application.


There is no introductory statement.
The keyword is ‘State’ and what is wanted is the
basic ‘bookwork’ definition of a real-time system.
[1]
(b) An air conditioning system is a real-time application.
Explain how sensors and actuators are used to control an air-conditioning system in an apartment.

The introductory statement applies to part (b) only


The keyword is ‘Explain’ and there are four marks.
The answer must make at least four clear points describing how a
temperature sensor sends data values to the processor and how
they are processed when an actuator is involved. [4]

(c) Give one other example of a real-time application. Justify why your choice is a real-time application.
Example:
The keyword is ‘Give’ but you are having to be more resourceful and
Justification: come up with your own example of a real-time system.
The key requirements are the example and its justification. The paper
makes it clear how you are to present them. You can assume there
will be one mark for the example and one mark for the justification. [2]

Cambridge International AS and A Level Computing 9691 Paper 31 Q4, June 2011

vii
PART 1

PART 1
THEORY FUNDAMENTALS

Chapter 1 Information representation


Chapter 2 Communication and Internet technologies
Chapter 3 Hardware
Chapter 4 Processor fundamentals
Chapter 5 System software
Chapter 6 Security, privacy and data integrity
Chapter 7 Ethics and ownership
Chapter 8 Database and data modelling

1
Unit 111
Information representation
Chapter

Revision objectives
By the end of the chapter you should be able to:
show understanding of the basis of different show understanding of how typical features found
number systems; use the binary, denary and in bitmapped and vector graphics software are
hexadecimal number systems; and convert a used in practice and are therefore appropriate for
number from one number system to another a given task
express a positive or negative integer in two’s show understanding of how sound is represented
complement form and encoded
show understanding of, and be able to represent, use the associated terminology: sampling, sampling
character data in its internal binary form rate, sampling resolution
express a denary number in binary coded show understanding of how file sizes depend
decimal (BCD) and vice versa and describe on sampling rate and sampling resolution
practical applications where BCD is used show understanding of how typical features
show understanding of how data for a bitmapped found in sound-editing software are used in
image is encoded practice
use the terminology associated with bitmaps: show understanding of the characteristics of
pixel, file header, image resolution, screen video streams: frame rate (frames/second);
resolution interlaced and progressive encoding; video
perform calculations estimating the file size for interframe compression algorithms and
bitmapped images of different resolutions spatial and temporal redundancy; multimedia
container formats
show understanding of how data for a vector
graphic is represented and encoded show understanding of how digital data can
be compressed, using ‘lossless’ (including run-
use the terminology associated with vector
length encoding, RLE) or ‘lossy’ techniques.
graphics: drawing object, property and drawing list

1.01 Number representation Denary system


We present any denary number with some combination We were taught to use the denary (or decimal)
of the digits 0, 1, 2, 3, 4, ..., 8 and 9. numbering system – that is, using base 10 with possible
digits 0, 1, 2, ..., 8 and 9.
Any number system is founded on the concepts of:
• a base
TERMS

• that digits in cer tain positions each have a place denary (decimal): numbering system using
value base 10 with possible digits 0, 1, 2, ..., 8 and 9

• the number of possible digits used is the base. binary: numbering system using base 2

2
Binary system

Chapter 1 Information representation


The base 2 numbering (binary) system has possible digits 0 and 1.
This can be summarised as shown in Table 1.01.
System Base Possible digits Place values
denary 10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 etc. 103 102 101 Units
8 7 2 6
binary 2 0, 1 etc. 23 22 21 Unit
1 0 1 1

Table 1.01 Denary and binary numbering systems


Intuitively we would read the denary number as “eight thousand, seven hundred and twenty six”.
Appreciate that it is based on the place-value concept that we have:
(8 x 1000) + (7 x 100) + (2 x 10) + 6 = 8726
Applying the same method to the binary pattern 10111, computes the pattern as binary number:
(1 x 16) + (0 x 8) + (1 x 4) + (1 x 2) + 1 = 23

Hexadecimal system
The base 16 numbering system can be summarised as shown in Table 1.02.

System Base Possible digits Place values


hexadecimal 16 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 etc. 163 162 161 Units
A, B, C, D, E, F
1 B 5

Table 1.02 Hexadecimal numbering system

The Hexadecimal numbering system follows our three The number shown in Table 1.02 is:
basic rules.
(1 x 256) + (B x 16) + 5 = 256 + 176 + 5 = 437 denary
Since the ‘digits’ allowed in base 16 extend past 9 then
we need a way to represent 10, 11, 12, 13, 14 and 15. The
solution in hexadecimal is to use the characters A to F as Conversion between different
shown.
number presentations
If we did not do this, then the hexadecimal We can now convert from binary to denary and vice
TIP

representation 13, could either be versa and also from hexadecimal to denary and vice
interpreted as 13 denary or (1 x 16) + 3 = versa. What about conversion between binary and
19 denary. hexadecimal?
One approach would be to convert into denary first –
but there is a more direct way.

3
Chapter 1 Information representation

Example:
Convert 0011110101010100 into hexadecimal
Divide the binary into groups of four binary digits:
0011 1101 0101 0100
Write the denary for each group
0011 1101 0101 0100
3 13 5 4
We can then convert each denary number to its hexadecimal equivalent:
3 D 5 4 = 3D54 hex
The method can be used in reverse to convert from hexadecimal to binary.
Example: Convert 4AE hex to a binary number stored as two bytes.
Hexadecimal: 4 A E
Denary: 4 10 14
Binary: 0100 1010 1110
‘Stored as two bytes’ means this number will be stored as 16-bit binary pattern as shown in Figure 1.01.
0 0 0 0 0 1 0 0 1 0 1 0 1 1 1 0
Figure 1.01 A binary number stored as two bytes

Note the need to pack out the leftmost group of four bits
with zero bits. 3 What is the eight-bit binary representation for
these integers?
a 3 b 89 c 257
Numbers in the computer
4 Convert these hexadecimal numbers to denary:
All data in the computer must be represented in binary form. a 1A b 10B
Consider a single byte used to represent a positive 5 Convert these hexadecimal numbers to 12-bit
integer. binary representations:
• the most significant bit position has place value of 128 a 7D b 196 c AEC
• the least significant position has place value of a ‘unit’,
that is 0 or 1.
Two’s complement representation
Progress check 1.01 We need to be able to represent both positive and
1 What positive integer is this? negative integers.
One (simple) method would be to use the most significant
0 1 1 0 0 1 1 1 bit to act as a ‘sign’ bit (1 for a negative integer and 0 for a
positive integer) . This method is called ‘sign and magnitude’
2 A positive integer is represented using a single
but is not in our 9608 syllabus.
byte. What is the denary value?
We shall use a representation – two’s complement –
a 0100 0001 b 1010 1010 c 1111 1111
which has a negative place value for the most significant

4
bit. For a two’s complement presentation using a single Each digit of the denary number is represented in

Chapter 1 Information representation


byte the place values are as shown in Figure 1.02. sequence with a group of four binary digits.
-128 64 32 16 8 4 2 u Example: Represent the denary integer 859 in BCD.
8 5 9
Figure 1.02 Two’s complement place values 1000 0101 1001
So, 859 denary is 100001011001 as a BCD
Example: representation.

Convert the following denary numbers to an eight-bit Early computers stored date and time values in
two’s complement binary number. the BIOS of the operating system using BCD
representation. Some later games consoles including
1 56 = 32 + 16 + 8 Atari and Sony PlayStation did likewise. However in
2010, the PlayStation software interpreted the final
-128 64 32 16 8 4 2 u
two digits of the date ‘10’ (stored in BCD) as the
0 0 1 1 1 0 0 0 hexadecimal number 16. The resulting date of 2016
made the console inoperable!
2 -125 = -128 + 3 = -128 + (2 + 1)
-128 64 32 16 8 4 2 u
1 0 0 0 0 0 1 1 1.02 Images
3 -17 = -128 + 111 = -128 + (64 + 32 + 8 + 4 + 2 + 1) Bitmapped image
-128 64 32 16 8 4 2 u A bitmap graphic is a rectangular grid built up from a
1 1 1 0 1 1 1 1 number of pixels. A pixel is the smallest addressable
picture element which can be represented. The term
bitmap comes from the concept that the bit patterns
which make up the file are ‘mapped’ to an area in the
Note the method for a negative number. If main memory. Each pixel will be a particular colour. Each
TIP

its negative, we must have the ‘1 lot of -128’ pixel’s colour will be represented as a binary pattern. The
– we then need to work out what positive contents of the bitmap file will be this sequence of binary
number to add to it. colour codes.
TERMS

Representing characters
pixel: the smallest addressable picture
All data – including characters – must be represented in element which can be represented.
main memory, saved in the backing store and processed
by a program as a number value. A coding system such as
ASCII or Unicode will be used.
There are several types of encoding and file formats for
bitmap images:
LOOK FORWARD ››
• Monochrome: black and white pixels only
ASCII and Unicode are discussed in Chapter 10, • 16 colour: 16 available colours for the pixels
section 10.01.
• 256 colour: 256 possible colours
• 24-bit colour (or true colour) where millions of
Binary-Coded Decimal (BCD) different colours are possible.

Binary-coded decimal is a binary representation which can


be used for a positive denary integer.

5
The encoding for each type can be worked out as shown The clarity with which a bitmap image is viewed on a
Chapter 1 Information representation

in Table 1.03. monitor screen will depend on two factors:

Bitmap Pixel • resolution of the image: the number of pixels per


encoding representation Explanation centimetre. A small image size made up from a large
number of pixels will produce a sharper display.
Monochrome 1 bit Only two colours
needed (Black and • screen resolution: the number of pixels which can be
white). One byte can viewed horizontally and vertically on the screen. A typical
store eight pixels. PC screen resolution is 1680 pixels × 1080 pixels. This
16 colour 4 bits Each byte can store is a key factor to consider when purchasing a monitor –
two pixels. what is the highest possible screen resolution?
256 colour 8 bits (1 byte) Each byte stores one
pixel. Vector graphics
24-bit colour 24 bits (3 bytes) The number of
different colours A vector graphic is made up from a number of drawing
possible is 224 objects. A vector graphic program such as Microsoft Visio
(16, 777, 216). or Corel Draw comes with a vast number of different
objects organised into groups or ‘shape libraries’.
Table 1.03 Encodings for bitmap images
Objects are organised into groups of shapes – the
creator has selected a straight line from the ‘Connectors’
These calculations are an application of group and an LCD monitor from the ‘Computer’ group.
TIP

the study of number systems in Chapter 1,


Objects have properties. These properties determine the
section 1.01.
size and appearance of each object. If an object is re-sized
its properties are simply recalculated.
In addition to the pixel data, the bitmap file will have other An example could be a network topology diagram where
data stored in a file header. The header data will give the a library of networking shapes exists containing objects for
size of the bitmap (width and height measured in pixels) a computer, file server, printer, etc. The user could quickly
and the type of bitmap (encoding) construct a network topology diagram.
Bitmaps have the drawback that they have a large file size. If The advantage of vector graphics is that changing the size
an attempt is made to over-enlarge the bitmap with -editing of any object will not affect the quantity of the drawing’s
software the individual pixels may become visible. This is appearance. That is, the objects are scalable.
called the staircase effect. Figure 1.03 shows an image of
a mouse on the left and the same image after it has been
enlarged – the individual pixels can clearly be seen. Applications of bitmapped and vector
graphics
Bitmapped graphics are used to:
• capture scanned images from a paper document.
• scan a photograph.
Vector graphics are used for:
• general line-drawing diagrams
• diagrams for specialist applications, such as flowcharting,
object-oriented class diagrams, network topologies and
any application where there is a specialist shapes library
available.
A diagram using vector graphics software could be
intended for inclusion in a word processor document.
When completed it must be saved in one of the
Figure 1.03 A bitmap and its enlarged version universally recognised file formats.

6
1.03 Sound The sound will be sampled at a set time interval and these

Chapter 1 Information representation


sample values form the binary values which form the
Sound is a key requirement for most software. Sound will sound file. The issues which affect the sound quality and
be used for: the file size are:
• sounding context-sensitive warning messages to the • How many bits are used to encode each sampled value
user (the sampling resolution)
• the playback of music files, video and bit-streamed • How often the samples are taken, that is, how many
media content values per second (the sampling rate)
• specialist applications, such as the reading of a text The graph in Figure 1.04 illustrates the sampling rate.
document to a visual impaired user. Samples are being taken every one millisecond; that is,
1000 samples will be taken every second.
A sound signal is an analogue signal. To be saved as data on
the computer, the sound signal must be converted from an This example used only eight bits to store each sample.
analogue to a digital signal. This will be done by some form Figure 1.05 shows the sampled data values stored in main
of analogue-to-digital converter (ADC). memory from address 300 onwards.

80

70

60

50

40

30

20

10

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Milliseconds

Figure 1.04 A graph of sound samples

300 301 302 303 304 305 306 307 308 309
8 20 35 44 38 38 48 61 69 75

310 311 312 313 314


75 57 45 36 29

Figure 1.05 Samples stored in memory

7
It should be apparent from Figure 1.05 that: Progressive encoding
Chapter 1 Information representation

• If samples are taken more frequently, the quality of the A system which stores the data for an entire frame and
sound wave will increase. displays all the frame data at the same time is called
‘progressive encoding’. This means the frame rate will be
• If a larger number of bits is used to encode each the number of pictures displayed per second. Traditional
sample, the sound resolution will increase. film uses progressive encoding.
Sound editing software is used for the recording of:
• Spoken word using a microphone Interlaced encoding
• The ‘digitising’ of an analogue sound source. An The problem is that some devices, such as a television,
example could be the connection of a record turntable are not designed to display all the frame data at the
to the computer. The sound from a vinyl record is then same time. The data from a single frame is encoded
recorded using the sound recording software as two separate fields; one containing the data for the
even numbered rows and the second frame has the
Editing features of the software would include: data for the odd numbered rows. The term interlaced
• Cutting and pasting of sections of the recording comes from the concept that the image is rendered
by switching between the even field and the odd field.
• Filtering out certain sounds. For example the ‘clicks’ on
It follows that the rate of picture display is twice the
a scratched vinyl record
frame rate.
• Recording as a single (mono) channel or two channels
With increasing demand for the display of video content
(stereo)
through DVD players, set-top boxes and other home
• Normalising the recording level electronic devices there is still a need for interlaced
• Export of the sound recording to a variety of file encoded video format files.
formats. For example MP3. The picture frames that make up interlaced fields have a
correct order relative to each other:
• The spatial order shows which should be the odd or
1.04 Video even field.
Video is in widespread use on computers for recreational • The temporal order refers to a field or frame and
and educational use: which field represents an earlier moment in time.
• YouTube is one of the most popular websites where If either one or both of these orders is incorrect the result
users can post their own video content. of the playback will appear as jerky motion or blurred
edges to content.
• Videos are an excellent medium for an explanation of
the working of a piece of equipment or to provide a
learning tutorial.
1.05 Compression techniques
A video is a sequence of still photographic images which
are displayed in sequence. The frequency with which they Both sound and video files tend to have large file size.
are displayed gives the appearance of continuous motion, Techniques used which encode the data in a way which
and what is contained on individual frames is not apparent. results in less bytes for the file are highly desirable.
The frequency with which the frames are displayed is Compression is the technique of reducing the size of a file
called the frame rate. A continuous effect to the human without a significant loss in the later quality in the use of
eye is achieved with a frame rate of 25 frames per the file.
second or higher.

Image compression techniques


TERMS

Run-length encoding (RLE)


Frame rate: the frequency with which video
frames are displayed Consider a bitmapped file of a photograph where over
half of the pixels are the same pixel value, representing the
blue sky. An alternative to saving (say) the 300 consecutive
pixel values on a row could be to save a single copy of

8
the pixel value followed by the number of occurrences of background. This will contain ‘runs’ when horizontal or

Chapter 1 Information representation


the value (300). This way we have reduced the number of vertical straight line are drawn.
pixels used to store this portion of the graphic from 300
Consider a 256-colour image that is 30 x 4 pixels as
to a very small number.
shown in Figure 1.06. The image has four different colours,
This technique would be appropriate for a monochrome coded as w, b, r and g.
image consisting of a black line drawing on a white

w w w w w w w w w b b w w b b b b g g g g w w w w w w w w w
w w w w g g g g g b b b b b r r r r r r r r w w w w w w w w
w w w w w w w w w w w w w w r r r r r r r r w w w w w w w w
w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w

Figure 1.06 Representation of a 30 × 4 image

The first row of pixels could be encoded: • An image which has a large background could encode
9w2b2w4b4g9w. the background pixels with a lower resolution.
Assuming each ‘run number’ is stored as a single byte, the • Colours such as blue, to which the human eye is less
first line will be stored using 14 bytes (compared to the sensitive, could be encoded at a lower resolution.
original 30). This is a very effective compression.
The popular .jpeg file format is lossy.

Progress check 1.02 Video compression techniques


Calculate the encoded RLE for rows 2, 3, and 4 of
Figure 1.06. Since a video is made up of a number of frames, we are
interested in applying various compression techniques to a
video frame or a frame sequence.
Lossless encoding
We now have two alternatives for encoding a bitmapped
Spatial redundancy
image:
This is the similar to the concern over ‘redundancy’ in a
• Save the colour code for every pixel. bitmap file. Is there a sequence of the same pixels within
• Use run-length encoding. a single frame which could be encoded or effectively
compressed?
Both of these techniques mean that the original bitmap
can be re-created when the data is read from the bitmap
image file and displayed on the output device. Temporal redundancy
For bitmap files several of the universal file formats are Is there a sequence of similar pixels in the same
lossless. These include .bmp and the Portable Network position in consecutive frames? In which case, we do
Graphics (.png) format, which was intended as a not need to repeat them in each frame. It will depend
replacement for the older .gif format. entirely on the content. A room full of people disco-
dancing will not compress as well as a panoramic view
of a beauty spot.
Lossy encoding
Interframe coding addresses the issue of temporal
Using a ‘lossy’ technique for encoding bitmap data has the redundancy. The encoding method is based on the idea
objective of compressing the file size. of key frames, which store data for all the picture, and
Lossy techniques are based on two concepts which intermediary frames which store only the differences from
exploit the limitations of the human eye: the next intermediary frame or key frame.

9
File formats • MP4 (standard container for MPEG-4 multimedia)
Chapter 1 Information representation

• Matroska (not standard for any codec or system, but it


Over the years standards in the computing industry have is an open standard).
emerged for image files (we have already mentioned .BMP.,
.PNG, .GIF and .JPEG) and sound data. Popular sound The differences between container formats arise from
formats include .WAV, .MPEG and .MP3. issues such as:

Video – which is a combination of moving pictures and • popularity: is the container format widely supported?
sound – requires its own industry standards. The detail This is the reason that the AVI format is still the most
about encoding methods used for this is outside the popular format.
scope of our syllabus. The key issue is that there is correct • overheads: This refers to the difference in file size
synchronisation between the picture display and the between two files with the same content in a different
accompanying sound commentary. container. For a two-hour film, an AVI file may be up to
The current popular multimedia container formats include: 10 MB larger than a file in Matroska format.

• AVI (standard Microsoft Windows container) • support for advanced codec functionality: Older
formats, such as AVI, do not support new codec
• MOV (standard QuickTime container) features, such as streaming media.

Summary Vector graphics are constructed using drawing


objects selected from shape libraries provided by
Numbers can be written using a binary, denary or
the software. Each object has a set of properties
hexadecimal base.
which are stored as part of the vector file.
Two’s complement is a representation which
Sound is encoded as samples taken from the
allows both positive and negative integers to be
analogue source with a set sampling rate. The
represented.
number of bits used to encode each sample (the
Binary-coded decimal (BCD) is a coding system sampling resolution) determines the sound quality.
used for positive integers.
Video is made up of a sequence of image
Images can be encoded as a bitmap, made up of frames with an accompanying sound track. The
a rectangular grid of pixels. The file header will encoding can be interlaced or progressive. Various
contain data about the image: its height, width multimedia formats are used commercially. These
and the type of bitmap. Bitmap resolutions are formats may uses compression techniques to
monochrome, 16 colour, 256 colour and true address spatial and temporal redundancy.
colour. From the resolution and the dimensions,
Compression techniques use either ‘lossy’ or ‘lossless’.
the file size can be calculated.
One lossless technique is run-length encoding (RLE).

10
Exam-style questions

Chapter 1 Information representation


1 Binary representation is used for many different data values.
Consider the binary pattern 1010 0110
What is its value if it represents:
a an 8-bit two’s complement integer? [1]
b an 8-bit sign and magnitude integer? [1]
c a hexadecimal number? [1]
Cambridge International AS and A Level Computing 9691 Paper 33, Q2 a Nov 2012
2 a i Convert the hexadecimal number 7A to denary. [1]
ii Convert the binary number 0101 1100 to hexadecimal. [1]
iii Why do computer scientists often write binary numbers in hexadecimal? [1]
b The diagram shows a program loaded into main memory starting at memory address 7A Hex.
Main memory
(contents shown in
Address Hex.)
7A 2150
7B A351
7C A552
7D FFFF

90 003C

How many bits are used for each main memory location? [1]
Cambridge International AS and A Level 9691 Paper 31, Q3 b & c (i) Nov 2013

11
Unit 11
Communications and Internet technologies
Chapter 2

Revision objectives
By the end of the chapter you should be able to:
explain the client–server model of networked explain the difference between a public IP
computers and give examples of applications address and a private IP address and the
describe what is meant by the World Wide Web implication for security
(WWW) and the Internet explain how a uniform resource locator (URL)
explain how hardware is used to support the is used to locate a resource on the World Wide
Internet: networks, routers, gateways, servers Web and the role of the Domain Name Service

explain how communication systems are used describe the sequence of events executed by a
to support the Internet: the Public Service client computer and a web server when a web
Telephone Network (PSTN), dedicated lines, cell page requested and displayed by a browser
phone network recognise and identify the purpose of some
explain the benefits and drawbacks of using simple JavaScript code
copper cable, fibre-optic cabling, radio waves, show understanding of the typical use of client-
microwaves, satellites side code in the design of an application
show understanding of bit streaming (both real- recognise and identify the purpose of some
time and on-demand) and the importance of bit simple PHP code
rates and broadband speed show understanding that a web application for
explain the format of an IP address and how accessing database data makes use of server-side
an IP address is associated with a device on a scripting
network

2.01 Networks • File server: All software and user data files could be
stored on the server. Alternatively the application
Most networks used for business applications are server software can be installed on the client, then requests to
based. the server are for data files only.

In a server-based network, a dedicated server provides for • Domain controller server: This server is used for the
the administration of users, security and resources. There management of user accounts – IDs and passwords. The
may be a single server which carries out all tasks. client computer software will send a log-on request to
the server, which processes it and grants the request if
The server is a computer which provides the the user ID and password are recognised.
administrative tools and resources which are shared by all
computers on the network. • Email server: This server is used for sending, receiving
and storing emails. A ‘sent email’ is sent to the server
for processing and forwarding to the Internet Service
Client–server model Provider. When the client computer requests ‘receiving
email’, the email server sends the request to the server
A client computer application will access various resources of the email provider.
and services provide by a server. • Print server: This server manages print jobs from
There are many types of server, all named after the service network client computers.
they perform. For the most common network applications • Database server: This server manages a database
required by users, this will include: management system such as mySQL or SQL Server.

12
• Web server: This server manages pages available from a The World Wide Web (WWW)

Chapter 2 Communications and Internet technologies


website. The World Wide Web consists of content organised as
web pages made available across the Internet from web
servers. The WWW was the invention of computer scientist
LOOK FORWARD ›› Tim Berners-Lee in 1989 and uses three key concepts:
HyperText Markup Language (HTML), Uniform Resource
Database management systems are discussed in Identifier (URI), Hypertext Transfer Protocol (HTTP).
Chapter 8.

TERMS
HyperText Markup Language (HTML):
The tasks done by a server are varied, but they all have in the publishing format for all web content; it
common: provides for formatting documents and links
• The client computer makes a request to the to other documents or resources
appropriate server. Uniform Resource Identifier (URI): a unique
• The processing of the request is carried out on the address for a resource on the WWW
server. Hypertext Transfer Protocol (HTTP): a
• The server packages the results in a form which is protocol to allow for the retrieval of linked
displayed by the client computer’s software. resources from across the WWW

The Internet and the World Wide The WWW has changed the way we teach and
learn, research information, buy and sell products and
Web communicate globally with others.
The Internet
TIP

The Internet is a global communication infrastructure The terms ‘Internet’ and ‘World Wide Web’
which links together computers and networks. are loosely used and are often thought to
It forms a collection of connected internets and is a be the same – they are not.
packet-switched network. All network traffic is made up
of packets of data with a source address and destination
address. There will be a large number of available paths for
the transmission of any data packet.
Hardware to support the Internet
The communications methods used are various, including Networks
wired, radio and satellite communications. A local area network (LAN) is made up of a set of
The Internet is an open network. Access to it is provided computers which can communicate across the network.
by a company called an Internet Service Provider (ISP). For example, a computer can communicate with a
The Internet protocol used is TCP/IP where all devices file server device, a print server or a user using email.
which connect to the Internet are identified by an IP Network users will want to use the Internet to access
address. content available from the WWW.

Routers
LOOK FORWARD ›› A router is used on a packet-switched network. Data is
organised into packets for sending between the various
IP addresses are discussed in Chapter 2, section 2.02. devices. The common protocol used is TCP/IP and
the routing of packets is done by giving each packet a
destination address.
The Internet is also a transit network that moves data.
The Internet allows anyone to access, retrieve, process
and store all manner of information (e.g. voice, video,
documents, images) in a digital format.

13
some leasing agreement. This contrasts with the shared
Chapter 2 Communications and Internet technologies

resources of the PSTN and Internet.


LOOK FORWARD ››
Typical business uses include:
IP addresses are discussed in Chapter 2, section 2.02. • linking corporate offices to the Internet.
TCP/IP is discussed in Chapter 14. • connecting the LANs of several corporate offices to
form a wide area network (WAN) that allows offices
to communicate and share IT resources.
Gateways
A gateway is the hardware device need to allow two Dedicated lines have major advantages which impact on
networks which use different protocols to communicate. the applications which are possible:
A network gateway can be implemented completely in • consistent data transfer speeds.
software, completely in hardware, or as a combination of
both. • high and consistent bandwidth: the bandwidth available
to most Internet users drops at peak times, when other
Because a network gateway, by definition, appears at the customers of the same ISP are attempting to connect.
edge of a network, related capabilities such as firewalls
tend to be integrated with it. On home networks, a • high data throughput and fast upload speeds.
broadband router typically serves as the network gateway Dedicated lines offer major speed advantages compared
providing access to the Internet. to broadband. A UK broadband connection offers
around only 12 Mb/s downstream and 1 Mb/s upstream.
In contrast, a high-capacity dedicated line can provide a
Servers
connection speeds of up to 10 000 Mb/s (10 Gb/s) for
A list of the typical servers used by various computer both uploads and downloads.
systems were given earlier.
This enables a dedicated line to:

Servers • carry phone calls


Progress check 2.01
A list of the typical servers used by various computer • allow lots of staff to connect simultaneously to their
Explain
systems the given
were difference between the World Wide
earlier. work computers from home
Web and the Internet.
• carry video transmission without buffering and signal
degradation.
Communication systems to support
Cell phone networks
the Internet
The name come from the land mass being divided into
The Public Switched Telephone Network (PSTN) areas called ‘cells’. Each cell is served by at least one
transceiver or base station. The cells are usually hexagonal
The Public Switched Telephone Network (PSTN) was
in shape and the base station for each cell uses a different
designed for two-way voice communication.The concept was
frequency range to that of any of its neighbouring cells.
to create a dedicated line or circuit between two end-points.
The large capacity using a cellular network is made
Over time, the telephone network has grown to support
possible because the same frequency can be used:
more users and end-points through a network of
switches; thus the concept of circuit switching was born. • by multiple callers in any cell
This revolutionised voice communications and telephone
• in non-adjacent cells.
network design, creating the PSTN architecture that is still
in place today. The most common usage of a cell network is a mobile
phone network which provides for communication from
This established a system in which each usage of the
a portable mobile phone to the base station with radio
network required a ‘call setup’ stage, in which a connection
waves. Since radio waves travel in straight lines a large land
or circuit was established between the two end-points.
mass is divided into smaller cells, where necessary, to avoid
a ‘line-of-sight’ signal interruption.
Dedicated lines
Radio waves have the longest wavelength and the lowest
A business may prefer to use a communication line which frequencies. The ability to focus a beam decreases with
is dedicated for use by its computers only. It will purchase increasing wavelength. Radio waves broadcast in all
a dedicated line from a telephone company under directions and are least affected by obstacles.
14
Uses of coaxial cable include:

Chapter 2 Communications and Internet technologies


Progress check 2.02 • connecting a radio or television receiver/sender and an
aerial
1 What do the initials PSTN stand for?
• computer network connections
2 A business is based on a number of UK sites. List
advantages to the company of using dedicated • cable television connections.
lines for all its digital communications.
An advantage of coaxial cable is that the signals are
unlikely to be affected by electro-magnetic interference
from other metal objects in close proximity.
Communication media A bus network uses either twisted-pair or coaxial
cabling.
Copper cable
Copper cabling comes in different forms.
Fibre-optic cable
Up to 24 glass strands are grouped into a single fibre-
TERMS

Twisted-pair cable: a pair of copper cables, optic cable. Pulses of light are used to transmit a
twisted together signal along a single strand as a modulated light beam.
Coaxial cable: a cable with a central single Because the medium for communication is light – rather
strand wire than electrical signals – the data should be free of
interference and also less susceptible to unauthorised
access.
Twisted-pair cable is a pair of copper cables, twisted Fibre-optic cable has many advantages over copper wire:
together. This is designed to cancel out electromagnetic
interference. • The signals will be free of any interference.

Twisted-pair cable is available in several specifications • Signals do not suffer from a loss of strength
– the simplest is made up of two insulated copper (attenuation).
wires surrounded by the external insulation. One of the • The cabling does not suffer from corrosion.
Ethernet networking standards uses a cable with four
twisted-pairs (called ‘Cat-5’) which supports a maximum Typical applications include any form of long-distance
cable segment length of 100 metres. communication including:

All forms of copper wiring suffer from a loss of signal • telephone communication
strength proportional to the cable length. The shielding • Internet communications
screen is used either as a return path for the signal or as a
• networking.
form of screening to eliminate forms of electro-magnetic
interference.
Coaxial cable has a central single strand wire which is Telecommunications and the electro-
insulated from the outer multi-strand wire mesh braided
around the central insulation. Coaxial cable is also available
magnetic spectrum
in a number of specifications. All forms of telecommunications include some form of
The most widely used bus networking standard for electro-magnetic wave, acting as the signal carrier, and a
the physical layer is called Ethernet. This has developed form of modulation for the signal when the carrier wave
standards based on the transmission speeds called is made to change to represent different signals and hence
10BASE-T (transmits at 10 Mb/s), 100BASE-TX different data.
(100 Mb/s) or 1000BASE-T (1000 Mb/s, i.e. 1 Gb/s).
If two humans communicate by talking, the carrier is a
sound wave and the range of frequencies possible with
LOOK FORWARD ›› a sound wave will limit the possible signals. The same
is true for electro-magnetic communication. Each form
will have a range of frequencies which are possible with
Protocols are discussed in Chapter 2, section 2.02. corresponding benefits and drawbacks which make them
suited to particular applications.

15
Radio waves The range of applications of wireless communication is
Chapter 2 Communications and Internet technologies

Radio waves have the largest range of wavelengths and now widespread and includes:
include AM radio (around 400 m), television (40 m) and • communication for a local area network
FM radio (around 4 m).
• smartphones and other portable devices.
Radio waves are used for:
• domestic antennae receiving television signals sent from
the TV broadcaster radio mast Progress check 2.03
• sending/receiving of mobile phone communications. State two advantages of using fibre-optic cabling
rather than copper cable.
Microwaves
Microwaves have wavelengths measured in centimetres.
Bit streaming
Unlike infrared and visible light, microwaves can penetrate
haze, light rain and snow, clouds and smoke. For this A bitstream is a sequence of bits, representing a stream
reason, satellites which capture pictures of the earth use of data. The sequence of bits will be transmitted
microwave communication. continuously over a single channel. The bits are
transmitted serially, one after the other. The bits probably
Infrared waves originated from software as a sequence of bytes and so
the terms byte stream or octet are also used. The bytes
Infrared waves occupy the range of wavelengths between
could represent any form of digital data – a sequence of
microwaves and visible light. The range of wavelengths
text characters, pixels from a picture or video clip, or a
varies from the size of a pin-head to the size of a cell;
sound file.
they are measured in a unit called a ‘micron’, which is one
millionth of a metre.
The shorter infrared ranges are the wavelengths used for
TERMS

remote control signals between a controller and a device


bitstream: a sequence of bits, representing a
such as a television.
stream of data

Satellite communication
Artificial satellites orbiting the earth provide
telecommunications between the satellite and receiving/
Real-time bit streaming
sending stations.
The Sky satellite channel in the UK now has the
Applications are numerous and varied: facility to allow a subscriber to watch live television
• satellite radio and television broadcasting on a device such as a personal computer, tablet or
smartphone.
• photography of the earth
The device needs the appropriate software or app. The
• satellite-based Internet communication channel will be a wireless connection for a
• satellite phones PC, smartphone or tablet or a 3G or 4G connection for a
smartphone or tablet.
• military communications.
The BBC in the UK provides a similar facility – called
BBC iPlayer – for the viewing of (some) live television
Wireless
programmes and a service for listening live to its radio
Communication can use any of the wavelengths: radio, broadcasts.
microwave or infrared. The term ‘wireless’ has come to be
used to describe any form of data communication which is
‘without wires’. On-demand bit streaming
Wi-Fi is the term for the industry standard IEEE.802.11. Both Sky and the BBC offer the facility to ‘catch up’ on
Wi-Fi hotspots are now popular, for example, as a way of broadcasts that the user has missed. The user can select
attracting custom to a cafe. programmes which have already been broadcast.

16
The bitstream is saved to the device’s secondary storage

Chapter 2 Communications and Internet technologies


and can be watched by the user when convenient. Other LOOK FORWARD ››
providers, such as Netflix, offer a large selection of films
which can be provided ‘on demand’.
The network class identifiers are discussed in
Chapter 14.
Issues with bit streaming
The TCP/IP protocol suite is also studied in
On-line forums are awash with queries about bit
Chapter 14.
streaming. The most common problems are about the
connectivity of various devices, the software to provide
the service and the quality of the service. Internet traffic has no dedicated path; there is no single
The content may be subject to a pause in the delivery of interconnection point or fixed network hierarchy as used
the picture or sound before it resumes. The reasons for by the PSTN. Individual data packets may take different
this is that the bitstream will be directed into a storage routes over separate networks as they travel to their
area on the device called a buffer. The data stream is final destination to be reassembled and delivered to the
processed by the viewing software and appears as a requesting computer and application program. This is
sequence of picture frames. unlike circuit switching which relies on physical, point-
to-point connections. On the Internet, data is placed in
The factors which determine if this results in a satisfactory
packets with an IP address for the packet’s destination and
experience for the user are:
an IP source address.
• Can the communication channel deliver the bitstream
An IP address is a four-byte number usually written in
at a sufficiently high rate? Broadband providers suggest
denary, for example, 192.168.4.7. This is called the ‘dotted
this requires a download speed of 3 Mb/s or higher.
decimal’ notation. The address can also be written as
• Can the software process and display the content of ‘dotted hexadecimal’ or ‘dotted binary’.
the buffer at a high enough speed? The two key factors
here are the speed at which data is retrieved from the
hard disk and the specification of the processor inside Internet Protocol Version 6
the device.
In 2011, the IP version 4 address space was finally
exhausted – all 4 billion Version 4 IP addresses had been
2.02 IP addressing allocated. However, the ever-increasing number of Internet
users had given concerns about ‘address space exhaustion’
Using the Internet Protocol (IP), networks are joined earlier. This gave rise to a new standard, Internet Protocol
into a network of networks through interconnected Version 6 (IPv6), which was adopted for the first time in
gateways or routers that use the standard protocol suite – 2006.
Transmission Control Protocol/Internet Protocol
(TCP/IP) for interworking. IPv6 increases the address length to 128 bits, providing a
vastly greater address space.
Most Internet traffic is still using Internet Protocol
version 4 for addresses. This uses 32 bits for an IP The immediate issue is that host devices which only
address – expressed as four numbers in the range 0–255, recognise IPv4 addresses cannot directly communicate
separated by full stops. with IPv6-only hosts. Migration to IPv6 is in progress but
completion is expected to take some considerable time.
The original addressing for networks used the first byte for
the Network ID and the other bytes for the host identifier.
This quickly proved inadequate and lead to a system of
defined classes, where a variable number of bits is used LOOK BACK ‹‹
for the network identifier. The system defined five classes
(A, B, C, D and E). Classes A, B and C use different bit This is an application of the number systems studied in
lengths for network identification. Chapter 1.
The Class formats impose some restrictions on the
available addresses; for example, a Class C address is not
allowed to use host numbers 0 or 255.

17
DNS server to determine the server’s IP address. If the
Chapter 2 Communications and Internet technologies

DNS server does not contain the mapping, it will forward


Progress check 2.04 the request to a different DNS server at the next higher
level in the hierarchy. Further forwarding of the request
1 How many bits are used to encode an IPv4 may be needed before the URI is resolved.
address?
2 Write the denary value for the following IP
address: 11111111.10101000.00000100.00001101. LOOK FORWARD ››
3 Explain why 259.168.7.8 cannot be a valid IP
address. If you are running the Windows operating system, key
into a command prompt window ‘ipconfig’ to see all
the settings on your computer for Internet access.
Domain name service
A web browser requests a resource using the known An IP address can be thought of as a private or public
URI. What is usually not known by the user is the IP address. Any device on a Local Area Network will
matching IP address for this resource. Therefore, have a private (or non-routable) IP address allocated by
somewhere on the Internet, the IP address must be the Network Administrator. This is sufficient if the only
‘looked up’ from the URL. This is the role of the Domain communication is between host devices on the LAN. If
Name Service (DNS). however a computer needs to access a resource using the
Internet, the device needs to know the public address of
Once the IP address is known, it is the function of
the server holding the resource. Every resource on the
hardware called routers to route the data packets to the
Internet must have a globally known and unique IP address.
receiving device.
As there is a shortage of IPv4 addresses, devices on the
Because maintaining a central list of domain names LAN are allocated a private IP address.
and IP addresses mapping would be impractical, the
The three ranges used for private addresses are:
lists of domain names and IP addresses are distributed
throughout the Internet in a hierarchy of authority. The 10.0.0.0/8
DNS database resides on a hierarchy of special database 172.16.0.0/16 to 172.31.0.0/16
servers. 192.168.0.0/24 to 192.168.255.0/24
At the top level of the hierarchy, root servers store a This will be a requirement for any of the devices on the
complete database of Internet domain names and their LAN; they will communicate to the Internet through a
corresponding IP addresses. The Internet employs 13 proxy server and firewall which has a single public (or
root servers that have become somewhat famous for routable) IP address. All data packets whose destination
their special role. Maintained by various independent in a device on the LAN will arrive using the LAN’s public
agencies, the servers are aptly named A, B, C and IP address. It is then the role of the proxy server to route
so on up to M. Ten of these servers are sited in the the data to the appropriate device.
United States, one in Japan, one in London and one in
Stockholm.
Most lower-level DNS servers are owned by businesses
2.03 Client-side and server-
or Internet Service Providers (ISPs). For example, Google side scripting
maintains various DNS servers around the world for
management of google.com, google.co.uk and other Google Before we start talking ‘scripting’ (that is ‘programming’),
domains.Your ISP also maintains DNS servers as part of let’s get clear what the web server and the computer on
your Internet connection setup. There is probably a DNS which it is running must do.
server within close geographic proximity to your access The web server must be ‘hosted’ on a host computer. The
provider that maps the domain names used in your Internet web server uses the HTTP protocol to:
requests or forwards them to other servers in the Internet.
• receive request messages from client computers
When a client web browser requests a resource with a
URI, a piece of software called the DNS resolver (usually • deal with each request
built into the network operating system) first contacts a • send a response message back to the client.

18
The web server will continually listen for ‘request 1 The client web browser application requests the page

Chapter 2 Communications and Internet technologies


messages’ and then respond to the client computer with a using the URI.
‘response message’.
2 The DNS directs the request to the appropriate
The host computer must have an operating system which domain.
supports the TCP/IP communications protocol. It deals
3 The server retrieves the page.
with all the communications between the web server and
the client. 4 The server sends the page content, consisting of HTML
tags and text content only, to the client.
5 The client web browser software ‘renders’ the page and
–Requesting data from a database displays it.
server However, the content may need to change each time the
page is requested; that is, the page has dynamic content.
Users working with a database send requests to the
For example, a web page may display today’s date or may
server for information, as shown in Figure 2.01.
be used for data entry.
For example, a user will create and run a query which is
The inclusion of dynamic content requires that the webpage
held on the client computer. The query is turned into an
contains a ‘script’, that is, program code, which determines
SQL request which is sent to the server.
some or all of the final content displayed on the page.

1. Client requests data


(SQL query)

Client SQL code


2. Query is
processed at the
server by DBMS
3. Query results are sent software
back to the client computer
Client Client
DBMS
server

Figure 2.01 Request to a database server

The server processes the SQL request received and the


results of the processing are then sent back to the client
computer.
Progress check 2.05
State the sequence of steps when a client web
Note, all processing is done at the server.
browser requests a page which contains no program
code from a web server.
–Requesting web pages from a web
server
Client-side scripting
Web pages are constructed using the HTML markup
language. This is not a programming language but – as Using client-side scripting, the dynamic content is
it says – the HTML tags ‘mark up’ the text and graphics processed when the web page is received by the client
content to determine how it will appear to the user. web browser. The popular languages used for client-side
programming are JavaScript (the Microsoft version is called
For many pages the content is only HTML tags, so the
JScript) and VBScript.
request sequence is:

19
The use of client-side scripting assumes that the client • This code does not contain any structures such as ‘if ’
Chapter 2 Communications and Internet technologies

web browser is configured to support this. The ability to statements or a loop.


interpret JavaScript code is a feature of all the popular
• The alert keyword causes a dialogue box to appear
web browsers – Internet Explorer, Chrome, Opera and
to the user.
Firefox.
JavaScript is a third-generation programming language.
You are not expected to learn JavaScript or

TIP
The code is embedded in a web page with all the
any client-side scripting language or a server-
HTML tags which determine the page’s format and
content. side language such as PHP in preparation for
the examination.
All programming languages must be either compiled or
interpreted. JavaScript program code statements are You should, however, be able to study a
interpreted, either when the web page is loaded or later, JavaScript program and understand its
in response to some event taking place (e.g. the user clicks construction. You will need to use the
on a button on the page). skills you have learnt from Section 2 to
understand some JavaScript and PHP
Figure 2.02 shows an example of a web page containing program code: using variables, sequence,
JavaScript. selection and iteration.

The JavaScript code in Figure 2.03 illustrates the dynamic


nature of a web page. It includes the four basic high-level
language constructs.
The program in Figure 2.03 produces the sequence of
interactions with the user shown in Figure 2.04.

Progress check 2.06


State the sequence of steps when a client web
browser requests a page which contains JavaScript
program code from a web server.

JavaScript code is used for:


• interacting with the user
• accepting data input from the user
• validating data input and other actions: for example,
if an important field has been left blank, we need to
address this before ‘posting’ the data to the server for
Figure 2.02 Simple JavaScript code processing or storage
• manipulating images, for example, changing the image
Study Figure 2.02 and you should be able to deduce: displayed when the mouse does a ‘roll over’ on an
image.
• The JavaScript program statements are lines 12, 13 and 14.
The code in Figure 2.03 is a simple example of validation
• The alert keyword causes a dialogue box to appear
of a number entered by the user.
to the user.
• This code uses no variables.

20
Chapter 2 Communications and Internet technologies
The <Script> tag marks the start
of the program code at line 11 
The while loop starts here; there is
no endwhile keyword – curly brackets
The var keyword is are used to enclose the loop statements 
followed by variable identifier 
The prompt keyword is used
to get input from the user

isNaN is a JavaScript built-in function


The if selection statement also uses
which tests for ‘is not a number’
curly brackets to enclose statements

The alert keyword is used


to output to a dialogue box

Figure 2.03 Client-side JavaScript code

Figure 2.04 The dialogue from the code in Figure 2.03

21
Chapter 2 Communications and Internet technologies

Progress check 2.07


Study the script in Figure 2.05.

Figure 2.05 Sample JavaScript code

1 What line number is the start of a count-controlled loop?


2 Explain how the syntax of the count-controlled loop works.
3 What line effectively marks the end of the loop?
4 What will be the output if the user keys in the sequence of numbers 39, 42, 38?
5 Which statement contains both the declaration and assignment of a value to a variable?
6 List the variables used in the script.

Server-side scripting
Contrast the following sequence of actions with the sequence given earlier for client-side scripting.
If the web page contains a script which is to be executed on the server:
1 The web browser requests the page.
2 The web server is aware it contains code.
3 The web server processes the code (on the server).
4 The web server renders the page content (as HTML tags and text only).

22
5 The web server delivers the page to the browser (as HTML tags and text only).

Chapter 2 Communications and Internet technologies


6 The client browser displays the page.
Figure 2.06 shows some PHP server-side code and its output in a browser. It is not really useful as the data values are hard
coded within the PHP code.

The start of the PHP code

Variable identifiers start with $

The Echo keyword


outputs to the screen

(a)

(b)
Figure 2.06 (a) PHP server-side code and (b) its output in a browser

When we access a web page with JavaScript, the web page is simply loaded or requested from the file
TIP

system of the computer (Figure 2.04 shows the file path on drive C).
To display a web page which uses server-side scripting, the user’s computer must retrieve the page from a
web server. The usual development environment to do this is to set up a ‘local server’ on the computer. The
author has installed the WAMPP application, which then has the Apache web server running, with a path to
its root folder of ‘localhost’. Note the path displayed in the address bar of the browser in Figure 2.06(b).

23
in Figure 2.08. When the Submit button is clicked, the data
Chapter 2 Communications and Internet technologies

Progress check 2.08 is sent for processing (Figure 2.09) by another form.

1 State the essential difference between the use of


JavaScript and PHP.
2 State the sequence of steps when a client web
browser requests a page which contains PHP
program code from a web server.

A database JOBS is created to store data for all current


jobs at a company. The database has a table JobList with
the structure shown in Figure 2.07.

Figure 2.08 Web data collection form


The processing form (Database 2.php) contains a
PHP script (Figure 2.10) that processes the data for the
new job:
1 Data is collected from the first form and the three data
items are stored in variables.
Figure 2.07 Table attributes for JobList
2 A connection is made to the database.
The user will enter data for one job into a web data
collection form (HTML only with form controls) as shown 3 The server process a SQL command to insert the
record to the database.

Data values are posted to a second


web page, Database 2.php

This form control is a text box


– identifier txtJobTitle

This form control is a
button – identifier Submit 

Figure 2.09 ‘Posting’ data from the form

24
Make a connection to the

Chapter 2 Communications and Internet technologies


web and database server 

Check for successful
connection 

Connect to the Jobs database

Assign data values from the


data entry form to variables

Execute an SQL command to add


the record to the JobsList table

Figure 2.10 Processing the PHP script

Summary Bit-streaming is used to access content from


servers to provide video and sound to users
Most network applications use the client–server
either on-demand or in real time.
model. Applications include database, email, file
transfer and web servers. The packet-switching network on the Internet
uses IP addressing. An IP address can be either
The Internet is the hardware infrastructure –
private or public.
consisting of routers, gateways and networks –
which supports global communication. The World Resources available on the WWW are identified
Wide Web is the content which is available from using a Uniform Resource Locator (URL). The
various web servers. Domain Name Service has the task of mapping all
URLs to an actual IP address.
Various communications systems support the
Internet including: the Public Service Telephone Web pages can contain program code in addition
Network (PSTN), dedicated lines and the cell to HTML tags. This code is processed either by
phone network. the client computer (‘client-side scripting’) or on
the server (‘server-side scripting’). JavaScript is
Communication signals use copper and fibre-optic
used for client-side code; PHP is used for server-
cabling, radio waves, microwaves and satellites.
side code.

25
Exam-style questions
Chapter 2 Communications and Internet technologies

1 The website www.checkyourwellbeing.com offers help and advice about personal well-being.
The website has a link – ‘Calculate my BMI’ – that users can click to work out their Body Mass Index.
When the ‘Calculate my BMI’ link is clicked on the client computer, this webpage is requested:
1 <html>
2 <head>
3 <title>Body Mass Index</title>
4
5 </head>
6
7 <body>
8 Calculate my body mass index
9
10 <Script Language = "JavaScript">
11
12 var myWeight = prompt("Enter your weight (in kg.)", "");
13
14 var myHeight = prompt("Enter your height (in m.)", "");
15
16 var myBMI = myWeight / (myHeight * myHeight);
17 myBMI = myBMI.toFixed(2)
18
19 alert("My calculated BMI is ..." + myBMI) ;
20
21 if (myBMI < 18.5)
22 {
23 alert("UNDERWEIGHT") ;
24 }
25
26 if (myBMI > 25)
27 {
28 alert("OVERWEIGHT") ;
29 }
30 if (myBMI >=18.5 && myBMI<=25)
31 {
32 alert("WITHIN RANGE")
33 }
34
35 </Script>
36
37 </body>
38 </html>

26
Loading the webpage produced this sequence of dialogue boxes:

Chapter 2 Communications and Internet technologies


a Which lines in the webpage script are JavaScript code? [1]

b i Give the identifiers of two variables which have been used by the programmer.

2 [2]
ii What group of program statements are performing selection?

line number up to line number [1]


c By studying the web page script and its use, what is the use in JavaScript of:
i the prompt function? [2]

ii the alert function? [2]

27
d The diagram shows the client computer network with the connection to the Internet.
Chapter 2 Communications and Internet technologies

Client computer

Network file server

Internet

www.checkyourwellbeing.com
web server

What is the hardware device labelled X? [1]

e Put five of these statements in the correct sequence to describe how the content of the page shown is
displayed by the client computer’s browser software.
Two of the statements will not be used.
A The client computer processes the JavaScript code.
B The page content is transmitted to the client computer.
C The page is displayed on the client computer.
D The user clicks on the hyperlink and the web page is requested from the network file server.
E The web server processes the JavaScript code.
F The user clicks on the hyperlink and the web page is requested from the
www.checkyourwellbeing.com web server.
G The server finds the web page.
The sequence is: (fill in the letters)

f How is this JavaScript code run? [1]

28
g The web developer tested the JavaScript code without involving the web server.

Chapter 2 Communications and Internet technologies


Explain how this is possible. [1]

Cambridge International AS and A Level Computer Science 9608 Specimen Paper 1, Q4 2015

2 a What does URL stand for? [1]


b Name the component parts of the URL shown:
h t t p : / / w w w. w 3 s c h o o l s . c o m / t u t o r i a l s / s q 1 / i n d e x . h t m [4]

A B C D

29
Hardware
Chapter 3

Revision objectives
By the end of the chapter you should be able to:
identify hardware devices used for input, output, explain the differences between static RAM
secondary storage (SRAM) and dynamic RAM (DRAM)
show understanding of the basic internal understand and use these logic gates: NOT, AND,
operation of a keyboard, a hard disk, a trackerball OR, NAND, NOR, XOR
mouse, solid state (flash) memory, an optical
construct the truth table for each of the logic
mouse, optical discs, a scanner, sensors, an inkjet
gates
printer, actuators, a laser printer, speakers
construct a logic circuit from either a problem
show understanding of the need for secondary
statement or a logic expression
(including removable) storage
construct a truth table from either a logic circuit
show understanding of the need for primary
or a logic expression
storage
show understanding that some circuits can be
explain the differences between RAM and ROM
constructed with fewer gates to produce the
memory
same outputs

3.01 Input, output and storage On a typical PC computer, the following would be the
various devices:
devices • Input: keyboard and mouse
One of the fundamental diagrams (see Figure 3.01) to • Output: the monitor
describe a computer system is to distinguish between the
• Secondary storage: the hard disk or a solid-state drive
input devices, the output devices, the processing which
various programs will carry out and the need for both • Main memory: memory chips inside the box
primary and secondary storage.
• Processor: the microprocessor inside the box

Secondary
memory

Input Output
device Processing
device

Primary (main)
memory

Figure 3.01 Typical computer system

30

You might also like