Freddy is designing toy traffic lights. He programs a toy car to stop when the lights are red and go when the lights are green. He writes this program:GoIf Red, GoIf Green, GoFreddy tests his program. But the car does not stop at a red light. Can you help Freddy debug his program? What should Freddy code?

🎲 Try a Random Question  |  Total Questions in Quiz: 10  |  🧠 Study this quiz with Flashcards
This question is part of a full practice quiz:
Grades 3, 4 and 5 - Computer Science - Elementary School - Debugging — practice the complete quiz, review flashcards, or try a random question.

Writing algorithms is fun. Writing code is fun. When you have written all the code, you have a program. Then you try out the program. This is called executing the program. But does the program work? What if there are bugs in the program? A bug is a mistake. Often bugs are there because the codes are in the wrong order. So then you have to go through all the code to find the mistake. This is called the debugging cycle


Freddy is designing toy traffic lights. He programs a toy car to stop when the lights are red and go when the lights are green. He writes this program:<br /><br />Go<br />If Red, Go<br />If Green, Go<br /><br />Freddy tests his program. But the car does not stop at a red light. Can you help Freddy debug his program? What should Freddy code?