wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Comparison , logical operators & If statement

Total questions: 30

Worksheet time: 3600secs

Name
Class
Date
1.

Operators are used to perform operations on values and variables .The value the operator operates on is known as- --------------

a)

Operands

b)

symbols

2.

In Python Comparison operators are also called -----------------------

a)

Relational operators

b)

Operand

c)

Boolean value

3.

-------------------they compares the operands on either side (the values) and determine the relation between them

a)

Relational operators

b)

Comparison operators

c)

All that mentioned

4.

•The output of the comparison results in ----------------according to the condition.

a)

a Boolean value

b)

returns True or False

c)

All that mentioned

5.

-------------------they compares the operands on either side (the values) and determine the relation between them

a)

logical operators

b)

Comparison operators

c)

All that mentioned

d)

Arithmetic operators

6.

Checks whether two operands are equal we use ---------------operator

a)

==

b)

=

c)

>=

7.

Checks whether two operands are not equal we use ---------------operator

a)

==

b)

!=

c)

>=

8.

Use the correct comparison operator to check if 5 is Lesser than or equal to 10.

a)

<=

b)

!=

c)

>=

9.

Check this Python program then choose the output of these Comparison operators A or B

a)

A

b)

B

10.

In Python, Logical operators are using-----------

a)

Symbols

b)

Words

11.

Logical ---------------operator : Logical operator returns True if both the operands are True else it returns False

a)

AND

b)

OR

c)

Not

12.

Logical AND operator returns True if both the operands are True else it returns False.

The output of this Python program will be

a)

True

b)

False

13.

Logical OR operator : returns True if either (at least) of the operands is True

The output of this Python program will be

a)

True

b)

False

14.

Logical not operator : work with the single Boolean value. If the Boolean value is True it returns False and vice-versa Reverse the result

a)

True

b)

False

15.

Use the correct logical operator to check if at least one of two statements is True

a)

AND

b)

OR

c)

Not

16.

Use the correct logical operator to Reverse the result of the statements

a)

AND

b)

OR

c)

Not

17.

A truth table: Is a breakdown of a logic function by listing all possible values The function can attain and their results

a)

True

b)

False

18.

What will be the result for this program


If the user entered 8

a)

True

b)

False

19.

Decision making is required when we want to execute a code only if a certain condition is satisfied.


The ----------- is used in Python for decision making

a)

if statement(s)

b)

while statement(s)

20.

In Python, the selection statements are also known as decision making statements or branching statements.

a)

True

b)

False

21.

In Python to check for multiple expressions we use ----------

a)

if...elif...else Statement

b)

if...else Statement

c)

If statement

22.

What will this code print?

a)

access denied

b)

access granted

c)

error

23.

This Python program is missing an indentation to be correct. it should be inserted at start of line ---------

a)

1

b)

2

24.

In Python if...else Statement the body of else will be executed If the condition is

a)

True

b)

False

25.

In Python if...elif...else Statement . The if block can have only one else block. But it can have multiple elif blocks

a)

True

b)

False

26.

The output of this if statement is --------

a)

a has value zero(0)

b)

a is not equal to zero

27.

In this if Statement which block will be executed ----------

a)

if block (line 3)

b)

else block (line 5)

28.

In this if Statement which block will be executed ----------

a)

if block (line 4)

b)

else block (line 6)

29.

In this if Statement which block will be executed ----------

a)

if block (line 3)

b)

else block (line 5)

30.

What will be the output of this if statement if the user entered : 10

a)

In rang

b)

negative

c)

out of range