← Back to Class 7 Computer Science

Term pack

Class 7 Computer Science

Name: ________________________

Skills in this pack

  • ☐Bigger binary numbers
  • ☐Adding binary numbers
  • ☐Reading spreadsheet formulas
  • ☐The internet and the web
  • ☐Parts of a web address
  • ☐Kinds of network
  • ☐HTML attributes and links
  • ☐HTML lists and tables
  • ☐Variables in a program
  • ☐Tracing a loop with a total
  • ☐Choosing between more than two things
  • ☐Combining conditions with and, or and not

Free at www.arenapublications.com/learn — no account, no ads, ever.

Class 7 Computer Science · 1 of 12

Bigger binary numbers

Read and write binary numbers with several places, and work out how many different values a given number of bits can hold.

Before you start

Move along this line and think about which binary places you would need to reach each point.

048121620242832

The points that need only a single 1 — 1, 2, 4, 8, 16, 32 — are the place values themselves. Everything else is built by adding a few of them together.

  1. 1.Write the number 37 in binary.

  2. 2.In binary each place is worth twice the place to its right. The places so far are 1, 2, 4, 8, 16 and 32. What is the next place value after 32?

  3. 3.Match each binary number to its ordinary value.

    • 1000
    • 1111
    • 10010
    • 11000
    • 100000
    • 24
    • 15
    • 8
    • 32
    • 18
  4. 4.What is the largest number that fits in 4 bits?

    • a) 16
    • b) 14
    • c) 8
    • d) 15
  5. 5.With 3 bits you can write 000, 001, 010 and so on. How many different values is that altogether?

    • a) 3
    • b) 6
    • c) 9
    • d) 8
  6. 6.A byte is eight bits. How many different values can one byte hold?

    • a) 128
    • b) 64
    • c) 256
    • d) 512
  7. 7.How many different values can be written with 5 bits?

  8. 8.Write the number 20 in binary.

Bigger binary numbers · Class 7 Computer Science · www.arenapublications.com/learn

Class 7 Computer Science · 2 of 12

Adding binary numbers

Add two binary numbers place by place, carrying into the next place whenever a column comes to more than one.

  1. 1.Add the binary numbers "1010" and "1010". Write the answer in binary.

  2. 2.Add the binary numbers "110" and "11". Write the answer in binary.

  3. 3.Add the binary numbers "1101" and "101". Write the answer in binary.

  4. 4.Add the binary numbers "11" and "1". Write the answer in binary.

  5. 5.Put these binary additions in order of their answers, smallest first.

    • 100 + 11
    • 1000 + 101
    • 110 + 100
    • 10 + 1
    • 11 + 10
  6. 6.Sort each addition by whether its right-hand column produces a carry.

    Groups: Produces a carry · No carry

    • 10 + 1
    • 1001 + 1001
    • 11 + 1
    • 101 + 11
    • 100 + 10
    • 1000 + 111
  7. 7.Add the binary numbers "1011" and "110". Write the answer in binary.

  8. 8.Add the binary numbers "110" and "10". Write the answer in binary.

Adding binary numbers · Class 7 Computer Science · www.arenapublications.com/learn

Class 7 Computer Science · 3 of 12

Reading spreadsheet formulas

Read a spreadsheet formula, work out which cells it refers to, and say what number it will show.

  1. 1.A sheet holds B1 = 7 and B2 = 3. What number does the formula "=B1*B2" show?

  2. 2.A sheet holds A1 = 4, A2 = 6 and A3 = 9. What number does the formula "=A1+A2" show?

  3. 3.A sheet holds C1 = 20 and C2 = 4. What number does the formula "=C1/C2" show?

  4. 4.A sheet holds A1 = 9 and A2 = 3, and a cell holding "=A1/A2" is showing 3. You then change A1 to 12. What does that cell show now?

    • a) 3
    • b) It keeps showing 3 until the formula is typed in again
    • c) 4
    • d) 12
  5. 5.A sheet holds A1 = 3, A2 = 8 and A3 = 2. Put these formulas in order of the number each one shows, smallest first.

    • =SUM(A1:A3)
    • =A1+A2
    • =A1-A3
    • =A3*A1
    • =A2*A3
  6. 6.A cell sits in column C, in the fourth row down. Write its cell reference.

  7. 7.The same sheet holds A1 = 4, A2 = 6 and A3 = 9. What number does the formula "=A3-A1" show?

  8. 8.A sheet holds A1 = 2, A2 = 5, A3 = 8 and A4 = 1. What number does the formula "=SUM(A1:A4)" show?

Reading spreadsheet formulas · Class 7 Computer Science · www.arenapublications.com/learn

Class 7 Computer Science · 4 of 12

The internet and the web

Tell the internet apart from the web, and say what has to happen between two machines before a page appears on your screen.

  1. 1.Opening one page sends a request out and brings a copy of the page back. Counting the request going out and the page coming back, how many journeys across the network is that?

  2. 2.Messages were being carried between distant machines for years before the first web page was ever written. What does that tell you?

    • a) The web came first and messaging copied it
    • b) The two are simply different names for the same thing
    • c) Those early messages were a kind of web page
    • d) The web is one of the things carried, and not the carrier itself
  3. 3.Put these in the order they happen when someone opens a web page.

    • A copy of the page travels back
    • The address is typed in and entered
    • The browser draws the page on the screen
    • A request for that page travels out across the network
    • The machine holding the page finds the one that was asked for
  4. 4.Which of these cannot be done at all by a device that is joined to nothing?

    • a) Opening a page it has never opened before
    • b) Typing a letter and saving it
    • c) Drawing a picture in a paint program
    • d) Adding two numbers in a calculator app
  5. 5.Someone unplugs the cable that joins a school to the company supplying its connection. Which of these still works?

    • a) Opening a page from a site in another country
    • b) Opening a file kept on the school's own lab network
    • c) Joining a video call with another school
    • d) Sending a message to a school in the next city
  6. 6.Sort each job by whether the browser on your own device does it, or the machine holding the page does it.

    Groups: The browser · The machine holding the page

    • Starts the request off
    • Answers with a copy of the page
    • Reads the address that was typed in
    • Stores the page until somebody asks for it
    • Paints the words and pictures onto the screen
    • Picks out the right page from the ones it holds
  7. 7.Three friends each open the same page at the same time, and each of them receives their own copy of it. How many copies travel out?

  8. 8.A browser reports that the page could not be found. Which of these is the most likely reason?

    • a) The device has run out of storage
    • b) The machine answered, but has no page at that address
    • c) Every machine on the internet has been switched off
    • d) The browser is not allowed to draw pictures

The internet and the web · Class 7 Computer Science · www.arenapublications.com/learn

Class 7 Computer Science · 5 of 12

Parts of a web address

Take a web address apart into its protocol, its domain name and its path, and say what each part tells the browser.

  1. 1.In the address "https://www.arenaschool.in/notices/exam.html", which part is the domain name — the name of the site itself?

  2. 2.The address "https://library.arenaschool.in/books" ends its domain name with a two-letter country code. Which two letters are they?

  3. 3.Two addresses read "https://exam.arenaschool.in" and "https://exam.arenaschool.com". What can you say about them?

    • a) One of the two cannot be a real address
    • b) They are different addresses and may well be different sites
    • c) They must be the same site written two ways
    • d) A browser treats the two as a single address
  4. 4.Match each ending to the kind of owner that usually uses it.

    • .edu
    • .gov
    • .org
    • .in
    • .com
    • Something based in India
    • A place of education
    • A group, often one that is not a business
    • A company
    • A government body
  5. 5.In the address "https://www.example.in/notes/algebra/homework.html", what is the name of the file at the end of the path?

  6. 6.In the address "https://www.arenaschool.in/notices/exam.html", what comes after the very last slash?

  7. 7.In the address "https://www.example.in/notes/algebra/homework.html", how many slashes come after the domain name?

  8. 8.An email address is written "meera@arenaschool.in". Which part of it says where that mailbox is looked after?

    • a) The whole address together
    • b) meera
    • c) The @ sign
    • d) arenaschool.in

Parts of a web address · Class 7 Computer Science · www.arenapublications.com/learn

Class 7 Computer Science · 6 of 12

Kinds of network

Tell a network that covers one site from one that stretches between towns, and say what joined-up computers can do that separate ones cannot.

  1. 1.A wide area network joins a company's offices in Delhi and Chennai. What kind of network is the one joining the machines inside the Delhi office itself?

    • a) It is not really a network
    • b) A local area network
    • c) A second wide area network
    • d) It is the same network under another name
  2. 2.A school joins its lab to the outside world through one connection. A pupil says each computer in the lab therefore has its own separate line out. Are they right?

    • a) Yes — every computer is given a line of its own
    • b) No — the whole lab shares the one connection
    • c) Yes, but only while the lab is quiet
    • d) No — none of the computers can reach the outside at all
  3. 3.Two computers are joined by a single cable and can pass files to each other. Is that a network?

    • a) Yes — two joined machines are already a network
    • b) No — a network needs at least ten machines
    • c) Only if one of the two is switched off
    • d) No — a network has to reach another town
  4. 4.Fifteen computers in a lab share one printer, one scanner and one connection out of the building. How many of those three things would each computer need if the lab had no network?

    • a) Only the connection out
    • b) Only the printer
    • c) All three of them
    • d) None of them
  5. 5.Which of these can a computer that is joined to nothing at all still do?

    • a) Add up a column of numbers by itself
    • b) Send a message to the room upstairs
    • c) Print on the machine down the corridor
    • d) Open a file kept on the machine next to it
  6. 6.A network that stretches between towns or countries is called a wide area network. What are the three letters it is usually shortened to?

  7. 7.Twenty computers in a lab all print on the same shared printer over the network. How many printers does the lab need?

  8. 8.Match each network to how far it reaches.

    • The computers in one school lab
    • The computers across a whole college site
    • A bank's branches in four cities
    • The machinery joining continent to continent
    • A whole country
    • One site with several buildings
    • The whole world
    • A single room

Kinds of network · Class 7 Computer Science · www.arenapublications.com/learn

Class 7 Computer Science · 7 of 12

HTML attributes and links

Read the attributes inside an opening tag, and work out where a link goes and which words a reader clicks to follow it.

  1. 1.Sort each opening tag by whether it carries an attribute.

    Groups: Carries an attribute · Carries none

    • <a href="home.html">
    • <a href="maths.html">
    • <img src="sun.png">
    • <b>
    • <p>
    • <h1>
  2. 2.Match each attribute name to what it says.

    • href
    • src
    • alt
    • width
    • Words to use in place of a picture
    • Which file a picture comes from
    • How wide to draw a picture
    • Which page the link opens
  3. 3.In the picture tag “<img src="kite.png" alt="A paper kite">”, what is the alt attribute for?

    • a) The name the picture is saved under
    • b) Words describing the picture, for a reader who cannot see it
    • c) The page the picture links to
    • d) The size the picture should be drawn at
  4. 4.A link is written “<a href="sport.html">Music</a>”. What happens when a reader clicks the word Music?

    • a) The page sport.html opens
    • b) Nothing opens, because the two do not agree
    • c) Both pages open, one after the other
    • d) The page music.html opens
  5. 5.A page holds “<a href="results.html">Click here</a>”. A reader clicks the words Click here. Which file opens?

  6. 6.In the picture tag “<img src="kite.png" alt="A paper kite">”, which file holds the picture?

  7. 7.A page holds “<a href="library.html">Books</a>”. Which piece is the link text and which is the destination?

    • a) Books is the text; library.html is the destination
    • b) Both pieces are the text
    • c) Both pieces are the destination
    • d) library.html is the text; Books is the destination
  8. 8.An attribute is a name, an equals sign and a value in quotes, written inside the opening tag. How many attributes does “<img src="cat.png" alt="A cat" width="200">” have?

HTML attributes and links · Class 7 Computer Science · www.arenapublications.com/learn

Class 7 Computer Science · 8 of 12

HTML lists and tables

Read an HTML list or table, count its items, rows and cells, and say which of its tags sits inside which.

Before you start

Every cell of this table has a name — find out what each one is called. Notice that the name says which row first, and only then how far along.

123456789
  1. 1. Row 1, cell 1
  2. 2. Row 1, cell 2
  3. 3. Row 1, cell 3
  4. 4. Row 2, cell 1
  5. 5. Row 2, cell 2
  6. 6. Row 2, cell 3
  7. 7. Row 3, cell 1
  8. 8. Row 3, cell 2
  9. 9. Row 3, cell 3

Every cell needs its own tag, and every row needs one as well — so a grid this size takes nine cell tags wrapped in three row tags, not nine tags on their own.

  1. 1.Match each tag to what one of it holds.

    • <ul>
    • <ol>
    • <li>
    • <tr>
    • <td>
    • A whole list with a bullet against each item
    • One cell of a table
    • One item of a list
    • A whole list with a number against each item
    • One row of a table
  2. 2.In “<ul><li>Red</li><li>Blue</li><li>Green</li><li>Black</li><li>White</li></ul>”, how many item tags are there altogether, counting the opening and closing tags separately?

  3. 3.How many rows does this table have: “<table><tr><td>1</td><td>2</td></tr><tr><td>3</td><td>4</td></tr><tr><td>5</td><td>6</td></tr></table>”?

  4. 4.In “<ol><li>Wash</li><li>Cut</li><li>Cook</li><li>Serve</li></ol>”, what number will the browser print beside Cook?

  5. 5.A recipe's steps have to be followed in a set order, and the reader needs to see which step is which. Which tag should wrap that list?

    • a) <ul>
    • b) <td>
    • c) <ol>
    • d) <li>
  6. 6.Which tag closes “<li>”?

  7. 7.How many cells does that same table hold altogether: “<table><tr><td>1</td><td>2</td></tr><tr><td>3</td><td>4</td></tr><tr><td>5</td><td>6</td></tr></table>”?

  8. 8.A table is built from 5 row tags, and each row holds 3 cell tags. How many cells is that altogether?

HTML lists and tables · Class 7 Computer Science · www.arenapublications.com/learn

Class 7 Computer Science · 9 of 12

Variables in a program

Follow what a named value holds as a program changes it line by line, and say what it holds at the end.

  1. 1.A program says: set a to 6; set b to 4; set a to a plus b. What does b hold now?

  2. 2.A program says: set a to 6; set b to 4; set a to a plus b. What does a hold now?

  3. 3.A program says: set total to 4; set total to 7; print total. What appears on the screen?

    • a) First 4 and then 7
    • b) 7
    • c) 4
    • d) 11
  4. 4.Put these four lines in an order that leaves total holding 14 and then shows it.

    • print total
    • set total to 0
    • add 8 to total
    • add 6 to total
  5. 5.Sort each line by whether it changes what total holds.

    Groups: Changes it · Leaves it as it was

    • show total on the screen
    • print total
    • add 5 to total
    • take 2 away from total
    • set total to 0
    • compare total with 10
  6. 6.A program says: set a to 2; set b to 5; set c to a plus b; set a to 10. What does c hold now?

  7. 7.A program says: set x to 3; set y to x; set x to 8. What does y hold now?

  8. 8.A program says: set score to 5; add 3 to score. What does score hold now?

Variables in a program · Class 7 Computer Science · www.arenapublications.com/learn

Class 7 Computer Science · 10 of 12

Tracing a loop with a total

Trace a loop that keeps a running total, and say what the total holds once the loop has finished.

  1. 1.A program says: set total to 0; repeat 5 times: add 2 to total. After the loop has finished, it prints total once. How many numbers appear on the screen?

    • a) None
    • b) Five
    • c) Ten
    • d) One
  2. 2.A program says: set total to 0; repeat 4 times: add 3 to total. Someone answers 3, because 3 was the last thing added. What is wrong with that?

    • a) Nothing is wrong — 3 is right
    • b) The total starts again from nothing each time round
    • c) The total keeps everything added before it, so it comes to 12
    • d) The loop only ever runs once
  3. 3.A program says: set total to 0; repeat 7 times: add 3 to total. What does total hold at the end?

  4. 4.A program says: set total to 1; repeat 4 times: double total. What does total hold at the end?

  5. 5.Each of these programs starts with total holding 0. Sort each loop by whether it finishes with total above 30.

    Groups: Above 30 · 30 or below

    • repeat 5 times: add 4 to total
    • repeat 3 times: add 5 to total
    • repeat 7 times: add 6 to total
    • repeat 2 times: add 8 to total
    • repeat 4 times: add 9 to total
    • repeat 8 times: add 5 to total
  6. 6.Put these lines in the order that adds 5 to a total three times over and then shows the result.

    • repeat 3 times
    • print total
    • add 5 to total
    • set total to 0
  7. 7.A program says: set total to 100; repeat 5 times: take 8 away from total. What does total hold at the end?

  8. 8.A program says: set total to 2; repeat 5 times: add 6 to total. What does total hold at the end?

Tracing a loop with a total · Class 7 Computer Science · www.arenapublications.com/learn

Class 7 Computer Science · 11 of 12

Choosing between more than two things

Follow a chain of tests in which the first one that comes out true wins, and say which branch a program takes.

  1. 1.A program says: if the score is at least 90, print "Gold"; else if the score is at least 70, print "Silver"; else if the score is at least 50, print "Bronze"; otherwise print "Try again". The score is 50. What does it print?

  2. 2.A program says: if the age is at least 18, print "Adult"; else if the age is at least 13, print "Teenager"; else if the age is at least 5, print "Child"; otherwise print "Toddler". Match each age to what the program prints.

    • 20
    • 13
    • 9
    • 3
    • Toddler
    • Teenager
    • Child
    • Adult
  3. 3.In that same program — if the number is more than 10, print "Big"; else if the number is more than 100, print "Huge"; otherwise print "Small" — is there any number at all that makes it print Huge?

    • a) Yes, any number above 100
    • b) No, because anything above 100 is already above 10
    • c) Yes, but only the number 100 itself
    • d) Yes, any number above 10
  4. 4.A program says: if the score is at least 90, print "Gold"; else if the score is at least 70, print "Silver"; else if the score is at least 50, print "Bronze"; otherwise print "Try again". The score is 95. What does it print?

  5. 5.A program says: if the score is at least 90, print "Gold"; else if the score is at least 70, print "Silver"; else if the score is at least 50, print "Bronze"; otherwise print "Try again". The score is 49. What does it print?

  6. 6.A program says: if the score is at least 90, print "Gold"; else if the score is at least 70, print "Silver"; else if the score is at least 50, print "Bronze"; otherwise print "Try again". The score is 70. What does it print?

  7. 7.A program says: if the score is at least 90, print "Gold"; else if the score is at least 70, print "Silver"; else if the score is at least 50, print "Bronze"; otherwise print "Try again". The score is 89. What does it print?

  8. 8.Put these three lines into the order that makes the chain work as it is meant to: numbers above 100 should give Huge, and other numbers above 10 should give Big.

    • test whether the number is more than 100, and print "Huge" if it is
    • test whether the number is more than 10, and print "Big" if it is
    • if neither test held, print "Small"

Choosing between more than two things · Class 7 Computer Science · www.arenapublications.com/learn

Class 7 Computer Science · 12 of 12

Combining conditions with and, or and not

Work out whether a condition joined by and, or or not comes out true, and which branch a program takes because of it.

  1. 1.A condition says: the number is more than 5 or the number is more than 50. Which numbers make it true?

    • a) Only the numbers above 50
    • b) Only the numbers between 5 and 50
    • c) Every number above 5
    • d) No number at all
  2. 2.A program says: if the number is more than 10 and less than 20, print "Middle"; otherwise print "Outside". The number is 25. What does it print?

  3. 3.A program says: if the mark is less than 33 or the attendance is less than 75, print "Not allowed"; otherwise print "Allowed". The mark is 90 and the attendance is 60. What does it print?

  4. 4.A program says: if the mark is less than 33 or the attendance is less than 75, print "Not allowed"; otherwise print "Allowed". The mark is 20 and the attendance is 95. What does it print?

  5. 5.A program prints "Go" only when the light is green and the road is clear, and prints "Wait" otherwise. Sort each situation by what it prints.

    Groups: Go · Wait

    • The light is red and the road is blocked
    • The light is green and nothing is standing on the road
    • The light is green and the road is clear
    • The light is green and the road is blocked
    • The light is red and the road is clear
  6. 6.A program says: if the number is more than 10 and less than 20, print "Middle"; otherwise print "Outside". The number is 12. What does it print?

  7. 7.A condition says: the number is more than 50 and the number is less than 10. Which numbers make it true?

    • a) The numbers between 10 and 50
    • b) Only 10 and 50 themselves
    • c) No number at all
    • d) Every number
  8. 8.Match each condition to the smallest whole number that makes it true.

    • more than 3 and more than 7
    • more than 3 or more than 7
    • at least 5 and at least 9
    • at least 5 or at least 9
    • more than 0 and at least 2
    • 2
    • 8
    • 4
    • 9
    • 5

Combining conditions with and, or and not · Class 7 Computer Science · www.arenapublications.com/learn

Answer keys — Class 7 Computer Science

In the same order as the worksheets.

Bigger binary numbers

  1. 1. 100101
  2. 2. 64
  3. 3. 1000 → 8; 1111 → 15; 10010 → 18; 11000 → 24; 100000 → 32
  4. 4. d) 15
  5. 5. d) 8
  6. 6. c) 256
  7. 7. 32
  8. 8. 10100

Adding binary numbers

  1. 1. 10100
  2. 2. 1001
  3. 3. 10010
  4. 4. 100
  5. 5. 1. 10 + 1 2. 11 + 10 3. 100 + 11 4. 110 + 100 5. 1000 + 101
  6. 6. 1001 + 1001 → Produces a carry; 10 + 1 → No carry; 11 + 1 → Produces a carry; 100 + 10 → No carry; 101 + 11 → Produces a carry; 1000 + 111 → No carry
  7. 7. 10001
  8. 8. 1000

Reading spreadsheet formulas

  1. 1. 21
  2. 2. 10
  3. 3. 5
  4. 4. c) 4
  5. 5. 1. =A1-A3 2. =A3*A1 3. =A1+A2 4. =SUM(A1:A3) 5. =A2*A3
  6. 6. C4
  7. 7. 5
  8. 8. 16

The internet and the web

  1. 1. 2
  2. 2. d) The web is one of the things carried, and not the carrier itself
  3. 3. 1. The address is typed in and entered 2. A request for that page travels out across the network 3. The machine holding the page finds the one that was asked for 4. A copy of the page travels back 5. The browser draws the page on the screen
  4. 4. a) Opening a page it has never opened before
  5. 5. b) Opening a file kept on the school's own lab network
  6. 6. Reads the address that was typed in → The browser; Stores the page until somebody asks for it → The machine holding the page; Paints the words and pictures onto the screen → The browser; Picks out the right page from the ones it holds → The machine holding the page; Starts the request off → The browser; Answers with a copy of the page → The machine holding the page
  7. 7. 3
  8. 8. b) The machine answered, but has no page at that address

Parts of a web address

  1. 1.
    • www.arenaschool.in
    • arenaschool.in
  2. 2.
    • in
    • .in
  3. 3. b) They are different addresses and may well be different sites
  4. 4. .edu → A place of education; .gov → A government body; .org → A group, often one that is not a business; .in → Something based in India; .com → A company
  5. 5. homework.html
  6. 6. exam.html
  7. 7. 3
  8. 8. d) arenaschool.in

Kinds of network

  1. 1. b) A local area network
  2. 2. b) No — the whole lab shares the one connection
  3. 3. a) Yes — two joined machines are already a network
  4. 4. c) All three of them
  5. 5. a) Add up a column of numbers by itself
  6. 6.
    • WAN
    • W.A.N.
  7. 7. 1
  8. 8. The computers in one school lab → A single room; The computers across a whole college site → One site with several buildings; A bank's branches in four cities → A whole country; The machinery joining continent to continent → The whole world

HTML attributes and links

  1. 1. <p> → Carries none; <a href="home.html"> → Carries an attribute; <img src="sun.png"> → Carries an attribute; <b> → Carries none; <h1> → Carries none; <a href="maths.html"> → Carries an attribute
  2. 2. href → Which page the link opens; src → Which file a picture comes from; alt → Words to use in place of a picture; width → How wide to draw a picture
  3. 3. b) Words describing the picture, for a reader who cannot see it
  4. 4. a) The page sport.html opens
  5. 5. results.html
  6. 6. kite.png
  7. 7. a) Books is the text; library.html is the destination
  8. 8. 3

HTML lists and tables

  1. 1. <ul> → A whole list with a bullet against each item; <ol> → A whole list with a number against each item; <li> → One item of a list; <tr> → One row of a table; <td> → One cell of a table
  2. 2. 10
  3. 3. 3
  4. 4. 3
  5. 5. c) <ol>
  6. 6. </li>
  7. 7. 6
  8. 8. 15

Variables in a program

  1. 1. 4
  2. 2. 10
  3. 3. b) 7
  4. 4. 1. set total to 0 2. add 6 to total 3. add 8 to total 4. print total
    Also accepted, in full:
    • 1. set total to 0 2. add 8 to total 3. add 6 to total 4. print total
  5. 5. add 5 to total → Changes it; print total → Leaves it as it was; set total to 0 → Changes it; show total on the screen → Leaves it as it was; take 2 away from total → Changes it; compare total with 10 → Leaves it as it was
  6. 6. 7
  7. 7. 3
  8. 8. 8

Tracing a loop with a total

  1. 1. d) One
  2. 2. c) The total keeps everything added before it, so it comes to 12
  3. 3. 21
  4. 4. 16
  5. 5. repeat 4 times: add 9 to total → Above 30; repeat 3 times: add 5 to total → 30 or below; repeat 8 times: add 5 to total → Above 30; repeat 2 times: add 8 to total → 30 or below; repeat 7 times: add 6 to total → Above 30; repeat 5 times: add 4 to total → 30 or below
  6. 6. 1. set total to 0 2. repeat 3 times 3. add 5 to total 4. print total
  7. 7. 60
  8. 8. 32

Choosing between more than two things

  1. 1. Bronze
  2. 2. 20 → Adult; 13 → Teenager; 9 → Child; 3 → Toddler
  3. 3. b) No, because anything above 100 is already above 10
  4. 4. Gold
  5. 5. Try again
  6. 6. Silver
  7. 7. Silver
  8. 8. 1. test whether the number is more than 100, and print "Huge" if it is 2. test whether the number is more than 10, and print "Big" if it is 3. if neither test held, print "Small"

Combining conditions with and, or and not

  1. 1. c) Every number above 5
  2. 2. Outside
  3. 3. Not allowed
  4. 4. Not allowed
  5. 5. The light is green and the road is clear → Go; The light is green and the road is blocked → Wait; The light is red and the road is clear → Wait; The light is red and the road is blocked → Wait; The light is green and nothing is standing on the road → Go
  6. 6. Middle
  7. 7. c) No number at all
  8. 8. more than 3 and more than 7 → 8; more than 3 or more than 7 → 4; at least 5 and at least 9 → 9; at least 5 or at least 9 → 5; more than 0 and at least 2 → 2

Class 7 Computer Science · www.arenapublications.com/learn