Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python if statement part 2

Total questions: 6

Worksheet time: 3mins

Name
Class
Date
1.

print(not (0<1))

a)

TRUE

b)

FALSE

c)

TYPE ERROR

2.

print(8!=8)

a)

TRUE

b)

FALSE

3.

print(9>2 and 6<=6)

a)

TRUE

b)

FALSE

4.

Choose correct option.

a)

False

b)

True

c)

Error

d)

None of these

5.

What is the purpose of the "else" statement in an "if-else" block?

  

a)

To execute a block of code if the condition is true

b)

To execute a block of code if the condition is false

c)

To repeat a block of code multiple times

d)

To skip the current iteration of a loop

6.

What is the output of the following code snippet?

   x = 5

   if x > 3:

       print("Greater than 3")

   else:

       print("Less than or equal to 3")

  

a)

Greater than 3

b)

Less than or equal to 3

c)

Invalid syntax

d)

No output