Documente Academic
Documente Profesional
Documente Cultură
Lesson 1 activities
Activity 1.1
Fill in this table to help you see what a difference compression makes to file size.
1
Activity 1.2
Your teacher is going to read out a series of binary numbers. The first pair of binary
numbers represents a colour code as follows:
00 = blue
01 = white
10 = yellow
11 = green
The second set of binary numbers represents the run length of the colour. So, for
example, 00, 1101 represents 13 blue pixels.
Assuming each of the squares in the grid below represents one pixel, listen to the
series of binary numbers and shade the squares. The first line of pixels has been done
for you.
Line 1: 00 0001 01 0011 00 1100
2
Activity 1.3 (homework)
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
3
Line 13
Line 14
Line 15
Line 16
4
Lesson 2 activities
Activity 2.1
Use the image you encoded for your homework to complete these calculations.
Extension
Imagine that an image:
contains 1,024 pixels (a grid of 32 pixels by 32 pixels)
contains 255 different colours (represented by 8 bits)
The image has been encoded using RLE, producing 116 binary codes comprising 8 bits
(to represent the 255 colours) and 5 bits (to represent the colour run length).
Using this information, calculate:
5
Activity 2.2
Use the Run Length Encoding Calculator to encode these text strings.
AAAABBBBBBBBBCADDDDEEFFFFFF
FF
ABCABCABCABCABCABCABCABCAB
CS
BBGGYYAACCFFEEBBGGYYAACCFF
EE
Why is this?
6
Activity 2.3
An RLE compression algorithm works by removing repeated data and replacing it with a
number representing the run length of that item.
3. Compare the first character with the next character on the right.
7. Go back to step 2 and repeat until you reach the end of the string.
8. _____________________________________________________.
o AAAABBBBBBBBBCADDDDEEFFFFFFFF
o ABCABCABCABCABCABCABCABCABCS
o BBGGYYAACCFFEEBBGGYYAACCFFEE
Write a program in Python to implement the RLE compression algorithm you completed
in Activity 2.3.
7
Lesson 3 activities
Activity 3.1
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.
The 2 3
wheels 2 6
on 2 2
the 2 3
bus
go
round
and
all
day
long
8
Activity 3.2
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.
Use the lookup table you have completed to encode the song, replacing repeated
words with the number representing their position in the table.
9
Activity 3.3
10
‘Short and Sweet’
Complete the worksheet activity ‘Short and Sweet’ from Computer Science Unplugged.
Complete the worksheet activity ‘Extra for Real Experts’ from Computer Science
Unplugged.
11
Lesson 4 activities
Activity 4.1
Use an image editor, such as pixlr’s photo editor online, to experiment with
compression. Start with an uncompressed BMP file. Fill in this table.
12
Activity 4.2
Use a media player such as iTunes to experiment with music compression by encoding
a music file using different bit rates.
File size:
13
Activity 4.3
14
Lesson 5 activities
Activity 5.1
Hint: H = E and W = T
Activity 5.2
Businesses
Individuals
Governments
E-traders
The military
15
Activity 5.3 (homework)
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!
16
Lesson 6 activities
Activity 6.1
Activity 6.2
Produce a step-by-step guide to decrypting messages that have been encoded using a
Caesar cipher.
17
Lesson 7 activities
Activity 7.1
Activity 7.2
Hint: The inputs to the function should be the text to be decrypted and the shift to be
applied.
Hint: The function should return the decrypted message.
Activity 7.3
There is really no need to have separate functions to encrypt and decrypt messages.
Produce a new function caesar_cipher that does both.
Hint: The function will need a third argument: a string ‘action’ to determine whether the
message has to be encrypted or decrypted.
18
Activity 7.4
Write a user interface for the caesar_cipher you produced in Activity 7.3. It should ask
the user to select whether they want to encrypt a message, decrypt a message or exit
the program.
19
Lesson 9 activities
Activity 9.1
List as many different types of digital computers as you can. Look for computers both in
the past as well as the present, and for objects that contain embedded computers.
Activity 9.2
Sort the things in this list according to whether they are hardware or software.
Mouse
Computer program
Web browser
Microphone
CPU
Hard disk drive
Digital camera
Windows operating system
DVD drive
Touch screen
Word processor
Speakers
Spreadsheet
Printer
Mobile phone app
Android operating system
SD memory card
20
Hardware Software
Answer these questions to summarise what you have learned in this lesson.
What is a digital computer?
21
Lesson 10 activities
Activity 10.1
Write a computer program that asks the user to type in three numbers, adds them
up and then displays the answer on the screen.
Explain your program using the input-process-output model.
Select two actions you complete regularly and describe them in terms of the input-
process-output model.
22
Lesson 11 activities
Activity 11.1
Activity 11.2
This diagram represents the way in which buses connect the main hardware
components in a digital computer. Copy and complete the diagram using these labels:
CPU
Memory
Input/output devices
Data, control and address bus
23
Activity 11.3
From the function given, identify and insert the name of the correct bus.
Function Type of bus
Activity 11.4
24
Lesson 12 activities
Activity 12.1
e.g. Windows
Activity 12.2
Assuming that the user is the outer circle, use the labels ‘hardware’, ‘application
software’ and ‘operating system’ for the other circles to show the role of the operating
system.
_______
_______
_______
user
25
Activity 12.3
Using a non-networked computer and the operating system of your choice, do the
following:
Here is a list of useful Raspbian (Unix) and Command Line Interpreter (LX Terminal) file
and directory commands.
Commands Function
ls -l List the files in the current working directory displaying all the
details about the files
Activity 12.4
Bring up the task manager in whatever operating system you are using (in
Windows, control/alt/del).
Find the networking information within the task manager (in Windows, choose the
networking tab).
What happens when the user accesses the network, for example by opening a web
page or accessing information on a server?
26
Activity 12.5
Bring up the task manager in whatever operating system you are using (in
Windows, control/alt/del).
Find the user information within the task manager (in Windows, choose the user
tab).
List the users who are using your computer. What information can you find out
about them?
27
Lesson 13 activities
Activity 13.1
Open up the operating system’s task manager (in Windows, control/alt/delete) and
find the list of applications running (in Windows, choose the Applications tab).
Now find the information on the processes running (in Windows, choose the
Processes tab). Scroll up and down the list to see how many processes it takes to
run the operating system and any applications you currently have open.
Now open up a few applications, e.g. a web browser, word processor, spreadsheet
software, a graphics package.
Answer these questions:
1. What happens to the list of applications?
2. What happens to the number of processes running on the computer?
3. Try to explain why there are more processes running than applications
running.
Activity 13.2
Your teacher will run this activity. The instructions are here for information only.
Requirements
Large stick notes
White board
Two tables
Area for process queue
Stop watch
Pens
Two students who represent the operating system (“OS1” will allocate the process
ID and time slots, “OS2” will send the next process to the CPU)
One student who represents the “CPU”
One student who represents the “user” who is running the programs
Sixteen other students who represent the programs and applications and who will
be the “processes” (just add more programs/applications depending of number of
students in group)
Starting positions
The “CPU” should sit at a table with a pen and stop watch.
“OS1” needs a pen and an empty process table drawn on a whiteboard (add more
rows as required:
Process ID Name of program or application
28
Allocate a queue area where the “processes” will stand in order while they wait to
be “executed” after they have been allocated a process ID.
The “user” sits at table with a pen and sticky notes.
Word processor
Web browser
Sound program
Myprog.py
Sort.py
Word processor
Myprog.py
Spreadsheet
Sort.py
Word processor
Spreadsheet
Web browser
Sound program
Web browser
Sound program
Sort.py
The “user” hands the sticky note on which he/she has written a program or
application name to a student who will be that “process”.
The “process” goes to “OS1” who allocates the next free process ID from the
process table. “OS1” also allocates the correct number of time slots needed to
complete the process, according to the table below:
So, if the “process” hands “OS1” a sticky note that says “Word processor”, “OS1”
adds a process ID and three time slots “1, 2, 3” to the stick note and hands it back
to the “process”. “OS1” must also update the process table on the whiteboard.
The “process” joins the back of the queue holding up their sticky note.
29
“OS2” is constantly looking at the queue waiting for a process with a process ID.
They send the “process” at the top of the queue to the “CPU” table.
Each “process” gets 10 seconds to execute with the “CPU” – when the “process”
arrive at the table, “CPU” starts the stop watch, crosses one time slot off the sticky
note and then says “Time’s up” after 10 seconds. At this point, the “process” must
return to the back of the queue.
The “process” should check their sticky note. If all their time slots have been
crossed off, they should shout their process ID and “Finished” and then sit down.
When “OS1” hears that a process has finished, they should remove that process
from the process table
If the “process” still has time slots left they go to the back of the queue.
Repeat until all the processes have finished.
Alternatives
Change the length of the time slice (make it more or less than 10 seconds)
Add more or different programs/applications
Give the processes a priority which alters their position in the queue
30
Lesson 14 activities
Activity 14.1
The speed of a computer system is measured in frequency (cycles per second) using
the units hertz (Hz). One hertz is one cycle per second. This means that one instruction
is executed per second.
Find the speed of the processor in the computer systems you use and calculate how
many instructions they can process each second.
Activity 14.2
Your teacher will run this activity. The instructions are here for information only.
Resources
A class of pupils
A room such as a hall or an open space
On/off card
Explain that the class is going to act out the role of transistors in a CPU. When they are
on they stand up (show ON) and when they are off they sit down (show OFF). (This
works best if they are on the floor not on seats).
The pupils should stand apart from each other (stretch arms out so they cannot touch
each other). Show the ON and OFF cards slowly to start with, then speed up. Ask how
warm the class is feeling (they should be getting warmer just like a CPU).
Then explain that more and more transistors are being placed closer together to make
computers faster and able to perform more calculations.
31
Get the class to stand closer to each other. Then repeat the process getting faster and
faster. Ask how warm the class is feeling now.
This demonstrates how CPUs generate heat from the switching of thousands of
transistors.
Watch all of the Royal Institution lecture ‘Breaking the speed limit’:
http://www.youtube.com/watch?v=FTpdAjre8LU and then answer these questions.
1. What is a semi-conductor?
2. What is a transistor?
3. Why are “bunny suits” used when manufacturing microprocessors?
4. What is meant by parallel processing?
32
Lesson 15 activities
Activity 15.1
Check the system settings or search online for the technical specifications of the digital
computers that you use. Note down the name and speed of the CPU in each device, as
well as whether the CPU is a single core or multi-core processor.
Activity 15.2
Take a screen shot showing the CPU usage. (On Windows 7 select Task Manager
(control-alt-del) and select the Performance tab then click on the “Resource Monitor…”
button then click on CPU). Label the number of cores and the amount of CPU usage.
33
Lesson 16 activities
Activity 16.1
The main memory (or RAM) is made up of memory locations. Each memory location
has a unique address assigned to it. Data and instructions are stored in memory when
programs and applications run.
Place the following data and instructions into the memory location at the correct
address:
At address 0011 store the ASCII binary for ‘c’
At address 0100 store the ASCII binary for ‘a’
At address 0101 store the ASCII binary for ‘t’
At address 1001 store the binary value for 4
At address 1100 store the binary value for 65
At address 1110 store the binary value for 201
Store the first three letters of your name starting at address 0000
34
Activity 16.2
Calculate the maximum number of addressable memory locations for address buses of
the following sizes.
Activity 16.3
This activity gives you an opportunity to find out how much memory there is in the
computers you use.
Either check the system settings or search online for the technical specifications of your
computers and complete the table below. Add more rows if you need to.
35
Activity 16.4
Step 1
Step 2
Step 3
Step 1
Step 2
Step 3
Step 4
Activity 16.5
36
Activity 16.6 (homework)
Search online for companies that sell memory (such as http://www.crucial.com/). Find
three further facts about memory that you can share with the class.
Fact 1
Fact 2
Fact 3
37
Lesson 17 activities
Activity 17.1
Sort the following devices according to whether they are input or output devices.
Mouse
Speakers
Monitor
Touch screen
Keyboard
LED
Sensor
Microphone
Scanner
Printer
Web cam
Digital camera
38
Activity 17.2
In your group, identify all the input devices found on the digital computer you have been
assigned.
Activity 17.3
39
Lesson 18 activities
Activity 18.1
In your group, identify all the output devices found on the digital computer you have
been assigned.
Activity 18.2
40
Lesson 19 activities
Activity 19.1
Check the system settings of your digital computers or search online for their technical
specifications to find out the type of storage you are using.
Activity 19.2
Do the following:
o Save a file onto the magnetic hard disk drive.
o Burn a file on to a CD or DVD.
o Save a file on to a solid state drive or a memory stick.
Now describe in your own words how the data in the file was stored on each of
these types of storage.
Magnetic storage,
e.g. hard disk drive
41
Lesson 20 activities
Activity 20.1
Memory
Control unit
Arithmetic and logic unit (ALU)
Registers
PROCESSOR
Control bus
Address bus
Data bus
Draw lines to match the parts of the processor with the correct function.
Arithmetic and logic unit Holds the instruction that is currently being
(ALU) executed by the processor
42
Lesson 21 activities
Activity 21.1
The first column of the table contains some assembler instructions for the ARM1176JZ-
S processor. Match each assembler instruction with the correct action and underline the
part of the action that helped you know which assemble instruction it relates to. One
has been done for you.
Activity 21.2
Use the labels below to complete the diagram on the next page. The diagram shows
how high level programs are translated into machine code so that they can be run by
the CPU.
Labels
43
MOV R1, #50
MOV R7, #1
1111000011110000
1011100011100010
1010010010010100
44
Lesson 22 activities
Activity 22.1
Complete this diagram of the fetch-decode execute cycle using the labels below.
Labels
FETCH
DECODE
EXECUTE
Fetches the next instruction from memory and increments program counter
Decodes the bit pattern (machine code) into the instruction to be executed
Executes the instruction and stores the results in memory or registers
45
Activity 22.2
Guess how many fetch-decode-execute cycles are happening in the classroom at this
moment! Write your guess here:
Activity 22.3
Sort these stages of the fetch-decode-execute cycle into the correct order:
If the instruction uses data from memory, identify the memory addresses and fetch the
data from memory
Fetch the next instruction from main memory using the memory address in the
program counter register
46
FETCH
1.
2.
DECODE
3.
4.
EXECUTE
5.
6.
47
Lesson 23 activities
Activity 23.1
Label or colour code this assembly language instruction to show the opcode, and the
destination and input operands.
48
Activity 23.2
Hint: the MOV command actually puts a copy of the data in the specified register. The
original stays where it is.
R0 R1 R2
0 5 3
MOV R0, R1 5 5 3
MOV R1, R2 5 3 3
MOV R2, R0
R0 R1 R2
9 5 3
MOV R0, #0 0 5 3
49
R0 R1 R2
4 2 2
R0 R1 R2
0 7 5
Write an assembly language program to compute 3x + 6x. Assume that the value of x is
stored in register R5. Add comments to your code to make it easier to understand.
Hint: the MUL command can only have registers as operands so you will need to store
the immediate values 3 and 6 in registers.
50
Activity 23.3 (homework)
What is a mnemonic?
52
Lesson 24 activities
Activity 24.1
CMP R0, R1
MOVGT R2, R0
MOV R0, #5
MOV R2, #6
CMP R0, R2
MOVEQ R3, R0
MOVNE R3, R2
What will be the outcome of executing this piece of code if register R0 holds the value 9
and register R1 holds the value 15?
CMP R0, R1
SUBGT R0, R0, R1
SUBLT R1, R1, R0
What will be the outcome of executing this piece of code if register R0 held the value 3
and register R1 held the value 3?
CMP R0, R1
ADDGT R0, R0, R1
ADDLT R1, R1, R0
53
Write an assembly language program to swap the contents of register R1 and register
R2 if the value in R1 is greater than the value in R2. Add comments to your code to
make it easier to understand.
54
Activity 24.2
55
Activity 24.3 (homework)
56
Draw a flowchart to illustrate what this piece of code does.
57
Write an assembly language program to implement this algorithm.
58
59