wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python

Total questions: 29

Worksheet time: 28mins

Name
Class
Date
1.

Select the correct Operator for addition

a)

+

b)

=

c)

X

d)

$

2.

Select the correct operator for subtraction:

a)

*

b)

-

c)

_

d)

*

3.

Select the correct operator for multiplication:

a)

x

b)

*

c)

**

d)

+

4.

Select the correct operator for division:

a)

/

b)

\

c)

"

d)

!

5.

Select the correct answer:


x = 15

y = 4


print( 'x * y')

a)

59

b)

60

c)

54

d)

22

6.

Logical operators:


True if both operands are true

a)

x and y

b)

x or y

c)

not x

7.

Logical Operators:


True if either of the operands is true

a)

x and y

b)

x or y

c)

not x

8.

Logical Operators:


true if operand is false

a)

x and y

b)

x or y

c)

not x

9.

Which python operator means 'less than or equal to'?

a)

>=

b)

>

c)

<

d)

<=

10.

x = 10

y = 10


print(x != y)

a)

True

b)

False

11.

x = 5

y = 3


print(x == y)

a)

True

b)

False

12.

x = 8


print(x > 3 or x < 20)

a)

True

b)

False

13.

What does the following comparison operator “==” represent in Python programming?

a)

Equal to

b)

Assignment

c)

Allocation

d)

Not equal to.

14.

What does the following comparison operator “<” represent in Python programming?

a)

Equal to

b)

Greater than

c)

Less than

d)

Not equal to.

15.

What does the following comparison operator “>” represent in Python programming?

a)

Equal to

b)

Greater than

c)

Less than

d)

Not equal to.

16.

What does the following comparison operator “!=” represent in Python programming?

a)

Equal to

b)

Assignment

c)

Allocation

d)

Not equal to.

17.

print cannot have a capital

(a)  

18.

To output hello world! which would be the correct python line of code

a)

output("Hello World!)

b)

Print("Hello World!)

c)

print("hello world!)

d)

print("hello world")

19.

What is the variable in the code shown

a)

variable

b)

Name

c)

print

d)

name

20.

Pick a syntax error in the code

a)

Capital P for print

b)

Missing brackets

c)

Missing comma

d)

Missing speech marks

21.

What is the output of the following code if raining was entered

a)

Take a brolly!

b)

Have a great day

c)

The code would not run

22.

What is the output of the following code if Raining was entered

a)

Take a brolly!

b)

Have a great day

c)

The code would not run

23.

What is the output of the following code if sunny was entered

a)

Take a brolly!

b)

Have a great day

c)

The code would not run

24.

What would output if the answer to Q1 was london?

a)

well done you have a point

b)

try again

c)

the code would not run

25.

What would output if the answer to Q2 was barcelona?

a)

well done you have a point

b)

try again

c)

the code would not run

26.

What would the score be if the answer to Q1 was manchester and the answer to Q2 was madrid?

(a)  

27.

Name the first variable in this code

(a)  

28.

What key term in python allows the user to answer a question

(a)  

29.

If you have a syntax error will the code run?

a)

Yes

b)

No