Term pack
Year 10 Computing
Name: ________________________
Skills in this pack
- How strong a password is
- Spotting a phishing message
- The trail you leave online
- Working out a file size
- Making a file smaller
- Lists and their positions
- Looping over a list
- Building a list as you go
- Text inside a program
- Repeating while something is true
- Searching a list
- Putting a list in order
Free at www.arenapublications.com/learn — no account, no ads, ever.
Year 10 Computing · 1 of 12
How strong a password is
Work out how many different passwords a rule allows, and use that count to say which of two rules is harder to guess your way through.
1.Sort each of these rules by how many different passwords it allows.
Groups: Fewer than 1000 · More than 1000
- 2 characters, each one of 30
- 4 characters, each one of 7
- 2 characters, each one of 45
- 3 characters, each one of 11
- 2 characters, each one of 12
- 3 characters, each one of 9
2.A rule allows passwords of exactly 2 characters, and in each position it allows any of the 26 small letters and any of the 26 capital letters, and nothing else. How many passwords does the rule allow?
3.A password on one website is 3 characters long, and each character may be any of 20 letters. How many passwords does the website's rule allow?
4.One website's rule allows passwords 6 characters long, with 10 characters allowed in each position. Another website's rule allows passwords 4 characters long, with 30 characters allowed in each position. Which rule allows more passwords?
- a) There is not enough here to tell
- b) The rule with 6 characters and 10 choices
- c) The two rules allow exactly the same number
- d) The rule with 4 characters and 30 choices
5.A guessing machine gets through 200 passwords every second, and the rule it is working against allows 8400 different passwords. How many seconds does it need to try every one of them?
6.A rule allows 3 characters taken from a set of 20, and a guessing machine gets through 1000 passwords a second. How many seconds does the machine need before it has tried the lot?
7.A rule allows passwords of exactly 2 characters taken from a set of 30. It is changed to allow 4 characters, taken from that same set of 30. How many times more passwords does the new rule allow than the old one?
8.A rule allows passwords of 4 characters with 20 characters allowed in each position. It can be made stronger in one of two ways: one more character can be added to the length, or twenty more characters can be allowed in each position. Which change allows more passwords?
- a) The two changes allow exactly the same number
- b) Neither change makes any difference to the count
- c) Allowing twenty more characters in each position
- d) Adding one more character to the length
How strong a password is · Year 10 Computing · www.arenapublications.com/learn
Year 10 Computing · 2 of 12
Spotting a phishing message
Check a message against the five signs of a phishing attempt, working out for yourself whether the link in it belongs to whoever the message says it is from.
1.A school's own site name is “oakfield-school.com”. Sort each of these links by whose site it really belongs to.
Groups: The school's own site · Somebody else's site
- https://parents.oakfield-school.com/forms
- https://oakfield-school.com/term-dates
- https://oakfieldschool.com/term-dates
- https://oakfield-school.com.sign-in.net/account
- https://library.oakfield-school.com/books
- https://oakfield-school.net/term-dates
2.One of the five signs settles the matter on its own, however innocent the other four look. Which sign is it?
- a) It asks for a secret
- b) It is about something you never did
- c) It does not use your name
- d) It sets a deadline
3.A sports club's own site name is “riverside-club.com”. Which one of these links belongs to the club itself?
- a) https://riversideclub.com/members
- b) https://riverside-club.com/members
- c) https://members.riverside-club.net/join
- d) https://riverside-club.com.members-login.net/join
4.A message opens with your own name, links to the bank's own site name, mentions no time limit at all, and is about the payment you really did make yesterday. It asks you to type the code that has just arrived on your phone. What follows?
- a) No signs at all, so the message can be trusted
- b) One sign, which is too few to worry about
- c) Two signs, so the message cannot be trusted
- d) One sign, and that one sign is enough on its own
5.You have ordered nothing at all. A message reads “Dear Customer, your order cannot be sent. Send us the code that has just arrived on your phone within two hours or the order is cancelled.” It links to “https://orders.parcelpost.com.claim-it.net/fix”, and the courier's own site name is parcelpost.com. How many of the five signs does it show?
6.Sort each of these messages by whether it sets a deadline, which is the second of the five signs.
Groups: Sets a deadline · Sets no deadline
- Confirm within one hour or your prize is given away.
- Your password was changed on Tuesday.
- Your account will be closed in 24 hours unless you act.
- Your parcel is out for delivery today.
- Here is the reading list for next term.
- Pay by the end of the day or the charge doubles.
7.The link “https://library-account.check-now.net/renew” has been cut into its four pieces below. Which piece says whose site the link really belongs to?
- a) check-now.net
- b) https://
- c) /renew
- d) library-account.
8.A message comes from your school's own site name, school-office.com. It opens with your own name, is about the trip you signed up for last week, and gives no deadline of any kind. It asks you to type your password so you can see who else is going. Which one of the five signs does this message show?
- a) It asks for a secret
- b) It sets a deadline
- c) The link goes to somebody else's site
- d) It does not use your name
Spotting a phishing message · Year 10 Computing · www.arenapublications.com/learn
Year 10 Computing · 3 of 12
The trail you leave online
Work out how few harmless-looking facts it takes to narrow a crowd down to one person, and tell what a website is handed by you from what it is handed anyway.
1.In a group of 200 people, each year group is shared by 50 people; inside any one year group each birth month is shared by 5; and inside any one birth month each first initial is shared by 1. Match each set of facts to how many people could still be the person described.
- Nothing at all is known
- The year group
- The birth month, without the year group
- The year group and the birth month
- The year group, the birth month and the first initial
- 200
- 1
- 20
- 50
- 5
2.A form asks for 11 pieces of information about you. Four of them are genuinely needed to get a parcel to your door, and the rest are needed for nothing about the parcel at all. How many pieces is the form collecting that the parcel does not need?
3.A swimming pool has 1800 members. One in five of them swims before school, and one in three of those is in the same year group as you. How many members fit both of those facts?
4.A club has 720 members. Half of them are in the same year group as you. Of those, one in six has a birthday in the same month as you. Of those, one in twelve plays the flute. How many members share all three of those facts with you?
5.A game stores a nickname and a birth date for each of its 90 players. Another website stores a birth date and a real name for the same 90 people. Among the 90 there are 8 birth dates that are each shared by exactly two players, and every other birth date belongs to one player only. Laying the two lists side by side, how many of the 90 nicknames can be turned into a single real name?
6.In a group of 60 people, each year group is shared by 30 of them, each birth month by 5, each admission number by 1, each favourite sport by 12, each pairing of shoe size with birth month by 2, and each email address by 1. Sort each fact by how many people are left once you know it about somebody.
Groups: Leaves exactly one person · Leaves more than one person
- Their shoe size and birth month together
- Their admission number
- Their year group
- Their favourite sport
- Their email address
- Their birth month
7.A club has 600 members. Put these facts in order of how many members each one leaves, fewest first.
- Is in the same year group as you, which one member in every two is
- Travels by bus, which one member in every five does
- Plays the cello, which one member in every twenty-five does
- Born in the same week as you, which one member in every hundred is
8.You visit a website and type nothing into it at all. Which of these does the website learn anyway?
- a) Your date of birth
- b) The time you arrived
- c) The password to your email
- d) The name of your school
The trail you leave online · Year 10 Computing · www.arenapublications.com/learn
Year 10 Computing · 4 of 12
Working out a file size
Work out how many bytes a picture, a piece of text or a recording takes up, from how many things are in it and how many bytes one of those things needs.
1.A recording stores 16000 samples every second, each sample taking 2 bytes, and it lasts 3 seconds. How many bytes does the recording take?
2.Put these files in order of size, smallest first.
- 500 samples a second for 5 seconds, 1 byte each
- 800 characters, 1 byte each
- 45 pixels by 40 pixels, 1 byte per pixel
- 20 pixels by 20 pixels, 3 bytes per pixel
3.A colour picture is 200 pixels wide and 150 pixels tall, and 3 bytes are stored for every pixel. How many bytes does it take?
4.A picture takes 7200 bytes altogether and stores 2 bytes for every pixel. How many pixels does the picture have?
5.Sort each of these files by whether it takes more than 10000 bytes.
Groups: More than 10000 bytes · Fewer than 10000 bytes
- 50 pixels by 40 pixels, 3 bytes per pixel
- 60 pixels by 80 pixels, 1 byte per pixel
- 120 pixels by 90 pixels, 1 byte per pixel
- 3000 characters, 1 byte each
- 70 pixels by 70 pixels, 3 bytes per pixel
- 2000 samples a second for 8 seconds, 1 byte each
6.One picture is 100 pixels by 80 pixels with 1 byte per pixel. Another is 50 pixels by 40 pixels with 3 bytes per pixel. Which is larger, and by how much?
- a) The two are exactly the same size
- b) The second, by 2000 bytes
- c) The first, by 4000 bytes
- d) The first, by 2000 bytes
7.A recording stores 8000 samples every second, and each sample takes 2 bytes. How many bytes does 5 seconds of it take?
8.Match each file to the number of bytes it takes.
- 24 pixels by 25 pixels, 1 byte per pixel
- 1500 characters, 1 byte each
- 30 pixels by 30 pixels, 2 bytes per pixel
- 400 samples a second for 6 seconds, 1 byte each
- 20 pixels by 15 pixels, 3 bytes per pixel
- 1500
- 900
- 1800
- 2400
- 600
Working out a file size · Year 10 Computing · www.arenapublications.com/learn
Year 10 Computing · 5 of 12
Making a file smaller
Squeeze a run of repeated values into a count and a value, work out what that saves, and recognise the rows where it costs more than it saves.
1.A picture is 20 pixels wide and 15 pixels tall. Every row of it is a single colour the whole way across, and a run is never allowed to carry on from one row into the next. How many runs does the whole picture have?
2.A row of pixels reads “RRRRRRRGGG”. Write it in counted form, using a number and then the letter for each run.
3.Put these rows of pixels in order of how many runs each one has, fewest first.
- RRWWBBGG
- GGGGGGGG
- RRRRWWWW
- RGBRGBR
4.A row of 20 pixels changes colour at every single pixel along it. Writing it as runs costs two things per run. What does counting the runs do to the size of this row?
- a) It leaves it at exactly 20 things
- b) It halves it, from 20 things to 10
- c) It brings it down to 2 things
- d) It doubles it, from 20 things to 40
5.Two photographs have exactly the same number of pixels. One is of a clear sky and the other is of a crowd of people. Counting runs makes one of them much smaller than the other. Which one, and why?
- a) The sky, because long stretches of it are the same colour
- b) The sky, because it has fewer pixels in it
- c) Neither: counting runs saves the same amount on any picture
- d) The crowd, because there are more colours in it altogether
6.Match each row of pixels to the number of runs it has.
- BBBWWBB
- RRRRRRRR
- RGRGRG
- WWWWBB
- RRGGBBRRG
- 1
- 6
- 5
- 2
- 3
7.A row of 90 pixels has 12 runs. Written out pixel by pixel it costs one thing per pixel; written as runs it costs two things per run. How many things does writing it as runs save?
8.A counted row reads “4W2B5W”. How many pixels long is the row it stands for?
Making a file smaller · Year 10 Computing · www.arenapublications.com/learn
Year 10 Computing · 6 of 12
Lists and their positions
Read a value out of a list by its position, count how many values a list holds, and work out which position the last value sits at.
1.A list called xs holds 8 values. Which one of these reads the last of them?
- a) xs[7]
- b) xs[9]
- c) xs[len(xs)]
- d) xs[8]
2.This program reads the very first value out of a list. What does it print?
marks = [6, 1, 8, 3] print(marks[0])
3.A list can hold a single value and still be a list. What does this program print?
only = [17] print(len(only) + only[0])
4.How many values does the list in this program hold?
counts = [5, 2, 9, 4, 7, 1] print(len(counts))
5.The list in this program holds five values. Sort each of these lines by whether it can be run at all.
xs = [3, 8, 1, 6, 2]
Groups: Reads a value out of the list · Falls off the end of the list
- xs[len(xs)]
- xs[5]
- xs[0]
- xs[len(xs) - 1]
- xs[4]
- xs[2]
6.This one reads a value from further along the same kind of list. What does it print?
heights = [12, 15, 11, 19, 14] print(heights[3])
7.This program works out the last position for itself rather than being told it. What does it print?
temps = [21, 19, 24, 22, 20] print(temps[len(temps) - 1])
8.This program prints the position the last value sits at, rather than the value itself. What does it print?
days = [2, 8, 5, 6, 9] print(len(days) - 1)
Lists and their positions · Year 10 Computing · www.arenapublications.com/learn
Year 10 Computing · 7 of 12
Looping over a list
Follow a loop that takes each value of a list in turn, and work out the total, the count or the largest value it leaves behind.
1.The program below is run again with each of these lists written into its first line. Sort each list by the total the loop leaves behind.
values = [6, 6] total = 0 for n in values: total = total + nGroups: A total of more than 20 · A total of less than 20
- [5, 5, 5]
- [4, 3, 2]
- [12, 11]
- [10, 9, 6]
- [7, 8, 9]
- [1, 1, 1, 1]
2.This one multiplies rather than adds, so what it starts from matters. What does it print?
sizes = [2, 3, 4] product = 1 for s in sizes: product = product * s print(product)3.The list this loop is given has nothing in it at all. What does the program print?
readings = [] total = 0 for r in readings: total = total + r print(total)- a) 0
- b) 1
- c) There is no way to tell
- d) Nothing at all
4.A running total is built up from a list here. What does this program print?
marks = [4, 7, 2, 5] total = 0 for m in marks: total = total + m print(total)5.Every value in this list has ten added to it before printing. What is the last number the program prints?
nums = [6, 1, 8, 5] for n in nums: print(n + 10)6.Two counters are kept at once here, and the last line compares them. What does the program print?
marks = [7, 3, 9, 2, 6] passes = 0 fails = 0 for m in marks: if m > 5: passes = passes + 1 else: fails = fails + 1 print(passes - fails)7.This loop does not add the values up. It counts how many of them pass a test. What does it print?
scores = [3, 8, 2, 9, 6] count = 0 for s in scores: if s > 5: count = count + 1 print(count)8.This loop keeps hold of the largest value it has met so far. What does it print?
temps = [17, 23, 19, 25, 21] best = 0 for t in temps: if t > best: best = t print(best)- a) 17
- b) 21
- c) 105
- d) 25
Looping over a list · Year 10 Computing · www.arenapublications.com/learn
Year 10 Computing · 8 of 12
Building a list as you go
Start from an empty list and add to it inside a loop, and work out how many values end up in it and what sits at each position.
1.A running total is appended each time round here, so the list holds the totals rather than the values. What does the program print?
totals = [] running = 0 for n in range(1, 5): running = running + n totals.append(running) print(totals[3])2.There are two appends inside this loop rather than one. How many values does the list end up with?
names = [] for n in range(1, 4): names.append(n) names.append(n * 10) print(len(names))3.This program starts with an empty list and puts one value into it each time round. How many values does it end up with?
squares = [] for n in range(1, 5): squares.append(n * n) print(len(squares))4.The program below is run again with each of these ranges written into its loop heading. Sort each range by how many values the list ends up holding.
kept = [] for n in range(0, 4): kept.append(n)Groups: Leaves 3 values · Leaves 5 values
- range(0, 5)
- range(10, 13)
- range(20, 25)
- range(7, 10)
- range(1, 6)
- range(2, 5)
5.This one prints the value that ended up at the front of the list. What does it print?
squares = [] for n in range(1, 6): squares.append(n * n) print(squares[0])6.This test lets some of the counter's values through and stops the rest. How many values does the list end up with?
kept = [] for n in range(0, 10): if n > 6: kept.append(n) print(len(kept))7.The program below is run again with each of these ranges written into its loop heading. Match each range to the value that ends up last in the list.
made = [] for n in range(0, 4): made.append(n * 3)- range(1, 4)
- range(2, 6)
- range(0, 3)
- range(4, 8)
- range(5, 9)
- 6
- 21
- 9
- 24
- 15
8.Only some of the counter's values get into this list. What does the program print?
found = [] for n in range(1, 8): if n * n > 20: found.append(n) print(found[0])- a) 6
- b) 5
- c) 4
- d) 25
Building a list as you go · Year 10 Computing · www.arenapublications.com/learn
Year 10 Computing · 9 of 12
Text inside a program
Work out how many characters a piece of text holds, which character sits at a given position, and what joining two pieces of text end to end gives.
1.The same short piece of text is joined to itself twice over. What does this program print?
tag = "ab" joined = tag + tag + tag print(len(joined))
2.Two pieces of text are joined and the length of the result is printed. What does this program print?
a = "web" b = "page" print(len(a + b))
- a) 2
- b) 4
- c) 8
- d) 7
3.The text is the same for all of these. Match each line to what it prints.
word = "network"
- print(word[0])
- print(word[3])
- print(word[6])
- print(len(word))
- print(word[len(word) - 2])
- k
- r
- n
- 7
- w
4.Two pieces of text are joined end to end here and the result is printed. What does the program print?
first = "sun" second = "rise" print(first + second)
5.Look carefully at what is between the quote marks in this one. What does it print?
words = "two words" print(len(words))
- a) 8
- b) 9
- c) 10
- d) 4
6.A character is read out of the joined text rather than out of either of the two pieces. What does this program print?
left = "top" right = "most" joined = left + right print(joined[3])
7.This program starts with a piece of text holding nothing at all and joins something on to it each time round. What does it print?
line = "" for n in range(0, 4): line = line + "ab" print(len(line))8.This one works out the last position for itself before reading a character from it. What does it print?
word = "screen" print(word[len(word) - 1])
Text inside a program · Year 10 Computing · www.arenapublications.com/learn
Year 10 Computing · 10 of 12
Repeating while something is true
Follow a loop that keeps going while a condition holds, working out what it leaves behind and how many times it went round.
1.This loop doubles a number until the condition stops holding. What does the program print?
n = 1 while n < 20: n = n * 2 print(n)2.This loop is left holding a value the condition would not have allowed it to start from. What does the program print?
n = 64 steps = 0 while n > 5: n = n - 12 steps = steps + 1 print(n)3.In each of these a variable starts at 1 and is multiplied by the number shown every time round, and the loop keeps going while the variable is below 100. Match each multiplier to the value the variable is left holding.
- Multiplied by 2 each time
- Multiplied by 3 each time
- Multiplied by 5 each time
- Multiplied by 10 each time
- Multiplied by 4 each time
- 243
- 128
- 125
- 100
- 256
4.A second variable here does nothing but count the trips. What does the program print?
count = 0 total = 0 while total < 30: total = total + 7 count = count + 1 print(count)5.A loop's condition is that n is greater than 0, its body adds 1 to n, and n holds 10 when the loop is reached. What happens when this program is run?
- a) It goes round once
- b) It does not go round at all
- c) It never stops on its own
- d) It goes round ten times
6.Look at the condition before you follow anything. What does this program print?
n = 5 while n > 10: n = n + 1 print(n)- a) 10
- b) 11
- c) 5
- d) 6
7.Money is put by each week until there is enough. What does this program print?
money = 50 weeks = 0 while money < 200: money = money + 25 weeks = weeks + 1 print(weeks)8.Both variables change every time round here, and only one of them is in the condition. What does the program print?
total = 0 n = 1 while total < 20: total = total + n n = n + 1 print(n)
Repeating while something is true · Year 10 Computing · www.arenapublications.com/learn
Year 10 Computing · 11 of 12
Searching a list
Follow a search that goes through a list from the front until it finds what it wants, and work out where it stops and how many values it had to look at.
1.Why does a search have to look at every value in a list before it can say that the value it wants is not there?
- a) Because a list has no way of saying how long it is
- b) Because the search always begins at the last value
- c) Because a search cannot count how many values it has looked at
- d) Because the value it has not looked at yet could be the one
2.This search moves along the list until it meets the value it is looking for. What does the program print?
values = [7, 4, 6, 1, 9] i = 0 while values[i] != 6: i = i + 1 print(i)3.This one does not stop when it finds a match. It carries on and counts them. What does the program print?
values = [4, 9, 4, 2, 4, 7] count = 0 for v in values: if v == 4: count = count + 1 print(count)4.Two searches are run, each stopping as soon as it finds what it wants. The first is on a list of 18 values and finds what it wants at position 4. The second is on a list of 40 values and what it wants is not there at all. How many values are looked at altogether?
5.Every value of one list is compared against every value of another here. What does the program print?
found = 0 for n in [3, 6, 9]: for m in [6, 12]: if n == m: found = found + 1 print(found)6.A search that stops as soon as it finds what it wants is run on the list below. Match each value being looked for to the position the search stops at.
values = [12, 7, 19, 4, 15, 3]
- Looking for 12
- Looking for 7
- Looking for 4
- Looking for 15
- Looking for 3
- 1
- 4
- 5
- 0
- 3
7.A search that stops as soon as it finds what it wants is run on a list of 30 values, and the value it is looking for is not in the list at all. How many values does it look at before it can say so?
- a) 1
- b) 30
- c) 29
- d) 15
8.The value being looked for appears twice in this list. What does the program print?
values = [5, 8, 5, 8] i = 0 while values[i] != 8: i = i + 1 print(i)
Searching a list · Year 10 Computing · www.arenapublications.com/learn
Year 10 Computing · 12 of 12
Putting a list in order
Take a list along once, swapping neighbours that are the wrong way round, and count the comparisons, the swaps and the passes that putting a whole list in order takes.
1.A list has 5 values in it. Mark how many comparisons a single pass along it makes.
Mark the line with an X.
2.A list has 9 values in it. How many comparisons does a single pass along it make?
3.This program counts its own swaps as it makes them. What does it print?
values = [3, 1, 4, 2] swaps = 0 for i in range(0, 3): if values[i] > values[i + 1]: left = values[i] values[i] = values[i + 1] values[i + 1] = left swaps = swaps + 1 print(swaps)4.Each of these lists is taken along once, swapping neighbours that are the wrong way round. Match each list to the number of swaps that single pass makes.
- [2, 1, 4, 3]
- [1, 2, 3]
- [5, 4, 3, 2]
- [1, 2, 3, 4, 5, 9, 6]
- [8, 7, 6, 5, 4]
- 4
- 0
- 1
- 2
- 3
5.A list has 7 values in it. At most how many passes could putting it in order ever need?
- a) 21
- b) 6
- c) 5
- d) 7
6.A list of 6 values is put in order by making 5 passes along it, and every one of those passes makes 5 comparisons. How many comparisons is that altogether?
7.The list 4, 3, 2, 1 is exactly the wrong way round. How many swaps happen during a single pass along it?
8.After one whole pass along a list, one value is certain to be in its final place. Which one?
- a) The largest value in the list
- b) The smallest value in the list
- c) Nothing can be said for certain after only one pass
- d) Whichever value started at position 0
Putting a list in order · Year 10 Computing · www.arenapublications.com/learn
Answer keys — Year 10 Computing
In the same order as the worksheets.
How strong a password is
- 1. 2 characters, each one of 12 → Fewer than 1000; 3 characters, each one of 9 → Fewer than 1000; 2 characters, each one of 30 → Fewer than 1000; 3 characters, each one of 11 → More than 1000; 4 characters, each one of 7 → More than 1000; 2 characters, each one of 45 → More than 1000
- 2. 2704
- 3. 8000
- 4. b) The rule with 6 characters and 10 choices
- 5. 42
- 6. 8
- 7. 900
- 8. d) Adding one more character to the length
Spotting a phishing message
- 1. https://oakfield-school.com/term-dates → The school's own site; https://oakfield-school.com.sign-in.net/account → Somebody else's site; https://parents.oakfield-school.com/forms → The school's own site; https://oakfield-school.net/term-dates → Somebody else's site; https://library.oakfield-school.com/books → The school's own site; https://oakfieldschool.com/term-dates → Somebody else's site
- 2. a) It asks for a secret
- 3. b) https://riverside-club.com/members
- 4. d) One sign, and that one sign is enough on its own
- 5. 5
- 6. Your account will be closed in 24 hours unless you act. → Sets a deadline; Your parcel is out for delivery today. → Sets no deadline; Confirm within one hour or your prize is given away. → Sets a deadline; Here is the reading list for next term. → Sets no deadline; Pay by the end of the day or the charge doubles. → Sets a deadline; Your password was changed on Tuesday. → Sets no deadline
- 7. a) check-now.net
- 8. a) It asks for a secret
The trail you leave online
- 1. Nothing at all is known → 200; The year group → 50; The birth month, without the year group → 20; The year group and the birth month → 5; The year group, the birth month and the first initial → 1
- 2. 7
- 3. 120
- 4. 5
- 5. 74
- 6. Their year group → Leaves more than one person; Their birth month → Leaves more than one person; Their admission number → Leaves exactly one person; Their favourite sport → Leaves more than one person; Their shoe size and birth month together → Leaves more than one person; Their email address → Leaves exactly one person
- 7. 1. Born in the same week as you, which one member in every hundred is 2. Plays the cello, which one member in every twenty-five does 3. Travels by bus, which one member in every five does 4. Is in the same year group as you, which one member in every two is
- 8. b) The time you arrived
Working out a file size
- 1. 96000
- 2. 1. 800 characters, 1 byte each 2. 20 pixels by 20 pixels, 3 bytes per pixel 3. 45 pixels by 40 pixels, 1 byte per pixel 4. 500 samples a second for 5 seconds, 1 byte each
- 3. 90000
- 4. 3600
- 5. 60 pixels by 80 pixels, 1 byte per pixel → Fewer than 10000 bytes; 120 pixels by 90 pixels, 1 byte per pixel → More than 10000 bytes; 3000 characters, 1 byte each → Fewer than 10000 bytes; 50 pixels by 40 pixels, 3 bytes per pixel → Fewer than 10000 bytes; 2000 samples a second for 8 seconds, 1 byte each → More than 10000 bytes; 70 pixels by 70 pixels, 3 bytes per pixel → More than 10000 bytes
- 6. d) The first, by 2000 bytes
- 7. 80000
- 8. 24 pixels by 25 pixels, 1 byte per pixel → 600; 1500 characters, 1 byte each → 1500; 30 pixels by 30 pixels, 2 bytes per pixel → 1800; 400 samples a second for 6 seconds, 1 byte each → 2400; 20 pixels by 15 pixels, 3 bytes per pixel → 900
Making a file smaller
- 1. 15
- 2.
- 7R3G
- 7R 3G
- 3. 1. GGGGGGGG 2. RRRRWWWW 3. RRWWBBGG 4. RGBRGBR
- 4. d) It doubles it, from 20 things to 40
- 5. a) The sky, because long stretches of it are the same colour
- 6. BBBWWBB → 3; RRRRRRRR → 1; RGRGRG → 6; WWWWBB → 2; RRGGBBRRG → 5
- 7. 66
- 8. 11
Lists and their positions
- 1. a) xs[7]
- 2. 6
- 3. 18
- 4. 6
- 5. xs[0] → Reads a value out of the list; xs[4] → Reads a value out of the list; xs[5] → Falls off the end of the list; xs[len(xs) - 1] → Reads a value out of the list; xs[len(xs)] → Falls off the end of the list; xs[2] → Reads a value out of the list
- 6. 19
- 7. 20
- 8. 4
Looping over a list
- 1. [4, 3, 2] → A total of less than 20; [10, 9, 6] → A total of more than 20; [1, 1, 1, 1] → A total of less than 20; [7, 8, 9] → A total of more than 20; [5, 5, 5] → A total of less than 20; [12, 11] → A total of more than 20
- 2. 24
- 3. a) 0
- 4. 18
- 5. 15
- 6. 1
- 7. 3
- 8. d) 25
Building a list as you go
- 1. 10
- 2. 6
- 3. 4
- 4. range(2, 5) → Leaves 3 values; range(0, 5) → Leaves 5 values; range(7, 10) → Leaves 3 values; range(1, 6) → Leaves 5 values; range(10, 13) → Leaves 3 values; range(20, 25) → Leaves 5 values
- 5. 1
- 6. 3
- 7. range(1, 4) → 9; range(2, 6) → 15; range(0, 3) → 6; range(4, 8) → 21; range(5, 9) → 24
- 8. b) 5
Text inside a program
- 1. 6
- 2. d) 7
- 3. print(word[0]) → n; print(word[3]) → w; print(word[6]) → k; print(len(word)) → 7; print(word[len(word) - 2]) → r
- 4. sunrise
- 5. b) 9
- 6. m
- 7. 8
- 8. n
Repeating while something is true
- 1. 32
- 2. 4
- 3. Multiplied by 2 each time → 128; Multiplied by 3 each time → 243; Multiplied by 5 each time → 125; Multiplied by 10 each time → 100; Multiplied by 4 each time → 256
- 4. 5
- 5. c) It never stops on its own
- 6. c) 5
- 7. 6
- 8. 7
Searching a list
- 1. d) Because the value it has not looked at yet could be the one
- 2. 2
- 3. 3
- 4. 45
- 5. 1
- 6. Looking for 12 → 0; Looking for 7 → 1; Looking for 4 → 3; Looking for 15 → 4; Looking for 3 → 5
- 7. b) 30
- 8. 1
Putting a list in order
- 1. 4
- 2. 8
- 3. 2
- 4. [2, 1, 4, 3] → 2; [1, 2, 3] → 0; [5, 4, 3, 2] → 3; [1, 2, 3, 4, 5, 9, 6] → 1; [8, 7, 6, 5, 4] → 4
- 5. b) 6
- 6. 25
- 7. 3
- 8. a) The largest value in the list
Year 10 Computing · www.arenapublications.com/learn