You are on page 1of 52

Unit 1

Principles of Computer
Science

Data

Contents
Binary ................................................................................................................................................................. 3
Understand that computers use binary to represent data and instructions ....................................... 3
Understand how computers represent and manipulate numbers....................................................... 3
Be able to convert between binary and denary whole numbers ....................................................... 3
Be able to perform binary arithmetic ....................................................................................................... 5
Understand why hexadecimal notation is used and be able to convert between hexadecimal
and binary and vice versa ......................................................................................................................... 8
Data Representation..................................................................................................................................... 10
Understand how computers encode characters ................................................................................. 10
Understand how bitmap images are represented in binary ............................................................... 13
Understand how analogue data is represented in binary .................................................................. 16
Understand the limitations of binary representation of data and how bit length constrains the
range of values that can represented ................................................................................................... 18
Data Storage and Compression ................................................................................................................. 19
Understand and be able to convert between the terms bit, nibble, byte, kilobyte, megabyte,
gigabyte, terabyte ................................................................................................................................... 19
Understand the need for data compression and methods of compressing data and that JPEG
and MP3 are examples of lossy algorithms ............................................................................................ 19
Understand how a lossless, run-length encoding algorithm works ..................................................... 21
Understand that file storage is measured in bytes and that data transmission is measured in bits
per second, and be able to calculate the time to transmit a file and storage requirements for
files ............................................................................................................................................................... 27
Understand the need for data encryption ............................................................................................ 28
Understand how a Caesar cipher algorithm works .............................................................................. 29
Understand the characteristics of structured and unstructured data ............................................... 29
Understand that data can be decomposed and organised in a structured database ................ 30
Understand the need for and be able to use SQL statements ........................................................... 31
Homework ...................................................................................................................................................... 40
Homework 3.1............................................................................................................................................. 40
Homework 3.2............................................................................................................................................. 41
Homework 3.3............................................................................................................................................. 41
Homework 3.4............................................................................................................................................. 41
Homework 3.5............................................................................................................................................. 42
Homework 3.6............................................................................................................................................. 43
Homework 3.7............................................................................................................................................. 44
Homework 3.8............................................................................................................................................. 44
Homework 3.9............................................................................................................................................. 45
Homework 3.10........................................................................................................................................... 46
Homework 3.11........................................................................................................................................... 47
Homework 3.12........................................................................................................................................... 48
Glossary ........................................................................................................................................................... 49
SQL Commands ............................................................................................................................................. 52
Teacher Target Codes .................................................................................................................................. 52

Binary
Understand that computers use binary to represent data and instructions
1 What is binary?

Understand how computers represent and manipulate numbers


2.1 Why do computers use binary?

2.2 What are transistors and how are they used in digital circuits?

Be able to convert between binary and denary whole numbers


3.1 Convert the following denary numbers to binary:
Denary

9
5
11
15
2

WWW:

SA

EBI:

PA

TA

ReAct:

3.2 Convert the following binary numbers to denary:


8

Denary

3.3 What range of numbers can be represented by 8 bits?

3.4 Convert the following binary numbers to denary:


Binary

Denary

10110101
00110011
00111111
11110011
10101010
3.5 Convert the following denary numbers to binary:
Denary

Binary

66
154
89
231
78

WWW:

SA

EBI:

PA

TA

ReAct:

3.6 Answer these questions in binary:


How many days in a week?
How many months in a year?
How many fingers (including the thumb) on one hand?
How many toes on two feet?
How many lives does a cat have?

Be able to perform binary arithmetic


4.1 Write the rules for performing binary addition.

4.2 Add up these binary numbers, check your answers by converting them to denary.

0111

0101

1111

0100 +

0110 +

0111 +

0011

1011

0111

0011 +

1111 +

0010 +

1110

01111

01110

0111 +

10101 +

10111 +

WWW:

EBI:

SA

PA

TA

ReAct:

10101010

10101100

00110010 +

00010010 +

4.3 Write the rules for performing binary subtraction.

4.4 Subtract these binary numbers, check your answers by converting them to denary.

11

1111

100

10 -

0110 -

010 -

100

1000

0111

011 -

0101 -

0010 -

1110

10010

01110

0111 -

01010 -

00011 -

10101010

10101100

00110010 -

00010010 -

WWW:

SA

EBI:

PA

TA

ReAct:

4.5 Explain how to convert sign and magnitude numbers to denary.

4.6 Convert these sign and magnitude numbers into denary. The first one is done for you.

Sign and magnitude


binary number

Denary

1100 1101

-(64+8+4+1) = -77

0001 1111
1000 1010
0101 1100
1000 0000
1111 1111
0111 1111
4.7 Explain how to convert twos complement numbers into denary.

WWW:

SA

EBI:

PA

TA

ReAct:

4.8 Convert these twos complement numbers into denary. The first one is done for you.

Twos complement
binary number

Denary

1100 1101

-128+64+8+4+1 = -51

0001 1111
1000 1010
0101 1100
1000 0000
1111 1111
0111 1111
Hint: The most significant bit is -128.
4.9 How are floating point numbers represented in binary?

Understand why hexadecimal notation is used and be able to convert between


hexadecimal and binary and vice versa
5.1 Explain why hexadecimal notation is used.

5.2 Which characters are used to represent numbers in hexadecimal?

WWW:

SA

EBI:

PA

TA

ReAct:

5.3 Explain how to convert hexadecimal numbers to binary.

5.4 Convert these hexadecimal numbers to binary.

5.5 Convert these binary numbers to hexadecimal.

1101

1111

1001

0001

0011

1010

1110

1100

1011

0101

0111

1111

WWW:

SA

EBI:

PA

TA

ReAct:

Data Representation
Understand how computers encode characters

ASCII binary code


Symbol

Binary

Symbol

Binary

Symbol

Binary

Symbol

Binary

Symbol

Binary

0100 0001

0110 0001

0010 0001

0100 0000

Space

0010 0000

0100 0010

0110 0010

"

0010 0010

0101 1011

0100 0011

0110 0011

0010 0011

0101 1100

0100 0100

0110 0100

0010 0100

0101 1101

0100 0101

0110 0101

0010 0101

0101 1110

0100 0110

0110 0110

&

0010 0110

0101 1111

0100 0111

0110 0111

'

0010 0111

0110 0000

0100 1000

0110 1000

0010 1000

0111 1011

0100 1001

0110 1001

0010 1001

0111 1100

0100 1010

0110 1010

0010 1010

0111 1101

0100 1011

0110 1011

0010 1011

0111 1110

0100 1100

0110 1100

0010 1100

0011 0000

0100 1101

0110 1101

0010 1101

0011 0001

0100 1110

0110 1110

0010 1110

0011 0010

0100 1111

0110 1111

0010 1111

0011 0011

0101 0000

0111 0000

0011 1010

0011 0100

0101 0001

0111 0001

0011 1011

0011 0101

0101 0010

0111 0010

<

0011 1100

0011 0110

0101 0011

0111 0011

0011 1101

0011 0111

0101 0100

0111 0100

>

0011 1110

0011 1000

0101 0101

0111 0101

0011 1111

0011 1001

0101 0110

0111 0110

0101 0111

0111 0111

0101 1000

0111 1000

01011001

0111 1001

01011010

0111 1010

WWW:

SA

EBI:

PA

TA

ReAct:

10

6.1 Use the table of ASCII binary codes to decode this:

ASCII binary code

Character

0110 1000
0110 0101
0110 1100
0110 1100
0110 1111
6.2 Use the table of ASCII binary codes to decode this:

Character

ASCII binary code

S
a
n
T
a

C
l
a
u
s
Hint: Dont forget the space.
6.3 The ASCII code for a blank space is:

WWW:

SA

EBI:

PA

TA

ReAct:

11

6.4 It is important to have a code for a blank space because.

6.5 Write your name in ASCII.

WWW:

SA

EBI:

PA

TA

ReAct:

12

Understand how bitmap images are represented in binary


7.1 What is a bitmap image?

7.2 Complete the table below:


Open a bitmap image (such as a photograph) in a graphics software package. Resize the
image so that the dimensions are doubled then save it again. Compare the file sizes of the two
versions.
Version 1:
Version 2:
Compare the clarity of the two images. Which is clearer?

Why do you think this is the case?

How big can you make the image before it gets blurry?

What happens if you make the original image smaller?

Reload the original image and change its colour depth. Summarise what happens as the colour
depth decreases.

WWW:

SA

EBI:

PA

TA

ReAct:

13

7.3 Complete the table below:


Colour depth

Number of colours

Range

1 bit

01

2 bits
3 bits
4 bits
8 bits
16 bits
24 bits
32 bits
7.4 Fill in the grid to reveal what character this code produces (0 = black and 1 = white)

Binary code
0000
0111
0111
0001
0111
0111
0000

WWW:

SA

EBI:

PA

TA

ReAct:

14

7.5 Produce the binary code to produce the letter G in the grid below (0 = black and 1 = white)

Binary code

7.6 Calculate the file size of an image with dimensions of 3 inches x 4 inches, a pixel density of 300
pixels per inch and a colour depth of 8 bits. Give your answer in bytes.

Hint: The formula for calculating the file size of a bitmap image is (height x pixel density) x (depth x
pixel density) x colour depth and there are 8 bits in a byte.
7.7 Calculate the file size of an image with dimensions of 5 inches x 7 inches, a pixel density of 400
pixels per inch and a colour depth of 3 bits. Give your answer in bytes.

WWW:

SA

EBI:

PA

TA

ReAct:

15

Understand how analogue data is represented in binary


8.1 Draw an analogue sound wave and label:

amplitude
time
analogue signal
sampling period

8.2 Describe the process of converting analogue sound waves into digital data.

8.3 What is the difference between analogue and digital data?

8.4 What is meant by the term sampling rate?

8.5 What did Nyquist have to say about sampling rate?

WWW:

SA

EBI:

PA

TA

ReAct:

16

8.6 What is the sampling rate for CD audio? Give your answer in kHz.

8.7 In the context of digital sound, what is meant by the term bit depth?

8.8 How many bits per sample are used for CD audio?

8.9 What about DVD audio?

8.10 Is a high frequency sound high or low pitched?

8.11 What is the highest frequency the human ear can detect?

8.12 Why do most sound recordings have two channels?

8.13 Calculate the file size of a CD quality, stereo sound track that is 2.5 minutes long.
Give your answer in megabytes to 1 decimal place.

WWW:

SA

EBI:

PA

TA

ReAct:

17

8.14 Calculate the bit depth of a 10.3 MB, 3 minute, stereo sound track, with a sampling rate of
30 kHz.

8.15 An analogue-to-digital converter samples the temperature of a furnace every two hours.
Each sample is stored as a 32-bit number. How many bytes of data are stored in a week?

Understand the limitations of binary representation of data and how bit length constrains
the range of values that can represented
9.1 What range of values can be represented in 8 bits?

9.2 Explain what the number of bits used for the exponent and mantissa determine.

WWW:

SA

EBI:

PA

TA

ReAct:

18

Data Storage and Compression


Understand and be able to convert between the terms bit, nibble, byte, kilobyte,
megabyte, gigabyte, terabyte
10 Use a calculator to calculate the number of bytes.

Number of bytes
1 kilobyte (KB)

= 1024 bytes

1 megabyte (MB)

= 1024 kilobytes

1 gigabyte (GB)

= 1024 megabytes

1 terabyte(TB)

= 1024 gigabytes

Understand the need for data compression and methods of compressing data and that
JPEG and MP3 are examples of lossy algorithms
11.1 Describe the three strategies for compressing data:
Lossless

Lossy

Superchannel

WWW:

SA

EBI:

PA

TA

ReAct:

19

11.2 Discuss the pros and cons of each method of compressing data
Pros

Cons

Lossless

Lossy

Superchannel

WWW:

SA

EBI:

PA

TA

ReAct:

20

11.4 Fill in this table to help you see what a difference compression makes to file size.
File A

File B

File C

How many characters does


the file contain?
What type of content does
the file contain?
What is its file size before
compression?
What is its file size after
compression?
What is its compression ratio
(decompressed
size/compressed file size)?

Which file compresses the most? Explain why.

Understand how a lossless, run-length encoding algorithm works


12.1 Describe how the RLE compression algorithm works.

WWW:

SA

EBI:

PA

TA

ReAct:

21

12.2 In the table below, the image is encoded in binary. The first binary pair represents a colour (00
= blue, 01 = white, 10 = yellow, 11 = green) and the second binary number represents the run
length of the colour. So, for example, 00, 1101 represents blue, 13 pixels. Shade the squares
(pixels) in the table to recreate the image.
Line 1

00 0001 01 0011 00 1100

Line 2

00 0001 01 0011 00 1100

Line 3

00 0001 01 0011 00 0100 10 0010 00 0100 10 0001 00 0001

Line 4

00 0111 10 0010 00 0100 10 0010 00 0001

Line 5

01 0010 00 0101 11 0011 00 0011 10 0010 00 0001

Line 6

01 0010 00 0011 11 0110 00 0001 10 0011 00 0001

Line 7

00 0100 11 0010 01 0001 11 0101 10 0011 00 0001

Line 8

00 0001 01 0001 00 0001 11 1001 10 0011 00 0001

Line 9

00 0011 11 1001 10 0011 00 0001

Line 10

00 0001 01 0001 00 0010 11 1000 10 0011 00 0001

Line 11

00 0101 11 0110 00 0001 10 0011 00 0001

Line 12

00 0111 11 0011 00 0011 10 0010 00 0001

Line 13

00 0001 11 0001 00 0010 11 0001 00 0010 10 0010 00 0100 10 0010 00 0001

Line 14

00 0001 11 0001 00 0001 11 0001 00 0100 10 0010 00 0100 10 0001 00 0001

Line 15

00 0010 11 0001 00 1101

Line 16

10 10000

WWW:

SA

EBI:

PA

TA

ReAct:

22

12.3 Answer these questions based on the image on the previous page.
How many bytes are required to
represent the uncompressed file?
Remember: number of squares in grid x 2
/8
How many bytes are required to
represent the RLE encoded file?
Remember: number of codes x number
of bits in each code / 8
How much storage space have you
saved?
12.4 Use the Run Length Encoding Calculator to encode these text strings.
Text string

Answer

AAAABBBBBBBBBCADDDDEEFFFFFFFF
ABCABCABCABCABCABCABCABCABCS
BBGGYYAACCFFEEBBGGYYAACCFFEE

Which one compresses the most?


Why is this?
Describe in English the process the RLE
calculator follows to encode a piece of
text.

WWW:

SA

EBI:

PA

TA

ReAct:

23

12.5 Fill in the gaps to complete this algorithm:


1. Start with the first character in the string.
2. Write down the number 1.
3. Compare the first character with the next character on the right.
4. If they are the same, ___________________________________.
5. If they are not the same, ________________________________.
6. Move on to the next character on the right.
7. Go back to step 2 and repeat until you reach the end of the string.
8. _____________________________________________________.

12.6 Answer the questions below based on this text:


The wheels on the bus go round and round, round and round, round and round.
The wheels on the bus go round and round all day long.

How many characters, including spaces and


punctuation marks, are there in this song?

Assuming one byte is used to represent each


character, what is its file size?

WWW:

SA

EBI:

PA

TA

ReAct:

24

12.7 Complete this table:


Word
The
wheels
on
the
bus
go
round
and
all
day
long

Number of times used


2
2
2
2

Number of bytes in word


3
6
2
3

12.8 Complete this lookup table of all the words used more than once in the song.
Lookup table
0.

The

1.

wheels

2.

on

3.

the

4.
5.
6.
7.
12.9 Use the lookup table you have completed to encode the song, replacing repeated words
with the number representing their positing in the table.

WWW:

SA

EBI:

PA

TA

ReAct:

25

12.10 Complete this table:


Explain what is meant by lossless
compression.

What type of data can be


compressed using a lossless
compression algorithm?

Describe how a lossless RLE


algorithm works.

Some lossless compression


algorithms use a lookup table.
Explain what the lookup table is
for.
Explain how lossy compression
differs from lossless compression.

Explain why lossy compression is


usually used for media files.

Outline the process of


compressing an audio file using a
lossy compression algorithm.

Outline the process of


compressing a bitmap image
using a lossy compression
algorithm.

WWW:

SA

EBI:

PA

TA

ReAct:

26

Understand that file storage is measured in bytes and that data transmission is measured
in bits per second, and be able to calculate the time to transmit a file and storage
requirements for files
13.1 Answer these questions (giving all answers to 2 decimal places):
Question

Answer

What are 92,400 MB in GB?

Ann has a 750 MB file and Nicky has a 550 MB file.


Will both files fit on Anns 2 GB pen drive?

Jo has 250 500 KB images. How much space does


she need on her hard drive to store them? Give
your answer in megabytes.

Nicky has 30 hours of MP3 recordings stored in the


cloud. How many gigabytes of storage would she
need to download them onto her phone?
Hint: MP3 audio generates approximately 1 MB of
data per minute.
Anns video camera produces video data at the
rate of 2.5 GB per hour. How big will a 20 minute
recording be? Give your answer in megabytes.

13.2 How much storage space is required for 50 images, each with dimensions of 3 inches x 4
inches, a bit-map density of 300 pixels per inch and a colour depth of 8 bits.
Give your answer in megabytes to 1 decimal place.

WWW:

SA

EBI:

PA

TA

ReAct:

27

Encryption
Understand the need for data encryption
14.1 Crack this code!

KH WUHDVXUH LV KLGGHQ XQGHU WKH SDOP WUHH


Hint: H = E and W = T

14.2 Who uses encryption and what do they use it for what?
Users of encryption

What they use encryption for

Businesses

Individuals

Governments

E-traders

The military

WWW:

SA

EBI:

PA

TA

ReAct:

28

Understand how a Caesar cipher algorithm works


15.1 Explain how the Caesar cipher works.

15.2 Use a Caesar cipher to decode and encode these messages.


Plain text

Shift

THE ENIGMA MACHINE WAS INVENTED BY


THE GERMANS

+3

COLOSSUS WAS THE WORLDS FIRST


DIGITAL COMPUTER

+4

Encrypted text

+5

YMJ HFJXFW HNUMJW NX FS JCFRUQJ TK


WTRFS NSLJSZNYD

-3

QEB HBV FP EFAABK RKABO QEB CILTBO


MLQ

Databases
Understand the characteristics of structured and unstructured data
16.1 Give some examples of unstructured data.

16.2 Give some examples of structured data.

WWW:

SA

EBI:

PA

TA

ReAct:

29

Understand that data can be decomposed and organised in a structured database


17.1 Label this example table to show examples of: a field, a record and a primary key.
Zoo Table
ID
C009
A002
A019
C015
B033
A007

Name
Terry
Maria
Sam
Toni
Bob
Charlie

Breed
Lion
Chimpanzee
Gibbon
Tiger
Red deer
Chimpanzee

Gender
Male
Female
Female
Female
Female
Male

Date_Of_Birth
30/6/1982
12/3/2012
10/6/2002
18/6/2009
6/7/2007
19/7/2011

Enclosure
Big Cats
Ape House
Ape House
Big Cats
Deer Park
Ape House

Capacity
12
50
50
12
200
50

Headkeeper
J Milner
S Larkin
S Larkin
J Milner
A Hunt
S Larkin

17.2 Define the key terms in the table below:


Table

Record

Field

17.3 Explain the purpose of the primary key.

17.4 Explain the purpose of the foreign key.

WWW:

SA

EBI:

PA

TA

ReAct:

30

17.5 Re-organise the data from the Zoo table into two linked tables called Animal and Enclosure.
Animal

Enclosure

Understand the need for and be able to use SQL statements


18.1 Table this table to show the comparison operators:
Comparison operator

Symbol

Equal to
Less than
Greater than
Less than or equal to
Greater than or equal to
Not equal to

WWW:

SA

EBI:

PA

TA

ReAct:

31

The table below is called Marksheet and it contains details of the marks students have achieved in
three different school assignments as well as their average mark.
Marksheet Table
Name
Aisha
Katharine
Fiona
Gareth
Jo
Manjit
Ian
Michael
Ubaid
Simon
Mark
Gemma
Shan
Alex
Philip

Assign1
51
75
100
86
38
66
13
43
55
40
0
52
30
56
90

WWW:

SA

Assign2
60
76
87
65
52
64
17
33
50
40
25
78
37
30
86

EBI:

PA

TA

Assign3
64
48
72
69
44
68
26
44
55
48
15
78
39
54
85

Average
58
70
86
73
45
66
19
40
53
43
13
69
35
47
87

ReAct:

32

18.2 Write down the outcome you would get if you ran each of these commands. The first one has
been done for you.
SELECT Name FROM Marksheet WHERE Assign1 > 50
Name
Aisha
Katharine
Fiona
Gareth
Manjit
Ubaid
Gemma
Alex
Philip
SELECT Name FROM Marksheet WHERE Assign1 = 0

SELECT Name FROM Marksheet WHERE Assign1 = 0

SELECT Name FROM Marksheet WHERE Assign1 <>


100

SELECT Name FROM Marksheet WHERE Assign2 < 65

SELECT Name FROM Marksheet WHERE Assign2


<=65

SELECT Name FROM Marksheet WHERE Assign3 >=


60

SELECT Name, Average FROM Marksheet WHERE


Average > 75

WWW:

SA

EBI:

PA

TA

ReAct:

33

18.3 Write down the outcome you would get if you ran each of these commands:
SELECT Name, Average FROM Marksheet WHERE Average > 0 AND Average < 65

SELECT Name, Assign1, Assign2, Assign3 FROM Marksheet WHERE Assign1 <= 40 AND Assign2 <=
40 AND Assign3 <= 40

SELECT Name FROM Marksheet WHERE Assign1 < 50 OR Assign2 < 50 OR Assign3 < 50

Song Table
Song_Title
Hello Igglepiggle!

Time
0:38

Track_No
3

Catch Makka Pakkas Ogpog!


The Pinky Ponk

7:32

12

1:09

16

Hokey Cokey
Ten Green Bottles
Old MacDonald Had a farm
This Little Pig
Six Little Ducks
My Name is
Everythings Rosie Theme Tune
Summer Song
The Birdie Song

2:28
2:33
2:03
1:13
1:02
1:21
0:43
1:54
2:23

1
12
1
3
12
5
12
21
12

Album Table
Album_Title
In The Night Garden A
Musical Journey
Heads, Shoulders, Knees &
Toes
50 Nursery Rhyme Songs
CBeebies the Album
Childrens Party Time
WWW:

SA

Artist
Andrew Davenport

Released
2007

Genre
Childrens music

The C.R.S. Players

2004

Childrens music

Countdown Kids
Various Artists
Kids Players

2009
2012
1995

Childrens music
Childrens music
Childrens music

EBI:

PA

TA

Album_Title
In The Night Garden A Musical
Journey
In The Night Garden A Musical
Journey
In The Night Garden A Musical
Journey
Heads, Shoulders, Knees & Toes
Heads, Shoulders, Knees & Toes
50 Nursery Rhyme Songs
50 Nursery Rhyme Songs
50 Nursery Rhyme Songs
CBeebies the Album
CBeebies the Album
CBeebies the Album
Childrens Party Time

ReAct:

34

18.4 Based on the Song and Album tables write the SQL commands to:
a) display the title, track number, time and artist of all the songs in the Song table:

b) display the song and album titles for all the songs recorded by Countdown Kids:

Food_Item Table
Product_Code
1239T
1237T
1309T
4550F
3444F
2121G
5544C

Product_Name
Baked beans
Tomato soup
Spaghetti hoops
Oven chips
Fish fingers
Frankfurters
Sausage rolls

Price
0.34
0.56
0.80
1.24
1.45
1.02
2.45

Supplier_Code
S121/A
S121/A
S121/A
S234/F
S234/F
S009/C
S100/C

Quantity_In_Stock
154
450
99
550
756
52
150

18.5 The table above contains details of food items stocked by a supermarket.
a) Write the SQL command to insert a new record into this table, for a product with the
following details:
Product_Code: 5500C
Product_Name: Pork Pie
Price: 2.45
Supplier_Code: S100/C
Stock: 150

b) Write the SQL command to update the record for Tomato soup in the Food_Item table
above: the Quantity_In_Stock is now 415.

WWW:

SA

EBI:

PA

TA

ReAct:

35

18.6 For the Supplier table below, write the SQL command to update the record for Smiths Pork
Products whose email address is now BHSwinefoot@Smith.com.
Supplier Table
Supplier_Code
S121/A
S234/F
S009/C
S100/C

Supplier_Name
Williamsons Ltd
Artic Foods
A Taste of Germany
Smiths Pork Products

Email
orders@williamson.com
orders@aff.co.uk
weissrock@dtv.de
OAAdam@Smith.com

18.7 Write the SQL command to:


a) delete the record for The Pinky Ponk song from the Song table:

b) delete one more record of your choice from the Song table:
c) Write the SQL command to create a table called ExamTimetable. The table should include
the following fields:
Examination
Date
Time
Duration
Taken_Place
Dont forget that you need to specify a suitable data type for each field.

WWW:

SA

EBI:

PA

TA

ReAct:

36

TestScores Table
StudentID
English
JMD1
76
MH1
51
JHM1
70
CJC1
59
GMM2
42
BD3
78
SRM2
96
LMRM1
49
ABL1
17
GML2
35
AK3
93
CJM1
36
AK4
49
CJD1
78
LTD2
39
Choices Table
StudentID First_Name
JMD1
Julie
MH1
Mandeep
JHM1
Jo
CJC1
Chris
GMM2
Geraldine
BD3
Ben
SRM2
Steven
LMRM1
Lewis
ABL1
Adam
GML2
Grace
AK3
CJM1
AK4
CJD1
LTD2

Aquil
Charlotte
Amelie
Cala
Lola

WWW:

SA

Maths
55
67
96
54
70
77
64
24
49
83
3
67
66
83
40

Science
55
87
79
22
90
75
7
79
65
72
80
11
25
82
52

Surname
Davies
Heer
Morris
Charter
McGuiness
Dodd
Mitchell
Mitchell
Lewis
Langham

Subject1
English
English
Maths
English
Maths
English
Maths
Computer Science
English
English

Khan
Mansell
Khalil
Dickenson
Dukes

Biology
English
Maths
English
Maths

EBI:

PA

TA

ComputerScience
40
34
62
41
67
82
21
55
67
67
24
47
33
90
42

German
46
58
14
21
47
17
92
44
78
23
91
5
55
70
55

Subject2
Maths
History
Biology
History
Physics
German
Biology
History
Maths
Computer
Science
Chemistry
German
Biology
Maths
Chemistry

History
68
48
42
80
27
47
33
83
49
56
29
42
90
76
43

Music
24
93
72
53
15
22
18
67
65
79
81
2
15
51
30

Subject3
Computer Science
Music
Chemistry
Music
Computer Science
Music
Chemistry
Music
Physics
History
Physics
History
Music
Music
History

ReAct:

37

18.8 The two related tables, TestScores and Choices, contain information about students results in
their latest GCSE mocks and their A level choices. Write down the outcome you would get if you
ran each of these commands:
a) SELECT First_Name, Surname FROM Choices WHERE Subject1 = English AND Subject2 =
Maths

b) SELECT StudentID, English FROM TestScores WHERE English <= 50

c) SELECT * FROM Choices WHERE Subject3 = Music

d) SELECT Subject1, Subject2, Subject3 FROM Choices WHERE Student_ID IN (CJC1, GML2,
AK3, CJD1)

e) SELECT * FROM TestScores WHERE Maths BETWEEN 0 AND 60

f) SELECT StudentID, First_Name, Surname FROM Choices WHERE Surname LIKE D%

WWW:

SA

EBI:

PA

TA

ReAct:

38

18.9 Now write the SQL command to:


a) update Lola Dukess Subject3 from History to Physics:

b) insert a new record into the Choices table as follows:


StudentID: MW2
First_Name: Marie
Surname: Wright
Subject1: German
Subject2: History
Subject3: Music

c) delete records from both tables for the student with the StudentID AK3:

d) display the first name, surname and English score of all students:

WWW:

SA

EBI:

PA

TA

ReAct:

39

Homework
Homework 3.1
Convert the following binary numbers to denary:
Binary

Denary

10111101
10110011
10111111
11010011
10101011
Convert the following denary numbers to binary:
Denary

Binary

254
68
70
83
212
Add up these binary numbers, check your answers by converting them to denary.

1111

0001

1101

0101 +

1110 +

1111 +

WWW:

EBI:

SA

PA

TA

ReAct:

40

Homework 3.2
Add the following key terms and their definitions to Quizlet.
ASCII
Bitmap
Colour Depth

Memorise the definitions for the key terms above.

Homework 3.3
Add the following key terms and their definitions to Quizlet.
Analogue Data
Sampling Rate
Bit Depth
Sample
Memorise the definitions for the key terms above.

Homework 3.4
Add the following key terms and their definitions to Quizlet.
Lossless
Lossy
Super channel
Run Length Encoding
Memorise the definitions for the key terms above.

WWW:

SA

EBI:

PA

TA

ReAct:

41

Homework 3.5
Use four different colours to draw an image in the grid below.

Now encode the image using a 2-bit binary number to represent the colour depth and a 4-bit
binary number to specify the run length of the pixels to be filled with that colour.
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
Line 10
Line 11
Line 12
Line 13

WWW:

SA

EBI:

PA

TA

ReAct:

42

Homework 3.6
A lookup table has been used to encode this text:
Encoded text

0.

Lossy

0 1 2 3 generally more effective than 4 1 2


in reducing 5 size 6 7. However, whereas 4 2
allows 5 8 1 9 10 perfectly reconstructed
from 5 compressed 1, 11 2 causes some 6 5
8 1 9 10 permanently lost.

1.

data

2.

compression

3.

is

4.

lossless

5.

the

6.

of

7.

files

8.

original

MP3 uses 11 1 2 9 compress audio 7 for use


on portable media players where space 3
limited.

9.

to

10.

be

11.

lossy

PNG 13 GIF use 4 1 2 9 reduce 5 size 6


image 7.

12.

used

13.

and

14.

by

0 1 2 3 most often 12 for media 7, i.e. music,


pictures 13 videos. This type 6 1 3 intended
9 10 12 14 humans whose brains are
capable 6 filling in 5 gaps created 14 11 2.

Decode the text.

WWW:

SA

EBI:

PA

TA

ReAct:

43

Homework 3.7
Create your own cipher and then use it to encrypt a secret message. Make sure you keep a
note of the key to cracking your cipher, so that you (or someone else) can decode the
message later!

Homework 3.8
Produce a step-by-step guide to using a Caesar cipher to produce an encoded message.

WWW:

SA

EBI:

PA

TA

ReAct:

44

Homework 3.9
The table below is called PlayList and it lists some of the songs on five albums of childrens songs.
PlayList Table
Album_Title
In The Night Garden
A Musical Journey
In The Night Garden
A Musical Journey
In The Night Garden
A Musical Journey
Heads, Shoulders,
Knees & Toes
Heads, Shoulders,
Knees & Toes
50 Nursery Rhyme
Songs
50 Nursery Rhyme
Songs
50 Nursery Rhyme
Songs
CBeebies the Album

Artist
Andrew
Davenport
Andrew
Davenport
Andrew
Davenport
The C.R.S.
Players
The C.R.S.
Players
Countdown Kids

Released
2007

Countdown Kids

2009

Countdown Kids

2009

Various Artists

2012

CBeebies the Album

Various Artists

2012

CBeebies the Album

Various Artists

2012

Childrens Party Time

Kids Players

1995

2007
2007
2004
2004
2009

Genre
Childrens
music
Childrens
music
Childrens
music
Childrens
music
Childrens
music
Childrens
music
Childrens
music
Childrens
music
Childrens
music
Childrens
music
Childrens
music
Childrens
music

Track_No
3

Song_Title
Hello Igglepiggle!

Time
0:38

12

7:32

16

Catch Makka Pakkas


Og-pog!
The Pinky Ponk

Hokey Cokey

2:28

12

Ten Green Bottles

2:33

2:03

Old MacDonald Had a


farm
This Little Pig

12

Six Little Ducks

1:02

My Name is

1:21

12

0:43

21

Everythings Rosie
Theme Tune
Summer Song

12

The Birdie Song

2:23

1:09

1:13

1:54

The data in the table above could be split into two tables (Album and Song) list the fields that
would be placed in each table.
Album Table
Song Table

WWW:

SA

EBI:

PA

TA

ReAct:

45

Homework 3.10
Use the Playlist table to help you answer these questions:
Write down the outcome you would get if you ran each of these commands.

SELECT Track_No, Song_Title FROM PlayList WHERE Album_Title IN (50 Nursery Rhyme Songs,
CBeebies the Album)

SELECT * FROM PlayList WHERE Time BETWEEN 1.00 AND 2.00

SELECT Album_Title, Track_No, Song_Title FROM PlayList WHERE Time > 2.30

Now write three SQL queries of your own, giving the outcome for each one.

Write a query using SELECT FROM WHERE:

Write a query using SELECT FROM WHERE IN:

Write a query using SELECT FROM WHERE and either a comparison operator (=, <, >, <=, >=,
<>) or a Boolean operator (AND, OR):

WWW:

SA

EBI:

PA

TA

ReAct:

46

Homework 3.11
Here are two related tables: Animal and Enclosure.
Animal
ID
C009
A002
A019
C015
B033
A007

Name
Terry
Maria
Sam
Toni
Bob
Charlie

Enclosure
Enclosure
Big Cats
Ape House
Deer Park

Breed
Lion
Chimpanzee
Gibbon
Tiger
Red deer
Chimpanzee

Capacity
12
50
200

Gender
Male
Female
Female
Female
Female
Male

Date_Of_Birth
30/6/1982
12/3/2012
10/6/2002
18/6/2009
6/7/2007
19/7/2011

Enclosure
Big Cats
Ape House
Ape House
Big Cats
Deer Park
Ape House

Headkeeper
J Milner
S Larkin
A Hunt

Write the SQL commands to:

display the name, breed and headkeeper of all the animals in the Animal table:

display Tonis ID, date of birth and the capacity of her enclosure:

Now write an SQL command to extract information from both tables, and give the outcome of it.

WWW:

SA

EBI:

PA

TA

ReAct:

47

Homework 3.12
The questions below relate to the related tables Animal and Enclosure.
Write the SQL command to:

delete the record for the red deer from the Animal table.

delete the record for the Deer Park from the Enclosure table.

amend Sam the gibbons date of birth to 10/6/2003.

amend the headkeeper for the ape house to J McNaught.

add a new record to the Enclosure table, as follows:


Enclosure: Reptile House
Capacity: 75
Headkeeper: A Khan

add a new record to the Animal table as follows:


ID: R086
Name: Isis
Breed: Iguana
Gender: Male
Date of birth: 7/4/2014
Enclosure: Reptile House

WWW:

SA

EBI:

PA

TA

ReAct:

48

Glossary
Analogue Data
An analogue signal is one which has a value that varies smoothly.

ASCII
The American Standard Code for Information Interchange is used to represent each character,
number and symbol. It has space for 128 symbols, this is enough for standard English.

Binary

A base-2 number system that is used in digital circuits, it uses two digits, 0 and 1. 1 represents the
on state of a digital circuit and 0 represents the off state.

Bit Depth

This refers to the number of bits in each sample, combined with the sample rate it determines the
quality of the sound.

Bitmap
Consists of a grid of squares called pixels. Each pixel can be uniquely identified by its position in
the grid (x/y coordinates) and each pixel is a single colour.

Caesar Cipher

One of the simplest encryption methods, it is a substitution cipher that involves replacing each
letter with the letter that is three places further down the alphabet.

Colour Depth

This is number of bits used to store each pixels colour is in an image. The greater it is, the more
colours can be represented.

Database

A convenient and powerful way to store and organise data.

Denary

A base 10 number system consisting of the digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) also known as decimal.

Encryption

Allows data to be kept secret and secure so no one else can make use of it. A key is used to
encrypt plain text into meaningless cipher text, the same key is used to decrypt the data back
into its original form.

Exponent
Determines the position of the binary point in a floating point number.

Field
One piece of data or information about a person or thing.

Floating Point Numbers


These are numbers with decimal points.

Foreign Key
Used to link tables together and create a relationship. It is a field in one table that is linked to the
primary key in another table.

49

Hexadecimal
A base 16 number system that is widely used in computing because it is a much shorter way of
representing a byte of data compared to binary.

Integers

These are whole numbers without decimal points.

Lossless Compression

Reduces the size of a file while retaining all the original data.

Lossy Compression

Reduces the size of a file by permanently removing some of the data.

Mantissa

Represents the significant digits in a floating point number,

Primary Key

A unique identifier for each record.

Record

A record is all of the data or information about one person or one thing.

Run Length Encoding

A simple form of data compression in which sequences consisting of the same value are stored as
a single value and a number.

Samples

Taken at evenly spaced time intervals and represented as numerical values when digitising sound.

Sampling Rate

The number of samples taken per second and is measured in hertz (Hz).

Sign and Magnitude

Represents negative and positive numbers by placing an extra bit at the front of the number. 1
represents a negative number and 0 represents a positive number.

Signed Integers
Used to encode negative numbers in binary, the two main methods are sign and magnitude and
twos complement.

Structured Query Language (SQL)

A programming language designed for managing data held in databases.

Structured Data

Generally refers to data that has been organised and stored using a database.

Superchannel

A form of compression where special data are selected for a special reason. These data are
separated from the rest, and the rest are thrown out.

Table
Stores all the records for a particular category.

50

Transistors
Switches that are used in digital circuits, in their off state they represent a 0 and in their on state
they represent a 1. Computers use combinations of millions or even billions of transistors to carry
out instructions.

Two's Complement

The method most computers use to represent integers. To represent a negative integer you invert
the digits and add one to the result.

Unstructured Data
Generally refers to data that has not been organised and stored using a database.

51

SQL Commands
Command
SELECT (FieldName, )
FROM TableName
WHERE condition
ORDER BY (FieldName, ..)
SELECT (FieldName, )
FROM Table1Name, Table2Name,
WHERE join criteria
ORDER BY (FieldName, ..)
UPDATE TableName
SET (FieldName=Value, )
WHERE condition
DELETE FROM TableName
WHERE condtion
CREATE TABLE TableName
(FieldName data type, )
INSERT INTO TableName
VALUES (Value, )
SELECT FieldName
FROM TableName
WHERE FieldName LIKE pattern

Description
Retrieves data from a table. (The asterisk * can be
used if all columns are required in the output.
Retrieves data from two related tables.

Updates rows in a database table.

Deletes rows from a database table.


Creates a database table.
Inserts row into a database table.
Used to search for a specified pattern in a field.

Teacher Target Codes


T1

Ensure spelling and punctuation is accurate.

T2

Improve the presentation of your work.

T3

Explain your points in greater detail.

T4

Include appropriate technical key terms.

T5

Evaluate and draw conclusions.

T6

Suggest realistic improvements to the solution.

T7

Use the glossary to help you to identify key points you have missed out.

T8

Show your working.

T9

Double check your calculations.

T10

Ensure you are using the correct symbols.

T11

Annotate to show your understanding.

T12

Communicate with the teacher if you are unclear.

T13

Use Quizlet at home to revise key terms.

T14

Take responsibility: complete all work in full and on time to the best of your ability.

52

You might also like