0% found this document useful (0 votes)
19 views

Math

Uploaded by

Javid Gurbanov
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
0% found this document useful (0 votes)
19 views

Math

Uploaded by

Javid Gurbanov
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/ 16

COMPUTINGAT SCHOOL

EDUCATE · ENGAGE · ENCOURAGE


In collaboration with BCS,The Chartered Institute for IT

COMPUTE-IT
COMPUTING
FOR KS3

MARK DORLING
AND GEORGE ROUSE
Series Editors

~ DYNAMIC
,, HODDER
~LEARNING
EDUCATION i
LEARN MQRE,
.'
_J
Contents

lntroduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iv

Unit I Under the hood of a computer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Unit 2 Think like a computer scientist 14

Unit 3 Drawing and manipulating shapes 30

Unit 4 Creating an animation 42

Unit 5 The foundations of computing 54

Unit 6 How the web works 66

Unit 7 Web page creation from the ground up 82

Unit 8 Designing for HCI: a hand-held digital device 98

Unit 9 Designing for HCI: an operating system interface . . . . . . . . . . . . . 108

Unit 10 Representing images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

Unit II Programming a calculator 130

Unit 12 Programming a quiz 140

Glossary/index 152

Acknowledgements 156

111
lntroduction
Computing drives innovation in the sciences, in engineering, business,
entertainment and education. It touches every aspect of our lives from the
cars we drive to the movies we watch and the way in which businesses and
governments communicate with and hear from us.
An understanding of Computer Science is essential if you want to keep up
with changing technology and take advantage of the opportunities it offers in
your life - whether it's as a career or a way of problem solving, or as a way of
providing you with a greater appreciation of the way things work.
Computing is a relatively modern are a of study but its roots go back to ancient
times when our ancestors created calculating devices - long before modern-
day calculators carne into being. As you'll see, computer science also has a rich
history of innovation and design.
While it is almost impossible to accurately predict what technological
developments will happen next, there are underlying Computer Science
concepts and principles that lead to future developments. These can be
recognized and applied by people who work in computing.
Computational Thinking is one of these processes and it underpins all the
learning in this Student Book. This should provide you with an approach to
problem solving that you will be able to use in relation to a wide range of
computer-related and non-computer related situations. By studying Computer
Science you will develop valuable skills that will enable you to solve deep,
multi-layered problems.
Throughout this Student's Book we have described the processes that led to
the development of major ideas and systems. This will give you a much better
understanding of how computing has come to be as it is today. We look at the
development of computing through time, from ancient calculating devices
to modern technology, highlighting how each break through or development
has contributed to modern Computer Science. We look at the elements that
make much of the technology we all take for granted today actually work, and
we look at how you can apply this knowledge and these skills to computing
challenges.

IV
Each unit in the Student's Book centres around a challenge and, in arder to
gain the knowledge and skills you require to complete each challenge, you will
come across three different types of activity:
• Think-IT: These are thinking and discussion activities to get you
thinking about ideas and concepts.
• Plan-lT: These are planning exercises that set the scene for the
practical activities.
• Compute-IT:These are the practical computing or 'doing' activities
that will allow you to apply the skills and knowledge that you have
developed within the unit.
We hope that you enjoy the challenges we have set you and your study of
computing.

Mark Dorling and George Rouse

V
Challenge
• Key Terms Your challenge is to learn to 'think' like a
computer, and understand how computers
Data: A collection of facts
process data.
without context, such as
values or measurements.
On a computer 'data' can
be stored as files, emails,
video games, songs, pictures, III Under the hood of a
data logged by sensors and
computer
calculations carried out by
the central processing unit
To compute
(CPU).
The word 'compute' is derived from the Latin word
Compute: The verb 'to
'computare', which means 'to count up', 'to sum up', 'to
compute' means to carry out
reckon together'. The Romans certainly did not have
mathematical calculations. computers and 'to compute' does not mean to use a
Today, with electronic computer. Computing is something that we all do whenever
computers everywhere, the we perform a mathematical calculation.
term is more commonly The electronic computer is not the first device that people
defined as 'the use of have used to help them to compute. For many centuries
computers to solve mathematicians have been inventing tools to help them to
problerns' carry out calculations with greater speed and accuracy.

A The first electronic cornputer, Colossus ..&. The Manchester Baby


2
1.1 Under the hood of a computer

A The lshango Bone A An astrolabe

A An abacus A The Analytical Engine

~
Think-lT'
1.1.1 Draw a timeline stretching from the year 18 000 BC to today.
a) Where do the computing machines in the photographs fit on the timeline?
b) Can you think of any other computing devices or machines to add to the timeline?

Since prehistoric times and the very earliest civilisations


there has been a need to compute in order to solve problems.
The ancient Egyptians used mathematics to build their
pyramids and the ancient Greeks applied geometry to their
study of astronomy. Computing is so important that great
mathematicians have always been highly revered. All over
the world they have become well-known historical figures,
such as the ancient Greek Pythagoras, Lui Hui from 3rd-
century China, Muhammad Al-Khwarizmi from 9th-century
Persia and Bhaskara from 12th-century India. You can find
more details about famous mathematicians through time at
www.storyofmathematics.com
/mathematicians.htm
1.
3
Unit I Under the hood of a computer

~
Think-lT' What is under the hood of a modern
computer?
1.1.2 List ali the computing
Traditionally we think of computers as the large desktop
devices you use at
machines that many of us regularly use at home and at school.
home and at school.
However, in recent years computers have become faster and
smaller.

~
Compute-lT
1.1.3 a) Find an old computer to take apart. Make sure the machine is unplugged before you
open the case and then examine ali the component parts in turn. As you remove each
part from the case, find out its function. Beware of sharp edges!

keyboard mouse hard disk drive CPU RAM power supply


f r~
º>,
h, .
._ . ·c.,¡:

sound card

a computer's a cornputer's a computer's display device motherboard


digital camera microphone headphones

.A The main components of a computer


b) Now look at a Raspberry micro USB power
{back of board)
Pi, the credit-card-sized
computer that you
can plug into a TV and
a keyboard. Can you
locate the processor, the H

memory, the storage and


the input and output?

e LEDs ..... The Raspberry Pi


4
1.1 Under the hood of a computer

Itis possible to categorise the parts of a computer as input


devices, memory, storage devices, processor and output
devices .

• Key Terms

.:
input
Input device: An input device enables the user to 'input' data
into a computer:
Memory: This is where a computer keeps the data that has
been input, as well as software applications and the results of any
processing it has carried out, for the short term. This memory is
lost when the computer is off
Storage device: This is where a computer stores files that have
been created, as well as software that has been installed, for the storage

longer term.
Processor: The part of a computer that processes data
according to the instructions it has been given. lt provides the user
with information.
Output device: An output device enables the u ser to receive
information from a computer.

~
Think-lT'
1.1.4 Look at the table and name as many examples of each part of a computer as you can.
Function Examples
Input Without externa! data a computer can do almost nothing. The
devices role of the input device is to 'input' data into the computer.
The computer has to keep the data that has been entered until
Memory it is ready to process it. lt also has to load software applications.
This memory is lost when the computer is off.
Files and applications need to be stored safely until the
Storage computer is ready to load them again. This data is not lost when
the computer is off.
This is the part of the computer that processes data, according
Processor to the instructions it has been given, to provide the user with
information.
Output lnformation has to be conveyed to the user. This function is
devices performed by 'output' devices.

5
Unit I Under the hood of a computer

• Key Term Central Processing Unit


The central processing unit (the CPU) is sometimes
Central processing unit
described as the computer's brain. It is an important part
(CPU): The part of the
of the computer system and it usually consists of a single
computer that interprets and
integrated circuit (chip). It isn't as complicated as a human
executes instructions.
brain though. It thinks more like a function machine,
which you might have come across in maths lessons.

• A central processing unit

The result of the processing, 19, is sent to an


The CPU has to be told what to do with the data. output device, usually a display, monitor or
The instructions usually come from software data projector, so that the user knows what
applications, which are also known as 'computer it is. Note that the instructions have to be
programs'. In the illustration there are two processed in the correct sequence,
instructions, 'multiply by 3' and 'add 7'. otherwise the result would be 33.

input
VDU
/

Q!;!~ XJ
+7
process
'-----./
19

1 1
D D
1 1
The CPU has to have sorne data to
process. This is often input using a
keyboard or a touch screen. The data is ~
stored in the computer's memory. In the
Think-lT
illustration the number '4' has been entered 1.1.5 Which interna! component of a
into the function machine's memory. computer can be regarded as a
function machine in its own right?

6
1.1 Under the hood of a computer

~
~
Compute-lT
1.1.6 Create a function machine, like the one in the picture.
Decide on an input, describe the processing that will
take place and think about the resulting output. Now
create three cards containing this inforrnation. Place the
cards face down on the function machine. Turn over the
input and output, and ask a fellow student to work out
what the processing card has on it,

When a teacher asks you to do something, you listen ~


(fetch), work out what you are being asked to do (decode) Think-lT~
and then do it (execute). A CPU works in a similar way. It:
1.1.7 What have you
• fetches the instruction from memory. learned about the
• decodes the instruction to find out what processing CPU and what it can
to do. and cannot do?
• executes the instruction.

r fetch

.Á A Fetch-Decode-Execute cycle

7
• .,- ,t

fa' • ••. _..:...,


.
' ,,.
".t",•. - . ._.
~ ''}:~'.:"' Unit I Under the hood of a computer
:-': .
'·~

18 Code breakers
Enigma and the Lorenz machine
During the Second World War vital supplies were sent
to Britain from the United States of América, but Nazi
submarines (U-boats) were sinking large numbers of the
ships bringing these supplies across the Atlantic. Winston
Churchill understood that intelligence was crucial if Britain
and its allies were to win the Second World War, and he put
his faith in the team of code breakers at Bletchley Park. Their
task was to decrypt Nazi communications. The Nazis were
enciphering their messages using the Enigma machine and
its successor, the Lorenz machine. If the Allies were able to
break the codes, they could keep one step ahead of the Nazis.

A Sorne of the code-breaking team at Bletchley Park. A The Nazis used the Lorenz cipher machine
Many of the cede breakers were women. to generate a cede that they believed was
unbreakable.

Colossus
Code breaking requires vast numbers of computations to
be carried out extremely quickly. The team at Bletchley
Park were working against the clock. Alan Turing, the
mathematician who led the tearn, knew that humans
were just too slow at performing the required volume of
calculations, so the code breakers built a computer, known
as Colossus (see the photograph on page 2), to speed things
up. Colossus decrypted codes generated by the Lorenz
Machine by carrying out complex analysis on the messages
that were intercepted. Colossus could read 5000 characters
per second. This meant that the analysis could be carried
out in hours, rather than weeks. In a sense, Colossus was a
function machine because it was programmed to perform
just one task.
8
1.2 Code breakers

It took the enciphered input, processed it and, after many


repetitions, produced the deciphered output.
A computer uses stored programs and must have
writeable memory to store, load and run them. The
Manchester Baby, developed shortly after the Second
World War, was one of the first programmable computers.
It was the ability to store and run programs that turned
the special purpose computer, or function machine, into a
general purpose computer.

The decimal number system • Key Terms


At school, you learn how to use the decimal number
Decimal: The system that
system, that is using units, tens, hundreds and thousands.
is normally used for counting
The decimal number system is also known as base 10
and computation. lt uses ten
because it uses ten different numbers - O, 1, 2, 3, 4, 5, 6, 7,
digits: O, 1, 2, 3, 4, 5, 6, 7, 8
8, and 9 - to make an infinite number of combinations.
Computers are electronic devices that use just two data and 9. The decimal number
values, O and l. They can tell the difference between a high system is also called base I O.
voltage and a low voltage, so we use high voltage to Binary: A number system
represent 1 and low voltage to represent O. Using two which uses two digits, O and
values, 1 and O, to represent numbers is known as binary 1. AII electronic computation
or base 2. All data in a computer must be in binary, so is carried out using the
anything that is to be processed or transferred between binary system. The binary
computers, including all words, sounds and images, must number system is also called
first be converted into a series of ls and Os.
base 2.

~
r-,
Compute-lT
1.2.1 Think back to when you learned to organise numbers in
multiples of ten, and then copy and complete the table.
Number Hundreds Tens Units
146 1 4 6
o o 3
5
24
o 6 5
93
131
1 7 9
2 1 3
255

9
Unit I Under the hood of a computer

Circuit semaphore
Imagine an electric circuit with three lights, each
controlled by its own switch. You can switch the lights
on in many different patterns. Now imagine that each
pattern represents a number, and each number relates to a
message in a code book.

4 2 1 ~
Think-lT
= 5 1.2.2 Look at the circuit semaphore diagram on the left.
What do you notice about the number at the top of
each column?

~
r-,
Compute-lT
1.2.3 a) Use the information contained in the circuit
semaphore diagram on the left to work out what
numbers the other four patterns of lights represent.
b) In the code book, the number 5 represents the
question, 'What is your choice of meeting point,
A, B or C?' The code book contains the following
responses: 1 = A, 2 = B and 3 = C. What pattern
of lights would an agent use to tell their controller to
meet them at point B?

A Circuit semaphore
/
lf you have three lights you
Binary can make the left-hand light
represent '4', the middle
LIGHTS
light represent '2' and the
Left Middle Right right hand light represent
Decimal
number
4 2 1 --.....____
l 'I '. A light can be 'on',
represented by a 'I', or 'off,
~

With just three lights, you


y 110

2
1
o
o
o
o
o
1
O
1

O ~L[
represented by a 'O'.

By switching on the light that"


can only represent the 3 o 1 1
r-. equals '2', and switching off
numbers O to 7, because 'O' 4 1 o O the lights that equal '4' and 'I ',
is 'ali off' and '7' is 'ali on'.' 5 1 o 1 '\..
-,
you can display '2'.'
~
6 1 1
\.
"'7 1 1 ~~
By switching on the lights
that equal '4' and 'I ', and
switching off the light that
equals '2', you can display '5'.'
10 -,
1.2 Code breakers

~
~
Compute-lT
1.2.4 a) Copy and extend the table below as required. Complete the cells for ali the different
binary combinations you can make. The first few cells have been completed for you.

I bit 2 bits 3 bits 4 bits


o 00 000
1 01 001
------------ ------------- - - - - - - - - - - - - - -

- - - - - -
Total number of I bit Total number of 2 bit Total number of 3 bit Total number of 4 bit
combinations: combinations: combinations: combinations:

b) You have seen how it is possible to count up to 7 in binary. How would you count to 8?
e) What is the largest number you can make with I bit? With 2 bits? With 3 bits?
With 4 bits?
d) What is the smallest number you can make regardless of the number of bits?
e) What pattern can you spot when working out the largest number with a given number
of bits?
f) What would you have to do if you wanted to count to 16?
g) What do you notice when you place a 'O' to the right of a 'I '?

~
Think-lT'
1.2.5 In 1836, Samuel Morse, Joseph
Henry and Alfred Vail invented a
method of using electrical signals to
A
B
e
·-
-·• 0
••- --
-- -· Q--·-
N - e

send messages using a simple on/off D


•• p ·- - •

system known as Morse code. The


code is based on the length of time
the circuit is switched on, and uses
E
F
G
--

•• -
••••


R e -
s • • •
T -
e

J·--- y-·--
H u • • -
long and short signals to represent
the letters in the alphabet. A short
I
•• V e e e -
'on' is called a dot and a long 'on' is

M--
w ·--
a dash. For example, 'dot dot dot X - e e -
K
L e -
-·- e e e
dash dash dash dot dot dot' is the
internationally recognised distress z - - ••
A lnternational Morse code
signa[, SOS.
lnvestigate other methods of sharing information through
data transfer that have been used throughout history.

11
' ,t
¡;, ' , ;i..'
~ ·;::-~
Unit I Under the hood of a computer
'. ;~~
. -"'~

Bits and bytes


Computers use electrical circuits to process data. These
circuits require the data to be in a digital form as a string
ofbinary digits, or ls and Os, A bit is the name given to
one binary digit and it is the smallest piece of data that a
computer can process.
All the data stored on, and processed by, a computer
• Key Term
is simply a long series of bits. To give an idea of scale, a
Bit: The term 'bit' is used to single letter of text, for example the letter 'a', is represented
describe one binary digit and by eight bits.
is derived from Blnary digiT You have seen how a computer represents letters and
numbers. Sound is digitised by sampling it at intervals, and
images are digitised by representing coloured dots with
binary numbers.

Kilobytes and megabytes


Many people generate computer files giving little thought
to what these files consist of and how they are stored. The
terms 'kilobyte' and 'megabyte' are used to describe the
• Key Term size of the storage space inside a computer; the amount of
Byte: A string of bits (usually memory available to store data for use when processing
eight, for example 10010101) and to store the output of the processing in the form of
is called a byte, files. The prefix 'kilo' means thousand and 'mega' means
million, so a 'megabyte' is one million bytes.

-.
Unit Size
/ Bit A binary digit, 1 or O
A 'nibble' is half a 'byte'.
l-Nibble 4 bits
Who says that computer
Byte 8 bits
scientists don't have a sense
of humour?' kilobyte (kB) 1024 bytes
megabyte (M B) 1024kB
gigabyte (GB) 1024MB
terabyte (TB) 1024GB
petabyte (PB) 1024TB

A The common units for measuring digital data, computer file sizes
and computer memory

~
Think-lT~
1.2.6 Using your understanding of bits and bytes, convert the following values, which represent
file sizes, into bits. Show your working.
a)7kB b)29kB c)279kB d)IMB e)2MB
1.2.7 The number 1024 keeps appearing. Where does this number come from?

12
1.2 Code breakers

From binary to information


In electronic computers all data items are processed in
binary. Whatever form the input data takes, computers
convert it into binary (into Is and Os) so it can be processed
by a series of electronic switches within the CPU.The
binary outputs are converted back into something that the
user can easily understand, such as text and pictures.

Challenge
Do you remember the challenge far this unit, to learn to 'think' like a
computer, and understand how computers process data? Let's put your
learning to the test.

~
~
Compute-lT
1.2.8 a) Create a plain text file. Type in the letters of the alphabet, then save the file as '/\.
Right click the file's name, select 'Properties' and record the size of the file in bytes
and bits in a copy of the table below.
b) Why do you think file A has a size of 26 bytes?
e) How muid you test your theory of why file A has 26 bytes?
d) Copy this sentence or one you make up yourself, which contains spaces and
punctuation, into a text file and save itas 'B': 'The quick, brown fox jumps over the
lazy dog. The lazy dog does not bark!' Now, copy and paste the sentence into a new
text file twice and save itas 'C'. Finally, paste the sentence into a new text file five
times and save it as 'D'. Complete the rest of the table below. What do you notice?

Character Size
File File type count (bytes) Size (bits)
A: Plain text file (letters of the alphabet) .txt 26
B: Plain text file (sentence once) .txt
C: Plain text file (sentence twice) .txt
O: Plain text file (sentence five times) .txt

e) What is the size of one letter in bits?

~
Think-lT~
1.2.9 How many average-sized reading books muid be stored
in a megabyte, assuming the files are not compressed?

13

You might also like