Wednesday, July 30, 2014

Debugging

Debugging is the process of finding and fixing “bugs”(errors) in your program.

Bugs can be of different forms, Some bugs that you would find in the following questions include instructions that have been typed in wrong, wrong logic, punctuation errors, missing instructions, wrong data, etc.

(1)   Here is a program for tracing the number 2 as seen on a digital clock using Pro-Bot. Each side of the figure is 6 cm long. Try programming your Pro-Bot with this program and see if it makes the required pattern. If it does not, find the bugs in your program (the parts of the program that are not working correctly) and fix them. Circle the wrong instructions in the given program and write the correct ones instead.























Fd 6
Rt
Fd 6
Rt
Fd 6
Rt
Fd 6
Lt
Fd 12


(2)   Here is a program for tracing the following figure using Pro-Bot. Each side of the figure is 6 cm long. Try programming your Pro-Bot with this program and see if it makes the required pattern. If it does not, find the bugs in your program and fix them. Circle the wrong instructions in the given program and write the correct ones instead.





















Rpt 2 [
Fd 6
Lt
Rpt 3 [
Fd 6
Rt
]
Rt
Rt



(3)   Here is a program for tracing the following figure using Pro-Bot. Each side of the figure is 6 cm long. Try programming your Pro-Bot with this program and see if it makes the required pattern. If it does not, find the bugs in your program and fix them. See if you need to add any other instructions as well. Circle the wrong instructions in the given program and write the correct ones instead.






















Rpt 2 [
Rpt 5 [
Fd 6
Rt
]


(4)  Here is a program for tracing the figure below using Pro-Bot. Each side of the square is 6 cm long. The square is divided into two equal parts by the line in the middle. Try programming your Pro-Bot with this program and see if it makes the required pattern. If it does not, find the bugs in your program (the parts of the program that are not working correctly) and fix them. Circle the wrong instructions in the given program and write the correct ones instead.















Rpt 4 [
Fd 6
Rt
]
Fd 2
Rt
Bk 6


(5) Here is a program for tracing the following figure using Pro-Bot. There are three squares stacked up and each square has 6 cm long sides. Try programming your Pro-Bot with this program and see if it makes the required pattern. If it does not, find the bugs in your program and fix them. See if you need to add any other instructions as well. Circle the wrong instructions in the given program and write the correct ones instead.

No comments:

Post a Comment