S3U

Science / Programming basics / Grade 2 / sc270

Programming Basics: Find and Fix a Bug

Compare what you wanted with what your instructions actually did.

All worksheets
5 questions0m 0s
Learn the skill

A bug is a mistake in a program. Our goal is exactly three dots. The faulty plan says DRAW DOT twice. Trace it, compare the result with the goal, change one thing, and check again.

Worked example

Two DRAW DOT instructions make two dots. Add one more DRAW DOT instruction to make exactly three. Finding a mistake helps improve the plan; it is not a reason to give up.

The goal has three dots. A faulty program with two DRAW DOT instructions makes two dots. Add one DRAW DOT instruction and trace again to reach three.
The goal has three dots. A faulty program with two DRAW DOT instructions makes two dots. Add one DRAW DOT instruction and trace again to reach three.
Question 1 How many dots does the faulty plan draw?
Question 2 How many dots does the goal require?
Question 3 Which change reaches the goal?
Question 4 What should you do after the change?
Question 5 What is the bug in this plan?