Menu

Errors in algorithms

Card 1 of 12 0 got it 0 still learning
Question
TapClick or press space to see the answer
Answer
All 12 cards in this set
Which term describes an error where the code written does not conform to the rules or grammar of the language?
Syntax error
Which term describes an error where a program runs but does not work as the programmer intended?
Logic error
Which term describes an error that only occurs while a program is running, such as dividing a number by zero?
Runtime error
What is meant by a syntax error?
An error where the code does not follow the rules or grammar of the programming language
What is meant by a logic error?
An error where the program compiles and runs but does not work as the programmer intended
What is meant by a runtime error?
An error that occurs while the program is running, such as an attempt to divide by zero
A program contains the line print("Hello". What type of error is this?
Syntax error
A program asks for two numbers and divides the first by the second. The user enters 10 and then 0. What happens?
A runtime error occurs because division by zero is not allowed
A program should work out the area of a square but uses area = length * 2 instead of length ** 2. What type of error is this?
Logic error
Which of these is a runtime error?
The program tries to divide a number by zero while it is running
A programmer uses a trace table to find an error. What is the main purpose of a trace table?
To record the value of each variable as it changes while the program runs
A program should output the largest of three numbers but always outputs the first number. Which error type is this and why?
Logic error, because the program runs but does not give the intended result