Data Workbook Answers

Data Workbook Answers
1
2.1
A base-2 number system that is used in digital circuits, it uses tw o digits, 0 and 1.
It represents the two possible states of a digital circuit, 1 represents the on state of a digital
circuit and 0 represents the off state.
2.2
Transistors are 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 mill ions or even billions of
transistors to carry out instructions.
3.1
3.2
3.3
3.4
Denary
8
4
2
1
9
1
0
0
1
5
0
1
0
1
11
1
0
1
1
15
1
1
1
1
2
0
0
1
0
8
4
2
1
1
0
1
1
11
1
0
0
0
8
1
0
0
1
9
1
1
1
1
15
1
1
1
0
14
0-255
3.5
3.6
4.1
Denary
Binary
Denary
10110101
181
00110011
51
00111111
63
11110011
243
10101010
170
Denary
Binary
66
01000010
154
10011010
89
01011001
231
11100111
78
01001110
How many days in a week?
00000111
How many months in a year?
00001100
How many fingers (including the thumb) on one hand?
00000101
How many toes on two feet?
00001010
How many lives does a cat have?
00001001
0+
0+
1+
1+
0=
1=
1=
1+
0
1
0 carry 1
1 = 1 carry 1
4.2
4.3
4.4
4.5
4.6
4.7
4.8
4.9
5.1
5.2
5.3
5.4
5.5
6.1
6.2
1011 (11)
1011 (11)
10110 (22)
0110 (6)
11010 (26)
1001 (9)
10101 (21)
100100 (36)
100101 (37)
011011100 (220)
010111110 (190)
0–0=0
0 – 1 = 1, and borrow 1 from the next more significant bit
1–0=1
1–1=0
1 (1)
01001 (9)
10 (2)
10 (2)
011 (3)
0101 (5)
0111 (7)
1000 (8)
01011 (11)
01111000 (120)
010011010 (154)
The left most bit (most significant bit) is the sign bit which indicates whether the number is positive
or negative. 1= minus and 0 = plus.
1100 1101
-(64+8+4+1) = -77
0001 1111
+(16+8+4+2+1) = +31
1000 1010
-(8+2) = -10
0101 1100
+(64+16+8+4) = +92
1000 0000
0
1111 1111
-(64+32+16+8+4+2+1) = -127
0111 1111
+(64+32+16+8+4+2+1) = +127
1. Check whether the number is negative or positive by looking at the sign bit (left most bit) 1 =
negative, 0 = positive.
2. If it is positive simply convert to decimal. If it is negative, take the value of the most significant
bit and subtract the sum of the remaining bits from it.
1100 1101
-128+64+8+4+1 = 51
0001 1111
16+8+4+2+1 = 31
1000 1010
-128+8+2 = -118
0101 1100
64+16+8+4 = 92
1000 0000
-128
1111 1111
-128+64+32+16+8+4+2+1 = -1
0111 1111
64+32+16+8+4+2+1 = 127
Floating point binary numbers are made up to two parts, the mantissa and the exponent. The
exponent determines the position of the binary point. The value of the exponent = the number of
positions the decimal point moves to the right. The digits to the right of the decimal point
represent a decimal fraction.
Hexadecimal is used in computing because it is a much shorter way of representing a byte of
data.
012345 6789AB CDEF
1. Take the right hex digit and convert this into a binary nibble.
2. Take the left hex digit and convert this as well into binary nibble.
0100 1011
0011 0011
0111 1110
0001 0001
0011 1100
1100 1101
DF
91
3A
DC
B5
7F
0110 1000
h
0110 0101
e
0110 1100
l
0110 1100
l
0110 1111
o
S
0101 0011
a
0110 0001
n
0110 1110
T
0101 0100
a
0110 0001
6.3
6.4
6.5
7.1
0010 0000
C
0100 0011
l
0110 1100
a
0110 0001
u
0111 0101
s
0111 0011
The ASCII code for a blank space is: 0010 0000
We need to be able to distinguish separate words to make sense of the string of binary numbers.
A bitmap image is made up of a grid of dots called pixels. Each pixel is defined by a binary
number.
7.2
7.3
Colour depth
1 bit
2 bits
3 bits
4 bits
8 bits
16 bits
24 bits
32 bits
7.4
7.5
7.6
7.7
=
=
=
=
=
=
=
=
(3 x 300) x (4 x 300) x 8
900 x 1200 x 8
8,640,000/8
1,080,000 bytes
(5 x 400) x (7 x 400) x 3
2000 x 2800 x 3
16800000/8
2,100,000 bytes
Number of colours
2
4
8
16
256
65536
16777216
4294967296
Range
0–1
0–3
0–7
0 – 15
0 – 255
0 – 65535
0 – 16777215
0 – 4294967295
8.1
8.2
8.3
8.4
8.5
8.6
8.7
8.8
8.9
8.10
8.11
8.12
8.13
8.14
8.15
9.1
9.2
10
Sampling an analogue sound wave involves taking samples at evenly spaced time intervals
(fractions of a second) and representing the samples as numerical values. The quality of the
sound reproduction depends on the sampling rate (the number of samples taken per second)
and the bit depth (the number of bits dedicated to representing the sample).
Analogue data is continuous, allowing for an infinite number of possible values.
Digital data is discrete. It has a finite set of values.
Sampling rate is the number of samples per second taken from a continuous signal. It is
measured in hertz (Hz).
The sampling rate should be at least twice the highest frequency contained in the signal.
44 kHz, i.e. 4,400 samples per second.
Bit depth is the number of bits of information in each sample.
16 bits per sample.
24 bits per sample.
High pitched.
20,000 Hz.
To create a stereo effect.
= 44,000 x 16 x 2 x 150
= 211,200,000 bits
= 211,200,000 / 8 / 1024 / 1024
= 25.177002 MB
= 25.2 MB
= (10.3 x 1024 x 1024 x 8 ) / (30,000 x 16 x 2 x 150)
= 0.6 MB
= (32 / 8) x (24 / 2) x 7
= 336 bytes
0-255
The number of bits used for the mantissa determines how many decimal places can be
represented
The number of bits used for the exponent determines the size of the numbers that can be
represented
1 kilobyte (KB)
= 1024 bytes
= 1024
1 megabyte (MB)
= 1024 kilobytes
= 1024 x 1024
= 1,048,576
1 gigabyte (GB)
= 1024 megabytes
=1024 x 1024 x 1024
=1,073,741,824
1 terabyte(TB)
= 1024 gigabytes
=1024 x 1024 x 1024 x 1024
11.1
Lossless
Lossy
Superchannel
11.2
=1,099,511,627,776
Lossless data compression reduces the size of files in such a way that the
original data can be perfectly reconstructed from the compressed data –
i.e. nothing is lost.
Lossy data compression permanently discards some of the original data.
It exploits the fact that human beings cannot detect subtle differences in
sounds and colours. Key data is retained and less important data is
discarded when lossy data compression takes place.
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.
Lossless
Lossy
Pros
No data is lost.
Results in smaller file sizes.
Superchannel
Only data required is selected.
11.3
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)?
Cons
Can result in a larger file size.
Data is permanently removed from the
file.
The rest of the data are destroyed.
File A
3146
File B
3146
File C
3146
One repeated phrase
Random text
Normal text
3.07KB
3.07KB
3.08KB
171 bytes (or 0.17 KB)
2KB
1.59KB
18:1
1.5:1
1.9:1
Which file compresses the most? Explain why.
File A compresses the most because it contains just one short phrase repeated many times. The
computer can store the repeated phrase once and then refer back to it without having to store it again.
12.1
12.2
A lossless RLE algorithm is a simple compression algorithm in which runs of data (sequences in
which the same data value occurs in many consecutive data elements) are stored as a single
data value and count, rather than as the original run. So, for example, FFFFFFFFFFFF would be
represented as 12F.
12.3
How many bytes are required to represent the
uncompressed file?
How many bytes are required to represent the
RLE encoded file?
12.4
How much storage space have you saved?
Text string
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.
12.5
12.6
12.7
12.8
= number of squares in grid x 2 / 8
= 256 x 2 / 8
= 64 bytes
= number of codes x number of bits in each
code / 8
= 84 x 6 / 8
= 63 bytes
1 byte
Answer
4A9BCA4D2E8F
ABCABCABCABCABCABCABCABCABCS
2B2G2Y2A2C2F2E2B2G2Y 2A2C2F2E
The first one.
Because it contains the longest run lengths.
The calculator looks at the first character and
counts this as 1. It then compares the next
character to the right with the first character. If
they are the same, it adds 1 to the number. If
they are different, it puts the letter. It then
starts counting again with the next letter on the
right.
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, add 1 to the number you have written down.
5. If they are not the same, write down the character.
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. Write down the last character in the string.
How many characters, including spaces and punctuation marks,
129
are there in this song?
Assuming one byte is used to represent each character, what is
129 bytes.
its file size?
Word
Number of times used
Number of bytes in word
The
2
3
wheels
2
6
on
2
2
the
2
3
bus
2
3
go
2
2
round
8
5
and
4
3
all
1
3
day
1
3
long
1
4
0.
The
1.
wheels
2.
on
3.
the
4.
bus
12.9
12.10
5.
go
6.
round
7.
and
The encoded song is:
0 1 2 3 4 5 6 7 6, 6 7 6, 6 7 6.
0 1 2 3 4 5 6 7 6 all day long.
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.
Lossless data compression reduces the size of files in such
a way that the original data can be perfectly reconstructed
from the compressed data – i.e. nothing is lost.
Lossless data compression works best on files containing
strings of repeating data, whether the repeating data is
characters, strings of letters or words.
A lossless RLE algorithm is a simple compression algorithm
in which runs of data (sequences in which the same data
value occurs in many consecutive data elements) are stored
as a single data value and count, rather than as the original
run. So, for example, FFFFFFFFFFFF would be
represented as 12F.
In a lookup table, a number is assigned to repeated words.
Then when the compression algorithm is run, the words
listed in the lookup table are replaced in the file by a
number. A considerable size reduction can be achieved by
using a lookup table and the original file can still be
reconstructed without any loss of quality.
Lossy data compression permanently discards some of the
original data. It exploits the fact that human beings cannot
detect subtle differences in sounds and colours. Key data is
retained and less important data is discarded when lossy
data compression takes place.
The data in photographs and audio files contains differences
too subtle for the human eye or ear to detect. Therefore,
lossy compression can drastically decrease the file size by
discarding some of the data, while the quality is still
acceptable to human beings.
The lossy compression algorithm analyses the data within
the audio signal. The lossy compression algorithm retains
the key data and the removes the non-audible or less
audible components of the signal.
Outline the process of compressing a
bitmap image using a lossy compression
algorithm.
13.1
The lossy compression algorithm divides the bitmap image
into blocks of 8x8 pixels. It then analyses the data within the
8x8 pixel block and ranks it according to its importance to
visual perception. The lossy compression algorithm retains
the key data and discards the less important data. It
achieves this by replacing the colour values of some of the
pixels.
What are 92,400 MB in GB?
= 92,400 / 1024
Give your answer in megabytes.
= 90.234375 GB
= 90.23 GB
Ann has a 750 MB file and Nicky has a 550 MB file. = 750 MB + 550 MB = 1300 MB
Will both files fit on Ann’s 2 GB pen drive?
= 1300 / 1024
= 1.26 GB
Yes – both files will fit on a 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.
= 250 * 500 / 1024
= 122.07 MB
13.2
14.1
14.2
15.1
15.2
16.1
16.2
17.1
17.2
17.3
17.4
17.5
Nicky has 30 hours of MP3 recordings stored in the 30 hrs x 60 mins = 1800 mins
cloud. How many gigabytes of storage would she
1800 mins x 1 MB / 1024
need to download them on to her phone?
= 1.76 GB
Ann’s video camera produces video data at the rate 2.5 / 3 = 0.83 GB in 20 mins
of 2.5 GB per hour. How big will a 20 minute
0.83 x 1024 = 849.92 MB
recording be? Give your answer in megabytes.
= 50 x (3 x 300) x (4 x 300) x 8
= 432,000,000 / 8
= 54,000,000 bytes
= 54,000,000 / 1024 / 1024
= 51.4984131 MB
= 51.5 MB
WKH WUHDVXUH LV KLGGHQ XQGHU WKH SDOP WUHH
THE TREASURE IS HIDDEN UNDER THE PALM TREE
Users of encryption
What they use encryption for
Businesses
 to protect corporate secrets/sensitive information
 to protect customer data against hacking
 to protect against accidental data leaks/losses
Individuals
 to protect personal information
 to guard against identity theft
Governments
 to secure classified/sensitive information and to protect it against
hacking
E-traders
 to send and receive confidential information such as customers’
credit card details
 to protect customer data against hacking
 to protect against accidental leaks/losses
The military
 to secure classified information/state secrets
 to protect against hacking
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.
Plain text
Shift
Encrypted text
THE ENIGMA MACHINE WAS
+3
WKH HQLJPX PXFKLQH ZXV LQYHQWHG EB
INVENTED BY THE GERMANS
WKH JHUPXQV
COLOSSUS WAS THE WORLD'S
+4
GSPSWWYW AEW XLI ASVPH’W JMVWX
FIRST DIGITAL COMPUTER
HMKMXEP GSQTYXIV
THE CAESAR CIPHER IS AN
+5
YMJ HFJXFW HNUMJW NX FS JCFRUQJ TK
EXAMPLE OF ROMAN INGENUITY
WTRFS NSLJSZNYD
THE KEY IS HIDDEN UNDER THE
-3
QEB HBV FP EFAABK RKABO QEB CILTBO
FLOWER POT
MLQ
Photos, videos, presentations, documents.
An address book, customer details, train timetable.
Table
Stores all the records for a particular category.
Record
A record is all of the data or information about one person or one thing.
Field
One piece of data or information about a person or thing.
A unique identifier for each record.
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.
Animal
ID
Name
Breed
Gender
Date_Of_Birth Enclosure
C009
Terry
Lion
Male
30/6/1982
Big Cats
A002
Maria
Chimpanzee
Female
12/3/2012
Ape House
A019
Sam
Gibbon
Female
10/6/2002
Ape House
C015
Toni
Tiger
Female
18/6/2009
Big Cats
B033
A007
18.1
18.2
Bob
Charlie
Enclosure
Enclosure
Big Cats
Ape House
Ape House
Big Cats
Deer Park
Ape House
Comparison operator
Equal to
Less than
Greater than
Less than or equal to
Greater than or equal to
Not equal to
Red deer
Chimpanzee
Capacity
12
50
50
12
200
50
Symbol
=
<
>
<=
>=
<>
SELECT Name FROM Marksheet W HERE Assign1
> 50
Name
Aisha
Katharine
Fiona
Gareth
Manjit
Ubaid
Gem m a
Alex
Philip
SELECT Name FROM Marksheet W HERE Assign1
=0
Name
Mark
Female
Male
6/7/2007
19/7/2011
Deer Park
Ape House
Headkeeper
J Milner
S Larkin
S Larkin
J Milner
A Hunt
S Larkin
SELECT Name FROM Marksheet W HERE Assign1 = 0
Name
Mark
SELECT Name FROM Marksheet W HERE Assign1 <>
100
Name
Aisha
Katharine
Gareth
Jo
Manjit
Ian
Michael
Ubaid
Simon
Mark
Gemma
Shan
Alex
Philip
SELECT Name FROM Marksheet W HERE Assign2
< 65
Name
Aisha
Jo
Manjit
Ian
Michael
Ubaid
Simon
Mark
Shan
Alex
SELECT Name FROM Marksheet W HERE Assign3
>= 60
Name
Aisha
Fiona
Gareth
Manjit
Gemma
Philip
18.3
SELECT Name FROM Marksheet W HERE Assign2 <=65
Name
Aisha
Gareth
Jo
Manjit
Ian
Michael
Ubaid
Simon
Mark
Shan
Alex
SELECT Name, Av erage FROM Marksheet W HERE
Av erage > 75
Average
Fiona
Philip
SELECT Name, Av erage FROM Marksheet W HERE Av erage > 0 AND Av erage < 65
Name
Aisha
Jo
Ian
Michael
Ubaid
Simon
Mark
Shan
Alex
SELECT Name, Assign1, Assign2, Assign3 FROM Marksheet W HERE Assign1 <= 40 AND Assign2 <= 40 AND
Assign3 <= 40
Name
Assign1
Assign2
Ian
13
17
Mark
0
25
Shan
30
37
SELECT Name FROM Marksheet W HERE Assign1 < 50 OR Assign2 < 50 OR Assign3 < 50
18.4
Name
Katharine
Jo
Ian
Michael
Mark
Shan
Alex
Shan
a) SELECT Song_Title, Track_No, Time, Artist FROM Song, Album
b) SELECT Song_Title, Album_Title FROM Song, Album W HERE Artist = “Countdown Kids”
18.5
a) INSERT INTO Food_Item VALUES (“5500C”,”Pork Pie”,2.45,”S100/C”,150)
Assign3
26
15
39
b) UPDATE Food_Item SET (Quantity_In_Stock=415) W HERE Product_Code=”1237T”
18.6
UPDATE Supplier SET (Email=”[email protected]”) W HERE Supplier_Code=”S100/C”
18.7
a) DELETE FROM Song W HERE Song_Title=”The Pinky Ponk”
c) CREATE TABLE ExamTimetable (Examination TEXT, Date DATE/TIME, Time DATE/TIME, Duration INTEGER,
Taken_Place BOOLEAN)
18.8
a)
SELECT First_Name, Surname FROM Choices W HERE Subject1 = ‘English’ AND Subject2 = ‘Maths’
First_Name
Surname
Julie
Dav ies
Adam
Lewis
Cala
Dickenson
b)
SELECT StudentID, English FROM TestScores W HERE English <= 50
StudentID
GMM2
LMRM1
ABL1
GML2
CJM1
AK4
LTD2
c)
English
42
49
17
35
36
49
39
SELECT * FROM Choices W HERE Subject3 = ‘Music’
StudentID
MH1
CJC1
BD3
LMRM1
AK4
CJD1
First_Name
Mandeep
Chris
Ben
Lewis
Amelie
Cala
Surname
Heer
Charter
Dodd
Mitchell
Khalil
Dickenson
Subject1
English
English
English
Computer Science
Maths
English
Subject2
History
History
German
History
Biology
Maths
Subject3
Music
Music
Music
Music
Music
Music
d)
SELECT Subject1, Subject2, Subject3 FROM Choices W HERE Student_ID IN (‘CJC1’, ‘GML2’, ‘AK3’,
‘CJD1’)
StudentID
CJC1
GML2
AK3
CJD1
e)
18.9
Subject2
History
Computer Science
Chemistry
Maths
Subject3
Music
History
Physics
Music
SELECT * FROM TestScores WHERE Maths BETW EEN 0 AND 60
StudentID
JMD1
CJC1
LMRM1
ABL1
AK3
LTD2
f)
Subject1
English
English
Biology
English
English
76
59
49
17
93
39
Maths
55
54
24
49
3
40
Science
55
22
79
65
80
52
ComputerScience
40
41
55
67
24
42
German
46
21
44
78
91
55
History
68
80
83
49
29
43
SELECT StudentID, First_Name, Surname FROM Choices W HERE Surname LIKE D%
StudentID
First_Name
Surname
JMD1
Julie
Dav ies
BD3
Ben
Dodd
CJD1
Cala
Dickenson
LTD2
Lola
Dukes
a)
update Lola Dukes’s Subject3 from History to Physics:
Music
24
53
67
65
81
30
UPDATE Choices SET (Subject3=”Physics”) W HERE StudentID=”LTD2”
b)
insert a new record into the Choices table as follows:
INSERT INTO Choices VALUES (“MW 2”,”Marie”,”Wright”,”German”,”History”,”Music”)
c)
delete records from both tables for the student with the StudentID AK3:
DELETE FROM Choices, TestScores W HERE StudentID=”AK3”
d)
display the first name, surname and English score of all students:
SELECT First_Name, Surname, English FROM Choices, TestScores