Check your understanding of the previous reading: the order of the scientific debugging method, and matching each strategy to its description.

Question 1

Put the following steps into the correct order.

Drag the items into order, or use the arrow buttons, then check.

  1. Observe a failure in your code.
  2. Develop a hypothesis as to why the code failed.
  3. Turn this hypothesis into a prediction.
  4. Test the prediction by experimenting with the code and making observations.
  5. Repeat the previous two steps until the code is fixed.
  6. Celebrate.

This is the scientific method from the reading: observe, hypothesize, predict, experiment, and repeat steps three and four until the code works — then you're done.

Question 2

Match each debugging strategy to its description.
Develop a hypothesis that you can use to test predictions about your code.
Repeatedly divide your code in half using print statements to track the fault.
Meticulously review each line of code out loud.