WorksheetsPython Comparison , logical operators & If statement
Total questions: 30
Worksheet time: 3600secs
Operators are used to perform operations on values and variables .The value the operator operates on is known as- --------------
Operands
symbols
In Python Comparison operators are also called -----------------------
Relational operators
Operand
Boolean value
-------------------they compares the operands on either side (the values) and determine the relation between them
Relational operators
Comparison operators
All that mentioned
•The output of the comparison results in ----------------according to the condition.
a Boolean value
returns True or False
All that mentioned
-------------------they compares the operands on either side (the values) and determine the relation between them
logical operators
Comparison operators
All that mentioned
Arithmetic operators
Checks whether two operands are equal we use ---------------operator
==
=
>=
Checks whether two operands are not equal we use ---------------operator
==
!=
>=
Use the correct comparison operator to check if 5 is Lesser than or equal to 10.
<=
!=
>=
Check this Python program then choose the output of these Comparison operators A or B
A
B
In Python, Logical operators are using-----------
Symbols
Words
Logical ---------------operator : Logical operator returns True if both the operands are True else it returns False
AND
OR
Not
Logical AND operator returns True if both the operands are True else it returns False.
The output of this Python program will be
True
False
Logical OR operator : returns True if either (at least) of the operands is True
The output of this Python program will be
True
False
•Logical not operator : work with the single Boolean value. If the Boolean value is True it returns False and vice-versa Reverse the result
True
False
Use the correct logical operator to check if at least one of two statements is True
AND
OR
Not
Use the correct logical operator to Reverse the result of the statements
AND
OR
Not
A truth table: Is a breakdown of a logic function by listing all possible values The function can attain and their results
True
False
What will be the result for this program
If the user entered 8
True
False
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
if statement(s)
while statement(s)
In Python, the selection statements are also known as decision making statements or branching statements.
True
False
In Python to check for multiple expressions we use ----------
if...elif...else Statement
if...else Statement
If statement
What will this code print?
access denied
access granted
error
This Python program is missing an indentation to be correct. it should be inserted at start of line ---------
1
2
In Python if...else Statement the body of else will be executed If the condition is
True
False
In Python if...elif...else Statement . The if block can have only one else block. But it can have multiple elif blocks
True
False
The output of this if statement is --------
a has value zero(0)
a is not equal to zero
In this if Statement which block will be executed ----------
if block (line 3)
else block (line 5)
In this if Statement which block will be executed ----------
if block (line 4)
else block (line 6)
In this if Statement which block will be executed ----------
if block (line 3)
else block (line 5)
What will be the output of this if statement if the user entered : 10
In rang
negative
out of range
