Tutorpip← About this lessonABCWith 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.