Programming basics · GCSE · OCR J277 2.3.2, AQA 8525 3.2.11, Edexcel 1CP2 1.2.5 · about 15 min
Reading an error message, and the three kinds of error by their exam names.
[1 mark]print("hello" is missing its closing bracket. What kind of error is this?
[1 mark]A program runs with no error message, but the robot drives backwards when it should go forwards. What kind of error is this?
[1 mark]A program prints two lines, then crashes on print(10 / 0). What kind of error is this?
[1 mark]A program has a syntax error on its last line. How many of its lines run?
[1 mark]Which of these would stop the program with an error message?
Tick every answer that is true.
wait("two")prin("hi")forward(50, distance=30) when you meant 20stop with no brackets[1 mark]Put the steps for fixing an error in order.
Number the lines 1 to 4 to put them in the right order.
Read the error: find the kind and the line numberLook at that line, and the line above if it looks fineRun againChange one thingThis program should turn the LED green, wait a second, drive 30 cm forward into the green zone and print arrived. It has one syntax error, one runtime error and one logic error. Fix them one at a time.
# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()
led("green"
wait("1")
backward(50, distance=30)
print("arrived")Plan your program here, then type it in and press Run.
print(10 / 0). Which of the three kinds of error is it?