WorksheetsProgramming - Syntax & Logic Errors
Total questions: 10
Worksheet time: 8mins
Name
Class
Date
1.
Syntax errors are always spotted when the program is compiled or interpreted.
a)
True
b)
False
2.
Logic errors are detected by the programming IDE being used.
a)
False
b)
True
3.
Which of these pseudocode statements is an example of a logic error?
a)
FOR x=0 TO 10 STEP -1
b)
FOR x=0 TO 10 STEP 1
c)
FOR x=10 TO 0 STEP -1
d)
FOR x=0 TOO 10 STEP 1
4.
Syntax errors are caused by incorrectly typed source code.
a)
True
b)
False
5.
A program won't run if there is a logic error.
a)
False
b)
True
6.
Which of these pseudocode statements contains a syntax error?
a)
pounds = pence x 100
b)
pounds = pence * 100
c)
pounds = pence / 100
d)
pounds = 100 / pence
7.
Modern IDEs are able to spot syntax errors as the programmer types.
a)
True
b)
False
8.
A program may never contain both syntax and logic errors.
a)
False
b)
True
9.
Which statement best describes logic errors?
a)
An error in a program that causes it to produce incorrect ouputs but not a crash.
b)
An error in a program that causes it to crash.
c)
An error in the program caused by mis-spelt instructions.
d)
An error in a program caused by hardware failure.
10.
Which of these expressions will generate a logic error when the expected output is 10?
a)
answer = 2 + 3 * 2
b)
answer = (2 + 3) * 2
c)
answer = 2 + 3 x 2
d)
answer = {2 + 3} * 2
100 %
