NEW
Font size
WorksheetsPython Booleans and selections 1
Total questions: 65
Worksheet time: 33mins
Allows us to store, change and access this information as the program runs.
Function
Variable
Loop
Array
This is the operation of joining character strings end-to-end.
Splitting
Concatenate
Subtracting
Multiplying
The result of processing an input. The print function is an example.
Input
Output
Process
Function
All functions are written in ??? case.
Upper
Lower
Title
Sentence
This is a statement in computer programming that is used to set a value to a variable name. The operator used to do assignment is denoted with an equal sign (=).
Declaration
Assignment
Comparison
Initialization
This is when you convert a variable value from one type to another. This is, in Python, done with functions such as int() or float() or str().
Casting
Looping
Iterating
Compiling
Is a sequence of characters, such as letters, numbers, special characters.
Integer
Boolean
String
Float
What is the smallest element of a programming language which expresses an action to be carried out?
Selection
Statement
Logical Operators
Boolean Expression
Which term refers to comparisons that evaluate two data sets using AND, OR, NOT?
Relational Operators
Boolean Expression
Logical Operators
Selection
What is a logical statement that is either TRUE or FALSE?
Relational Operators
Boolean Expression
Statement
Operators
Which operators are used for evaluating two data sets using < (less than), > (greater than), == (equal to)?
Logical Operators
Selection
Relational Operators
Boolean Expression
What are the constructs which can manipulate the value of operands?
Statement
Operators
Logical Operators
Selection
What is a selection statement in a computer program?
A loop that repeats a block of code
A decision within a program based on an event's result
A function that calculates a value
A variable declaration
Which of the following is a Boolean expression?
5 + 3
"Hello, World!"
x > 10
print("Python")
What happens if the Boolean expression in an 'if' statement is True?
The program stops
The indented block of code is executed
The program skips the block
The program restarts
What is the smallest element of a programming language that expresses an action?
Loop
Variable
Statement
Function
What is a Boolean Expression?
A statement that is either TRUE or FALSE.
A statement that is always TRUE.
A statement that is always FALSE.
A statement that can be TRUE, FALSE, or NULL.
What are Relational Operators used for?
Evaluating two data sets using <, >, ==.
Adding two numbers.
Subtracting two numbers.
Multiplying two numbers.
Which of the following is a Logical Operator?
AND
PLUS
MINUS
DIVIDE
In the expression "4 + 5 = 9", what is the " + " symbol called?
Operand
Result
Operator
Indicator
Which operator is used to assign a value in Python?
A. +=
B. -=
C. /=
D. =
What does the operator "+=" do in Python?
A. Subtract then reassign
B. Add then reassign
C. Divide then reassign
D. Mod then reassign
Which operator is used for integer division and reassignment in Python?
A. %=
B. //=
C. +=
D. -=
What is the function of the operator "-=" in Python?
A. Divide then reassign
B. Mod then reassign
C. Subtract then reassign
D. Assign
Which operator is used for modulus and reassignment in Python?
A. /=
B. %=
C. +=
D. //=
What are assignment operators used for in Python?
To create new variables
To assign values to variables
To delete variables
To print variables
What is an example of a simple assignment in Python?
X == 12
X = 12
X != 12
X > 12
Which operator is used to check if two values are equal in Python?
<
<=
>
==
What does the operator '!=' represent in Python?
Less than
Greater than
Equal to
Not equal to
Which operator would you use to check if a value is less than another value?
<
<=
>
>=
If you want to check if a value is greater than or equal to another value, which operator should you use?
<
<=
>
>=
What is the correct operator for checking if a value is less than or equal to another value?
<
<=
>
==
What are expressions that contain relational operators known as?
Arithmetic expressions
Boolean expressions
Logical expressions
String expressions
What will the expression return if it is correct?
False
Null
True
Undefined
Which logical operator is used when both operands need to be true for the condition to be true?
or Logical OR
not Logical NOT
and Logical AND
xor Logical XOR
What is the result of the expression (a or b) if either a or b is true?
False
True
Undefined
Zero
Which logical operator is used to reverse the logical state of its operand?
and Logical AND
or Logical OR
not Logical NOT
xor Logical XOR
Which logical operator corresponds to the truth table where the output is true only when both inputs are true?
OR
AND
XOR
NOT
Which logical operator corresponds to the truth table where the output is true when at least one input is true?
OR
AND
XOR
NOT
Which logical operator corresponds to the truth table where the output is true when exactly one input is true?
OR
AND
XOR
NOT
Which logical operator corresponds to the truth table where the output is the opposite of the input?
OR
AND
XOR
NOT
What is the result of the expression 3 == 3?
True
False
None
Undefined
In the expression (not ("testing" == "testing" or "Python" == "Fun")), what is the result of "testing" == "testing"?
True
False
None
Undefined
What does the 'not' operator do in a Boolean expression?
It makes the expression True
It inverts the Boolean value
It adds two Boolean values
It multiplies two Boolean values
What is the final result of the expression 3 == 3 and (not ("testing" == "testing" or "Python" == "Fun"))?
True
False
None
Undefined
What is the result of the expression "True and True"?
True
False
Error
None
What is the result of the expression "False and True"?
True
False
Error
None
What is the result of the expression "1 == 1 and 2 == 1"?
True
False
Error
None
What is the result of the expression '"test" == "test"'?
True
False
Error
None
What is the result of the expression "1 == 1 or 2 != 1"?
True
False
Error
None
What is the result of the expression "True and 1 == 1"?
True
False
Error
None
What is the result of the expression "False and 0 != 0"?
True
False
Error
None
What is the result of the expression "True ^ (1 == 1)"?
True
False
Error
None
What is the result of the expression '"test" == "testing"'?
True
False
Error
None
What is the result of the expression "1 != 0 and 2 == 1"?
True
False
Error
None
What is the result of the expression '"test" != "testing"'?
True
False
Error
None
What is the result of the expression '"test" == 1'?
True
False
Error
None
What is the result of the expression "not (True and False)"?
True
False
Error
None
What is the result of the expression "not (1 == 1 and 0 != 1)"?
True
False
Error
None
What is the result of the expression "not (10 == 1) ^ (1000 == 1000)"?
True
False
Error
None
What is the result of the expression "not (1 != 10 or 3 == 4)"?
True
False
Error
None
What is the result of the expression 'not ("testing" == "testing" and "Zed" == "Cool Guy")'?
True
False
Error
None
What is the result of the expression "1 == 1 and (not ("testing" == 1 or 1 == 0))"?
True
False
Error
None
What is the result of the expression '"chunky" == "bacon" and (not (3 == 4 or 3 == 3))'?
True
False
Error
None
What is the result of the expression '3 == 3 and (not ("testing" == "testing" or "Python" == "Fun"))'?
True
False
Error
None
