wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Programming lesson 1 - Syntax

Total questions: 18

Worksheet time: 10mins

Name
Class
Date
1.

What type of error is present when the if statement is the wrong way round?

a)

Logic

b)

Syntax

c)

Runtime

d)

Semantic

2.

What is the solution for an error where there is no closing speech mark?

a)

Add a closing speech mark

b)

Change the print statement to lowercase

c)

Reverse the comparison signs

d)

Use a different variable name

3.

What type of error would happen if dividing by zero was in your code?

a)

Syntax error

b)

Runtime error

c)

Logic error

d)

No error

4.

How can you fix an undefined variable error in the code?

a)

Declare the variable before use

b)

Remove the variable

c)

Change the variable type

d)

Ignore the error

5.

What type of error occurs when a function is called with the wrong number of arguments?

a)

Syntax error

b)

Runtime error

c)

Logic error

d)

Semantic error

6.

How can you resolve a syntax error in your code?

a)

Check for missing punctuation

b)

Change variable names

c)

Optimize the algorithm

d)

Ignore the error

7.

What type of error is indicated by a program that compiles but produces incorrect results?

a)

Syntax error

b)

Runtime error

c)

Logic error

d)

Semantic error

8.

What type of error occurs when a variable is used before it is declared?

a)

Syntax error

b)

Runtime error

c)

Logic error

d)

Semantic error

9.

How can you fix a type mismatch error in your code?

a)

Convert the variable to the correct type

b)

Remove the variable

c)

Ignore the error

d)

Change the variable name

10.

What type of error is indicated by a program that crashes unexpectedly?

a)

Syntax error

b)

Runtime error

c)

Logic error

d)

Semantic error

11.

Why is it important that was use comments in our code?

a)

They help the program run smoothly

b)

So that when we come back to the code we can understand what it is doing

c)

To help other people understand what is going on in our code

d)

To add more colours into our code

12.

When coding in Python what two instructions would I use if I want the program to select a choice?

a)

IF

PRINT

b)

IF

COUNT

c)

IF

ELSE

d)

IF

INPUT

13.

In Python coding what does the instruction PRINT do?

a)

Instruct a printer to work

b)

Add together two numbers

c)

Print a statement on the screen

d)

Input a number

14.
Python is an example of a....
a)
Text-based programming language
b)
Object orientated programming language
c)
language written in java script
d)
Visual-based programming language
15.
Syntax errors are caused by incorrectly typed source code.
a)
True
b)
False
16.

How do we change a user input from string to integer?

a)

Casing

b)

Flipping

c)

Casting

d)

Numerising

17.

What does == mean?

a)

Assign a value to a variable

b)

Nothing, it's an error caused by typing == instead of =

c)

Check that the value on the right of the == matches the value on the left

18.

What can a variable not start with?

a)

A special character

b)

A capital letter

c)

A number

d)

A lower case letter