Tutorpip← About this lessonABCHide the answer keyDownload PDF
Coding · Ages 8+ · Set A
Maya's doubling machine
Scan to mark
on screen
A
Name
Date
Start Finish
Goal: 15 min
Score/ 11
Remember: One example is not enough. Try several, small, big and zero, and compare what you want with what you get. A mismatch is how you spot a bug.

Read and answer

Read the story, then answer.

Does it work?Maya builds a doubling machine for the fair: a number goes in, and the double comes out. She feeds in a two, and out comes a four. "It works!" she cheers. At the fair, Jonah feeds in a five, and out comes a seven. Five doubled should be ten. What we want and what we get do not match, and that is how we spot a bug. Ms. Park says to try lots of numbers: five gave seven, three gave five, and ten gave twelve. Maya opens the program, and it says add two, not times two. Two plus two is four, and two times two is four as well, so the first example hid the bug.
1
Jonah feeds a five into the doubling machine. What should come out?
7105
2
The machine worked for the number two, so it works for every number.
TrueFalse
3
Three doubled should be .
4
Look at Maya's tries. Which number in is the only one where we get what we want?
2310
5
A bug shows when what you get does not match what you want.
TrueFalse
6
Why did trying only the number two hide the bug?
Two plus two and two times two both make fourTwo is too small a numberThe machine fixed itself

Test it with examples

7
A new doubling machine gives these answers. Circle every try that shows a bug.
In 4, out 8In 7, out 14In 12, out 3In 50, out 10In 9, out 18
8
Put the testing in order.
  • Feed in a number
  • Fix it and try more numbers
  • Compare what you want with what you get
  • If they do not match, look in the program
  • Write down the answer you want
9
Mix-up to fix: line 2 of Maya's program says add two. Which change makes the machine double?
Change line 2 to add fiveChange line 1 to times twoChange line 2 to times two
10
Maya fixes it to times two and feeds in a ten. Out comes .
11
Stretch: Maya tries zero in the add-two machine. What does she see?
0 comes out, so it matches4 comes out2 comes out, but doubling zero gives 0, so the bug shows
12
Make up a secret rule, like add three or double it. Write three numbers going in and what comes out for each.
13
Draw a funnel machine. Write a number going in on the top and the answer coming out at the bottom.
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.
Answer key · Set A
Maya's doubling machine
110 Doubling five gives ten. The machine gave seven, so what we want and what we get do not match.
2False One good try does not prove it works. Try several.
36 3 + 3 = 6, and 3 x 2 = 6.
42 Two gives four, which is double. The others give 7, 5 and 12 where we want 10, 6 and 20.
5True Comparing what you want with what you get is how you spot a bug.
6Two plus two and two times two both make four The machine added two instead of doubling. For the number two, adding two and doubling give the same four.
7In 12, out 3, In 50, out 10 Double 12 is 24 and double 50 is 100, but the machine gave 3 and 10. The other three are right.
82, 5, 3, 4, 1 Know the answer you want first, try the number, compare, and then look for the bug and test again.
9Change line 2 to times two Doubling is times two. Line 2 is the line that did the wrong job.
1020 10 x 2 = 20.
112 comes out, but doubling zero gives 0, so the bug shows 0 + 2 = 2, but zero doubled is 0. Zero is an odd number that often shows a bug.
12Your own words: a grown-up reads it.
Mark each answer, count the right ones and write the score on the sheet.