Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Boolean Operators & Comparison Operators

Total questions: 11

Worksheet time: 6mins

Name
Class
Date
1.

What does the 'not' operator do in coding?

a)

Repeats a loop

b)

Turns 'yes' into 'no' and 'no' into 'yes'

c)

Multiplies values

d)

None of the above

2.

If bananas[0].rotten() returns True, what will 'say not bananas[0].rotten()' print?

a)

yes

b)

no

c)

true

d)

false

3.

What is the role of 'if' statements in coding?

a)

They perform calculations

b)

They check conditions to decide which code to execute

c)

They print output

d)

They store variables

4.

Which of these is a unary operator?

a)

and

b)

or

c)

not

d)

==

5.

Why can't the monkey catch green bananas in Coding Adventure?

a)

Green bananas are for goats

b)

Green bananas are too high

c)

Green bananas are rotten

d)

Green bananas do not exist

6.

What will happen if you write: if not bananas[1].rotten() and not bananas[1].green()?

a)

The monkey will go to the banana if it's neither rotten nor green.

b)

The monkey will skip all bananas.

c)

An error will occur.

d)

The banana will disappear.

7.

The not operator changes a value to its (a)   .

8.

The statement if not eatenBreakfast() will be true for someone who (a)   eaten breakfast.

9.

In coding, the not operator is called a (a)   operator because it only takes one input.

10.

In the statement if not banana.rotten(), the monkey will go to the banana only if it is (a)   .

11.

Another example of a unary operator that you've seen in Coding Adventure is the (a)   sign, which turns a value into its negative.