Tutorpip← About this lessonABCWith the answer keyDownload PDF
Coding · Ages 10+ · Set A
Bo's week of steps
Scan to mark
on screen
A
Name
Date
Start Finish
Goal: 15 min
Score/ 11
Remember: A variable forgets when the program stops, but a file keeps its rows. A program reads a file one row at a time, and a mistake in a row shows in the chart.

Read and answer

Read the story, then answer.

Bo's stepsEvery morning, Bo walks a loop around the school while Zoe counts the steps. Zoe types each day's number into a variable, but when the program stops, the variable is empty the next morning. Ms. Okoro says a variable forgets, but a file remembers, because a file is saved on the computer. Think of a file as a folder full of rows, where each row is one line of data, like Monday and one thousand steps. Ravi's program opens the file, reads a row and uses it, then reads and uses the next row until there are no more rows. At the end it closes the file. Soon the screen draws a bar chart of the whole week, but one bar is taller than the screen.
1
Which one keeps its data after the program stops?
📦A variable📁A file on the computer🧠A number held in memory
2
A program reads a file one at a time, from the top.
pagerowkey
3
A variable keeps its value after the program stops.
TrueFalse
4
Look at the rows. Which day would make a bar much taller than the others?
TuesdayFridayWednesday
5
Which day has fewer steps than Monday?
TuesdayThursdayFriday
6
If a row in the file has a mistake, the chart will show it.
TrueFalse

Match, order and fix

7
Join each word to what it is.
  1. 1a variable
  2. 2a file
  3. 3a row
  4. 4a bar
  • Adrawn from one row of the file
  • Bone line of data, like a day and its steps
  • Cforgets when the program stops
  • Dkeeps data after the program stops
8
Ravi's program draws the chart. Put its steps in order.
  • Open the file
  • Close the file
  • Use the row to draw a bar
  • Read a row
9
Wednesday's row says 10000 steps. What is the mix-up to fix?
The day is spelled wrongIt has an extra zero, and it should say 1000It should say 1200
10
Circle every one that keeps its data after the program stops.
A saved notebook of rowsA variableA file on the computerA number held in memory
11
At the end, the program the file so everything stays safe and tidy.
readsopenscloses
12
Write one row for your own notebook file: the day, and one number, like pages you read.
13
Draw a bar for each day of Bo's week, using the rows in the table.
Scan the code at the top to mark this sheet on screenTake a photo of your answers or type them. It is marked for you automatically, and your score is kept.