Term pack
Grade 8 Computer Science
Name: ________________________
Skills in this pack
- Hexadecimal numbers
- Text as numbers
- The boxes that make a network work
- The shapes a network is built in
- Addresses and names on a network
- Spreadsheet functions
- Copying formulas, and references that stay put
- Charts from a spreadsheet
- Loops that count
- Blocks and indentation
- Loops inside loops
- Procedures, and calling them
- Procedures that take values and give one back
Free at www.arenapublications.com/learn — no account, no ads, ever.
Grade 8 Computer Science · 1 of 13
Hexadecimal numbers
Read a hexadecimal number, turn it into decimal or into binary, and say why programmers write bits this way.
1.Match each hexadecimal digit to the four bits it stands for.
- 4
- 7
- 9
- D
- E
- 1101
- 0111
- 1001
- 0100
- 1110
2.Write the decimal number 45 in hexadecimal. Use two hexadecimal digits.
3.Two hexadecimal digits are written side by side. What is the largest decimal number the pair of them can hold between them?
- a) 255
- b) 256
- c) 128
- d) 99
4.Put these hexadecimal numbers in order, smallest first.
- B0
- 2A
- 1F
- 4D
- FF
5.Only one of these four is not a hexadecimal number at all. Which one?
- a) 3G4
- b) 72E
- c) 9FB
- d) A0C
6.Which point on the line is the hexadecimal number 3A written in decimal?
Mark the line with an X.
7.Sort each hexadecimal number by whether it comes to more than 100 in decimal.
Groups: More than 100 · Less than 100
- 5F
- 40
- C0
- 7A
- AA
- 3C
8.Write the hexadecimal number A7 as eight binary bits.
Hexadecimal numbers · Grade 8 Computer Science · www.arenapublications.com/learn
Grade 8 Computer Science · 2 of 13
Text as numbers
Work out the code number a character is stored as, and how many bytes a piece of text needs.
1.Capitals are stored from 65 and small letters from 97. A computer puts a list of words in order by the code number of the first character. Which of these words does it put first?
- a) Zebra
- b) banana
- c) apple
- d) cherry
2.A code with one byte per character can tell apart 256 different characters. Why is one byte per character not enough for the writing used around the world?
- a) Every character needs a whole byte of its own even when it is only a letter
- b) Every language would need a computer built specially for it
- c) Punctuation marks and gaps are not characters and have to be stored some other way
- d) The writing systems of the world need far more than 256 different characters between them
3.A message is stored with two bytes for every character. How many bytes does the word MOON need?
4.Every character takes one byte. How many bytes does the word ORBIT need?
5.In a computer's character code, capital A is stored as 65 and the capital letters that follow carry straight on. What number is stored for capital D?
6.Small a is stored as 97 and the small letters carry straight on from there. What number is stored for small f?
7.Digit characters run in order from 48, capitals from 65 and small letters from 97. Put these characters in order of the code number stored for each, smallest first.
- small d
- small z
- the digit character 7
- capital M
- capital B
8.Every character takes one byte, and the gaps between words are characters in their own right. How many bytes does the message GO TO BED need?
Text as numbers · Grade 8 Computer Science · www.arenapublications.com/learn
Grade 8 Computer Science · 3 of 13
The boxes that make a network work
Work out what a hub, a switch, a router, a modem and an access point each do, and choose the one a job needs.
1.A hub copies every message out to every other machine plugged into it. Four computers are on one hub, and each of the four sends one message. How many copies arrive at machines altogether?
2.A home has one box that joins its computers to each other, hands messages on to the outside world, and plugs into the line coming into the house. Someone says the home therefore has no modem. What is wrong with that?
- a) A box that joins computers to each other can never plug into a line
- b) A home has no need for a modem at all
- c) One box can do several jobs at once, and the part talking to the line is doing a modem's job
- d) A modem and a router are two names for exactly the same job
3.Two computers stand in the same room and are plugged into the same switch. One sends the other a file. Does the file pass through the router at the edge of the building?
- a) Yes — every message a computer sends passes through the router
- b) No — a message between two computers uses no device at all
- c) Yes, because the router holds the list of which machine is which
- d) No — both machines are on the same network, so the switch can deliver it by itself
4.Ten computers are plugged into one hub, which copies every message out to every other machine. The hub is swapped for a switch, which sends a message only to the machine it is addressed to. One computer now sends one message. How many fewer copies leave the device than before?
5.A school has two buildings, and each building has a network of its own. Messages now need to travel between the two. Which device does that job?
- a) A longer cable and nothing else
- b) A switch
- c) A router
- d) A hub
6.A lab with twenty machines has its hub taken out and a switch put in its place, and everything suddenly runs faster. What is the reason?
- a) A switch is built with thicker cables than a hub is
- b) A switch keeps a copy of every message so nothing ever needs sending twice
- c) Far fewer copies of each message are being put on the cables, so there is less traffic to get through
- d) A switch sits closer to the machines than a hub does
7.Match each device to the job it does.
- A hub
- A switch
- A router
- A modem
- An access point
- Delivers a message to the one machine it is addressed to
- Hands messages on between two different networks
- Turns signals into a form that can travel down the line to the outside world
- Lets a device with no cable of its own join the network
- Repeats everything it hears out to everything plugged into it
8.A message is sent from a computer in a lab to a machine on a network far away. Put these in the order the message reaches them.
- The switch that computer is plugged into
- A network outside the building
- The computer that sends the message
- The router at the edge of the building
The boxes that make a network work · Grade 8 Computer Science · www.arenapublications.com/learn
Grade 8 Computer Science · 4 of 13
The shapes a network is built in
Work out how much cable a bus, star, ring or mesh needs, and what a single break costs each of them.
1.Five computers are joined in a mesh, so every computer has its own cable to every other computer. How many cables is that altogether?
2.One cable is cut in each of these networks. Sort each one by whether every machine can still reach every other machine afterwards.
Groups: All of them can still reach each other · At least one is cut off
- A mesh of four computers, every one joined to every other, with one cable cut
- A star of six computers around a switch, with one outer cable cut
- A bus whose one long cable is cut halfway along
- A mesh of five computers, every one joined to every other, with one cable cut
- A single ring of eight computers, with one link broken
3.In a star network each computer has one cable of its own to the switch in the middle. One of those outer cables is cut. What happens?
- a) Every computer on the network is cut off from every other one
- b) Nothing changes at all, because messages take a different route
- c) The switch is cut off but the computers can still reach each other
- d) The computer on the far end of that cable is cut off, and the rest carry on as before
4.Tap the one part of this star network that every message between two computers has to pass through.
Write the number of the part.
5.A bus network joins nine computers along one long cable. The cable is cut, leaving four computers on one side of the break. How many pairs of computers, one taken from each side, have lost contact with each other?
6.Six computers are joined in a star. Each one has a single cable running to the switch in the middle, and no other cables at all. How many cables does the network use?
7.A star has eight computers around one switch. The switch itself stops working. How many of the eight can still reach another computer?
8.Twelve computers are joined in a single ring, each cabled to the computer on either side of it. How many cables does the ring use?
The shapes a network is built in · Grade 8 Computer Science · www.arenapublications.com/learn
Grade 8 Computer Science · 5 of 13
Addresses and names on a network
Read a machine's address, work out which machines share a network, and say what turns a name into an address.
1.Every address on one network begins 10.4.2, and the last number may be anything from 20 to 90. How many machines can that network hold?
2.Machines share a network when the first three of their four numbers match. Of the four numbers, which single one is the only thing telling two machines on one network apart? Answer with an ordinal such as second or third.
3.Someone types a name into a browser and the browser has never met that name before. Put these four things in the order they happen.
- The browser sends its request to that number
- The browser is handed a name
- The name service answers with the number
- The browser asks a name service which number goes with that name
4.A machine's address is four numbers separated by dots, and every one of the four runs from 0 to 255. Which of these could never be a machine's address?
- a) 192.168.0.300
- b) 172.16.254.9
- c) 100.200.50.25
- d) 10.0.0.1
5.Each of the four numbers in an address is held in one byte, so it runs from 0 up to the largest value one byte can hold. Which point on the line is that largest value?
Mark the line with an X.
6.Two machines share a network when the first three of their four numbers are the same. Each of these machines is sending to the machine at 192.168.4.9. Sort each sender by whether its message stays on one network.
Groups: Stays on one network · Crosses to another network
- 192.168.4.40
- 10.0.4.9
- 192.168.4.200
- 192.168.7.40
- 172.16.4.9
- 192.168.4.1
7.Machines share a network when the first three of their four numbers match. Match each machine to the network it is on.
- 192.168.1.7
- 192.168.2.7
- 10.1.1.7
- 172.16.5.7
- 10.1.2.7
- 192.168.2
- 10.1.1
- 172.16.5
- 10.1.2
- 192.168.1
8.A website is moved onto a different machine with a different address, and keeps the name it always had. What has to be changed so that people can still reach it?
- a) What the name service answers when it is asked about that name
- b) Every browser in the world, one at a time
- c) The name itself, so that it matches the new machine
- d) The address of the computer belonging to each person visiting
Addresses and names on a network · Grade 8 Computer Science · www.arenapublications.com/learn
Grade 8 Computer Science · 6 of 13
Spreadsheet functions
Work out what SUM, AVERAGE, MAX, MIN, COUNT and IF show for a sheet you are given.
1.A sheet holds C1 = 14, C2 = 3, C3 = 20 and C4 = 8. What number does this formula show?
=MAX(C1:C4)
2.A sheet holds E1 = 5, E3 = 9 and E4 = 2, and E2 has been left empty. COUNT looks at a range and counts only the cells holding a number. What number does this formula show?
=COUNT(E1:E4)
3.A sheet holds D1 = 12, D2 = 45, D3 = 7 and D4 = 31. What number does this formula show?
=MIN(D1:D4)
4.A sheet holds G1 = 72. This formula is typed into G2. What does G2 show?
=IF(G1 > 50, "Pass", "Try again")
5.A sheet holds M1 = 9, M2 = 4, M3 = 15 and M4 = 4. Sort each formula by whether it shows 15.
Groups: Shows 15 · Shows something else
- =M3
- =MIN(M1:M4)
- =SUM(M1:M2)+2
- =SUM(M2:M4)
- =COUNT(M1:M4)
- =MAX(M1:M4)
6.A sheet holds R1 = 4 and R2 = 6, and R3 has been left empty. What number does this formula show?
=AVERAGE(R1:R3)
7.A sheet holds H1 = 60. This formula is typed into H2. What does H2 show?
=IF(H1 >= 60, "Full marks", "Not yet")
8.A sheet holds V1 = 10, V2 = 4, V3 = 16 and V4 = 6. What number does this formula show?
=MAX(V1:V4) - MIN(V1:V4)
Spreadsheet functions · Grade 8 Computer Science · www.arenapublications.com/learn
Grade 8 Computer Science · 7 of 13
Copying formulas, and references that stay put
Work out what a formula points at once it has been copied, and use a dollar sign to stop a reference moving.
1.A dollar sign fixes the part of a reference it stands in front of. Cell H2 holds =H1*$B$1, and is copied across into I2. In the copy, which cell is $B$1 multiplied by?
2.Every one of these formulas sits in row 2 and is copied down into row 3. Match each formula to what the copy reads.
- =A2
- =$A2
- =A2+B2
- =A2*5
- =SUM(A1:A2)
- =A3*5
- =SUM(A2:A3)
- =A3+B3
- =A3
- =$A3
3.Each of these formulas sits in C2 and is copied down into C3. Sort each one by whether the copy reads any differently from the original.
Groups: The copy reads differently · The copy reads exactly the same
- =$A$2+$B$2
- =A2+B2
- =$A$1*3
- =$A2+$B2
- =A2*3
- =A$2+B$2
4.Column B holds a price on every row. One single rate sits in F1. A formula is to be written in C2 and then copied all the way down the column, multiplying each price by that rate. Which formula belongs in C2?
- a) =B2*F1
- b) =$B$2*F1
- c) =$B$2*$F$1
- d) =B2*$F$1
5.Cell A2 holds =A1+B1. The formula is copied into C5, so it has moved both across and down. In the copy, which cell takes the place of A1?
6.Cell A1 holds =B1+C1. The formula is copied down into A2. In the copy, which cell takes the place of B1?
7.A dollar sign fixes the part of a reference it stands in front of. Cell G4 holds =$G$1+G3, and is copied down into G5. In the copy, which cell is added to $G$1?
8.A times-table grid is being built. Column A holds the numbers going down and row 1 holds the numbers going across. One formula is written in B2 and then copied both across and down to fill the whole grid. Which formula belongs in B2?
- a) =A2*B1
- b) =$A$2*$B$1
- c) =$A2*B$1
- d) =A$2*$B1
Copying formulas, and references that stay put · Grade 8 Computer Science · www.arenapublications.com/learn
Grade 8 Computer Science · 8 of 13
Charts from a spreadsheet
Choose the kind of chart a set of numbers needs, and read amounts and shares off the chart that results.
1.A chart is drawn from a range of cells, one bar for each cell. Match each range to the number of bars the chart would have.
- B2:B5
- C1:C9
- D3:D8
- A2:A12
- E4:E10
- 7
- 6
- 9
- 11
- 4
2.A pie chart is drawn for 24 people, one of whom is you. How many degrees of the circle does a single person take?
3.A bar chart is drawn from the range D2:D13, one bar for each cell. Two of those cells have been left empty and no bar is drawn for them. How many bars does the chart have?
4.A bar chart's upright scale begins at 90 rather than at nothing. Two of its bars stand for 95 and for 100. What does the chart do to the difference between the two?
- a) Makes it look far smaller than it is
- b) Shows it exactly as it is
- c) Makes it look far bigger than it is
- d) Hides it, so that the two bars look identical
5.Someone draws a pie chart from the temperature at noon on each of four days. Why is a pie chart the wrong choice here?
- a) A pie chart cannot show a number larger than a hundred
- b) The four days would have to be put in order of temperature first
- c) A slice shows a share of one whole, and four temperatures added together make no whole of anything
- d) A pie chart can only ever show three things at a time
6.A sheet records how many of the 200 pupils in a year group joined each of four clubs, and every pupil joined exactly one. The chart is to show what share of the year group each club took. Which kind of chart is that?
- a) A chart with one point for each of the 200 pupils
- b) A line chart
- c) A pie chart
- d) A chart with a single bar for the whole year group
7.This bar chart has one bar for each of four shops. Tap the bar belonging to the shop that sold the second most.
Write the number of the part.
8.A sheet holds a shop's takings on each of thirty days running. The chart is to show whether they are climbing or falling as the days go by. Which kind of chart is that?
- a) A line chart
- b) A chart with one slice for each of the thirty days
- c) A pie chart
- d) A chart with a single bar for the thirty days together
Charts from a spreadsheet · Grade 8 Computer Science · www.arenapublications.com/learn
Grade 8 Computer Science · 9 of 13
Loops that count
Work out what values a counting loop's variable takes, and how many times its body runs.
1.A loop is wanted that goes round exactly seven times, with its counter starting at 1. How should its range be written?
- a) range(7, 1)
- b) range(1, 8)
- c) range(0, 7)
- d) range(1, 7)
2.Each of these loops prints its counter every time round. Match each range to the last number the loop prints.
- range(1, 6)
- range(4, 9)
- range(0, 3)
- range(7, 11)
- range(2, 15)
- 2
- 8
- 10
- 14
- 5
3.Put these ranges in order of how many times a loop over each of them would go round, fewest first.
- range(1, 5)
- range(3, 5)
- range(0, 7)
- range(10, 20)
4.The counter starts a long way above zero here. How many times does the indented line run?
for n in range(10, 20): print(n * 2)5.Sort each of these loop headings by how many times the body underneath it would run.
Groups: Three times · Four times
- for n in range(10, 14):
- for n in range(0, 4):
- for n in range(5, 8):
- for n in range(2, 6):
- for n in range(7, 10):
- for n in range(1, 4):
6.Look hard at the two numbers in the range. How many times does the indented line run?
for step in range(5, 5): print(step)- a) 10
- b) 1
- c) 5
- d) 0
7.A running total climbs inside this loop. What is total at the end?
total = 0 for n in range(1, 5): total = total + n8.Follow this code by hand. How many numbers does it print altogether?
for n in range(2, 7): print(n) print(n * 10)
Loops that count · Grade 8 Computer Science · www.arenapublications.com/learn
Grade 8 Computer Science · 10 of 13
Blocks and indentation
Read a program's indentation to say which lines belong to which block, and how often each line runs.
1.Follow this code by hand. What is count at the end?
count = 0 for n in range(1, 7): if n > 2: count = count + 1 count = count + 102.Follow this code by hand. How many times does the most deeply indented line run?
for n in range(1, 5): print(n) if n > 100: print(n * 2)3.Both of the printing lines are indented here. How many numbers does it print?
for n in range(1, 4): print(n) print(99)4.This program was meant to show the total once, at the very end, but it shows a number four times over. What went wrong?
total = 0 for n in range(1, 5): total = total + n print(total)- a) A program is only allowed to print one number in total
- b) The loop has been written to go round one time too many
- c) The printing line is indented, so it sits inside the loop and runs every trip round
- d) The total is set to 0 on the wrong line of the program
5.This one has an else branch as well. What is total at the end?
total = 0 for n in range(1, 5): if n > 2: total = total + 1 else: total = total + 1006.A test sits inside the loop here. What is total at the end?
total = 0 for n in range(1, 6): if n > 3: total = total + n7.The last line has been brought back out to the left. What is total at the end?
total = 0 for n in range(1, 4): total = total + 10 total = total + 18.Sort each line of this program by how many times it runs.
total = 0 for n in range(1, 4): total = total + n print(n) print(total) print(total * 2)Groups: Runs once · Runs three times
- print(total * 2)
- print(n)
- print(total)
- total = 0
- total = total + n
Blocks and indentation · Grade 8 Computer Science · www.arenapublications.com/learn
Grade 8 Computer Science · 11 of 13
Loops inside loops
Work out how many times the body of a loop inside another loop runs, and in what order the two counters change.
1.Follow this code by hand. What is count at the end? Notice that the inner range depends on the outer counter.
count = 0 for row in range(1, 5): for star in range(1, row + 1): count = count + 12.Follow this code by hand. How many numbers does it print?
for a in range(1, 3): for b in range(1, 3): print(b)3.In this program, which line runs the greatest number of times?
for a in range(1, 6): print(a) for b in range(1, 4): print(b) print(0)- a) The line printing a
- b) The line printing b
- c) The line printing 0
- d) The heading of the inner loop
4.In each of these, one loop sits inside another with a single line at the deepest level. Match each pair of ranges to how many times that line runs.
- range(1, 3) outside, range(1, 6) inside
- range(1, 4) outside, range(1, 8) inside
- range(1, 5) outside, range(1, 3) inside
- range(2, 5) outside, range(1, 5) inside
- range(1, 10) outside, range(1, 3) inside
- 10
- 12
- 21
- 18
- 8
5.In each of these, one loop sits inside another with a single line at the deepest level. Sort each one by how many times that line runs.
Groups: Eight times · Fifteen times
- range(1, 3) outside, range(1, 5) inside
- range(4, 8) outside, range(1, 3) inside
- range(1, 6) outside, range(2, 5) inside
- range(3, 8) outside, range(4, 7) inside
- range(2, 6) outside, range(3, 5) inside
- range(0, 5) outside, range(0, 3) inside
6.Follow this code by hand. What is the second number it prints?
for a in range(1, 4): for b in range(1, 4): print(a * 10 + b)7.Follow this code by hand. What is count at the end?
count = 0 for a in range(1, 5): for b in range(1, 6): count = count + 18.Follow this code by hand. How many times does the most deeply indented line run?
for a in range(1, 4): for b in range(1, 5): print(a * b)
Loops inside loops · Grade 8 Computer Science · www.arenapublications.com/learn
Grade 8 Computer Science · 12 of 13
Procedures, and calling them
Read a program that gives a block of lines a name, and say what runs, when, and how many times.
1.The named block below is called twice. How many numbers does it print?
def show(): print(1) print(2) show() show()2.A loop calls a block that calls another block. How many numbers does it print?
def inner(): print(1) def outer(): inner() inner() for n in range(1, 5): outer()3.A procedure whose body is a single printing line is used in five different programs. Match each way of using it to how many times its body runs.
- Defined but never called
- Called once at the end of the program
- Called inside a loop over range(1, 6)
- Called twice, and again inside a loop over range(1, 5)
- Called inside a loop over range(1, 3) that itself sits inside a loop over range(1, 5)
- 1
- 8
- 6
- 0
- 5
4.One of these four lines never runs at all. Which one?
def alpha(): print(1) def beta(): print(2) alpha() print(3)- a) The line printing 1
- b) The line calling alpha
- c) The line printing 3
- d) The line printing 2
5.A program has a procedure called show. Sort each of these by whether it makes the body of show run.
Groups: Makes the body run · Does not make the body run
- Writing show() on a line of its own
- Writing show() as the last line of the program
- Writing show() inside a procedure that is never called
- Writing def show(): with lines indented underneath it
- Writing show() inside a loop that goes round three times
6.Read this program from the top down. How many numbers does it print?
def show(): print(5)- a) 1
- b) 5
- c) It cannot be run at all
- d) 0
7.Follow this code by hand. How many times does the line printing 3 run?
def step(): print(3) for n in range(1, 5): step()8.One line prints before the call is reached. How many numbers does it print?
def show(): print(7) print(0) show()
Procedures, and calling them · Grade 8 Computer Science · www.arenapublications.com/learn
Grade 8 Computer Science · 13 of 13
Procedures that take values and give one back
Read a procedure that is handed values to work on, and work out what a call to it gives.
1.A procedure named grow takes a number and gives back that number plus a tenth of it. Which of these calls gives 55?
- a) grow(50)
- b) grow(60)
- c) grow(45)
- d) grow(55)
2.This procedure has a loop inside it. What number does it print?
def upto(n): total = 0 for k in range(1, n + 1): total = total + k return total print(upto(5))3.This procedure is handed two values rather than one. What number does it print?
def add(a, b): return a + b print(add(4, 9))4.A procedure named triple takes one number and gives back three times it. Sort each call by whether the value it gives is more than 20.
Groups: More than 20 · Less than 20
- triple(5)
- triple(6)
- triple(10)
- triple(8)
- triple(2)
- triple(7)
5.Follow this code by hand. What is total at the end?
def add(a, b): return a + b total = 0 for n in range(1, 5): total = add(total, n)6.One call sits inside another here. What number does it print?
def double(x): return x * 2 print(double(double(3)))7.A procedure named step takes a number and gives back 100 take away that number multiplied by itself. Put these calls in order of the value each one gives, smallest first.
- step(2)
- step(7)
- step(3)
- step(5)
8.A procedure named area takes a length and a width and gives back one multiplied by the other. Match each call to the value it gives.
- area(3, 4)
- area(5, 5)
- area(2, 9)
- area(6, 7)
- area(1, 8)
- 42
- 12
- 8
- 25
- 18
Procedures that take values and give one back · Grade 8 Computer Science · www.arenapublications.com/learn
Answer keys — Grade 8 Computer Science
In the same order as the worksheets.
Hexadecimal numbers
- 1. 4 → 0100; 7 → 0111; 9 → 1001; D → 1101; E → 1110
- 2. 2D
- 3. a) 255
- 4. 1. 1F 2. 2A 3. 4D 4. B0 5. FF
- 5. a) 3G4
- 6. 58
- 7. 5F → Less than 100; 7A → More than 100; 3C → Less than 100; C0 → More than 100; AA → More than 100; 40 → Less than 100
- 8. 10100111
Text as numbers
- 1. a) Zebra
- 2. d) The writing systems of the world need far more than 256 different characters between them
- 3. 8
- 4. 5
- 5. 68
- 6. 102
- 7. 1. the digit character 7 2. capital B 3. capital M 4. small d 5. small z
- 8. 9
The boxes that make a network work
- 1. 12
- 2. c) One box can do several jobs at once, and the part talking to the line is doing a modem's job
- 3. d) No — both machines are on the same network, so the switch can deliver it by itself
- 4. 8
- 5. c) A router
- 6. c) Far fewer copies of each message are being put on the cables, so there is less traffic to get through
- 7. A hub → Repeats everything it hears out to everything plugged into it; A switch → Delivers a message to the one machine it is addressed to; A router → Hands messages on between two different networks; A modem → Turns signals into a form that can travel down the line to the outside world; An access point → Lets a device with no cable of its own join the network
- 8. 1. The computer that sends the message 2. The switch that computer is plugged into 3. The router at the edge of the building 4. A network outside the building
The shapes a network is built in
- 1. 10
- 2. A mesh of four computers, every one joined to every other, with one cable cut → All of them can still reach each other; A star of six computers around a switch, with one outer cable cut → At least one is cut off; A single ring of eight computers, with one link broken → All of them can still reach each other; A bus whose one long cable is cut halfway along → At least one is cut off; A mesh of five computers, every one joined to every other, with one cable cut → All of them can still reach each other
- 3. d) The computer on the far end of that cable is cut off, and the rest carry on as before
- 4. 5 — The switch in the middle
- 5. 20
- 6. 6
- 7.
- 0
- none
- 8. 12
Addresses and names on a network
- 1. 71
- 2.
- fourth
- the fourth
- last
- the last
- 3. 1. The browser is handed a name 2. The browser asks a name service which number goes with that name 3. The name service answers with the number 4. The browser sends its request to that number
- 4. a) 192.168.0.300
- 5. 255
- 6. 192.168.4.40 → Stays on one network; 192.168.7.40 → Crosses to another network; 192.168.4.200 → Stays on one network; 10.0.4.9 → Crosses to another network; 192.168.4.1 → Stays on one network; 172.16.4.9 → Crosses to another network
- 7. 192.168.1.7 → 192.168.1; 192.168.2.7 → 192.168.2; 10.1.1.7 → 10.1.1; 172.16.5.7 → 172.16.5; 10.1.2.7 → 10.1.2
- 8. a) What the name service answers when it is asked about that name
Spreadsheet functions
- 1. 20
- 2. 3
- 3. 7
- 4. Pass
- 5. =MAX(M1:M4) → Shows 15; =SUM(M2:M4) → Shows something else; =MIN(M1:M4) → Shows something else; =M3 → Shows 15; =SUM(M1:M2)+2 → Shows 15; =COUNT(M1:M4) → Shows something else
- 6. 5
- 7. Full marks
- 8. 12
Copying formulas, and references that stay put
- 1. I1
- 2. =A2 → =A3; =$A2 → =$A3; =A2+B2 → =A3+B3; =A2*5 → =A3*5; =SUM(A1:A2) → =SUM(A2:A3)
- 3. =A2+B2 → The copy reads differently; =$A$2+$B$2 → The copy reads exactly the same; =A$2+B$2 → The copy reads exactly the same; =$A2+$B2 → The copy reads differently; =A2*3 → The copy reads differently; =$A$1*3 → The copy reads exactly the same
- 4. d) =B2*$F$1
- 5. C4
- 6. B2
- 7. G4
- 8. c) =$A2*B$1
Charts from a spreadsheet
- 1. B2:B5 → 4; C1:C9 → 9; D3:D8 → 6; A2:A12 → 11; E4:E10 → 7
- 2. 15
- 3. 10
- 4. c) Makes it look far bigger than it is
- 5. c) A slice shows a share of one whole, and four temperatures added together make no whole of anything
- 6. c) A pie chart
- 7. 2 — The second shop
- 8. a) A line chart
Loops that count
- 1. b) range(1, 8)
- 2. range(1, 6) → 5; range(4, 9) → 8; range(0, 3) → 2; range(7, 11) → 10; range(2, 15) → 14
- 3. 1. range(3, 5) 2. range(1, 5) 3. range(0, 7) 4. range(10, 20)
- 4. 10
- 5. for n in range(1, 4): → Three times; for n in range(0, 4): → Four times; for n in range(5, 8): → Three times; for n in range(2, 6): → Four times; for n in range(7, 10): → Three times; for n in range(10, 14): → Four times
- 6. d) 0
- 7. 10
- 8. 10
Blocks and indentation
- 1. 64
- 2.
- 0
- none
- 3. 6
- 4. c) The printing line is indented, so it sits inside the loop and runs every trip round
- 5. 202
- 6. 9
- 7. 31
- 8. total = 0 → Runs once; total = total + n → Runs three times; print(n) → Runs three times; print(total) → Runs once; print(total * 2) → Runs once
Loops inside loops
- 1. 10
- 2. 4
- 3. b) The line printing b
- 4. range(1, 3) outside, range(1, 6) inside → 10; range(1, 4) outside, range(1, 8) inside → 21; range(1, 5) outside, range(1, 3) inside → 8; range(2, 5) outside, range(1, 5) inside → 12; range(1, 10) outside, range(1, 3) inside → 18
- 5. range(2, 6) outside, range(3, 5) inside → Eight times; range(1, 6) outside, range(2, 5) inside → Fifteen times; range(1, 3) outside, range(1, 5) inside → Eight times; range(0, 5) outside, range(0, 3) inside → Fifteen times; range(4, 8) outside, range(1, 3) inside → Eight times; range(3, 8) outside, range(4, 7) inside → Fifteen times
- 6. 12
- 7. 20
- 8. 12
Procedures, and calling them
- 1. 4
- 2. 8
- 3. Defined but never called → 0; Called once at the end of the program → 1; Called inside a loop over range(1, 6) → 5; Called twice, and again inside a loop over range(1, 5) → 6; Called inside a loop over range(1, 3) that itself sits inside a loop over range(1, 5) → 8
- 4. d) The line printing 2
- 5. Writing show() on a line of its own → Makes the body run; Writing def show(): with lines indented underneath it → Does not make the body run; Writing show() inside a loop that goes round three times → Makes the body run; Writing show() inside a procedure that is never called → Does not make the body run; Writing show() as the last line of the program → Makes the body run
- 6. d) 0
- 7. 4
- 8. 2
Procedures that take values and give one back
- 1. a) grow(50)
- 2. 15
- 3. 13
- 4. triple(5) → Less than 20; triple(8) → More than 20; triple(7) → More than 20; triple(6) → Less than 20; triple(10) → More than 20; triple(2) → Less than 20
- 5. 10
- 6. 12
- 7. 1. step(7) 2. step(5) 3. step(3) 4. step(2)
- 8. area(3, 4) → 12; area(5, 5) → 25; area(2, 9) → 18; area(6, 7) → 42; area(1, 8) → 8
Grade 8 Computer Science · www.arenapublications.com/learn