Worksheetsgrade 9 week 4
Total questions: 104
Worksheet time: 52mins
What is an operator in programming?
A device to run programs
A tool to solve math
A symbol to perform an operation
A name for functions
Which of the following is an arithmetic operator?
==
and
+
!=
What does the operator == mean?
Assignment
Equal to
Not equal
Addition
Which operator is used to assign a value to a variable?
==
=
:=
+=
What is the main purpose of logical operators?
To create variables
To perform math
To combine conditions
To call functions
Which of these is a comparison operator?
+
or
!=
**
What does the operator != represent?
Less than
Not equal
Assignment
Greater than
What does the operator and do?
Returns True if both conditions are true
Returns False always
Adds numbers
Compares strings
What does the operator or do?
Returns True only if both conditions are false
Returns True if at least one condition is true
Compares numbers
Always returns False
What does not do in Boolean logic?
Repeats a loop
Makes a value zero
Reverses the truth value
Multiplies a value
What is the result of 5 + 3?
7
8
9
6
What is the result of 10 - 6?
5
6
4
3
What is the result of 4 * 2?
8
6
4
2
What is the result of 12 / 4?
3
2
4
5
What does 10 % 3 return?
1
2
3
0
What does 2 ** 3 return?
6
8
9
5
Which operator gives only the whole number result of a division?
/
//
%
*
What is the output of 7 // 2?
3.5
3
2
4
What does the * operator do?
Division
Addition
Multiplication
Comparison
What is the result of 9 % 2?
0
2
1
3
What does 5 == 5 return?
False
True
Error
0
What is the output of 7 != 3?
False
True
0
None
What does 6 > 2 return?
True
False
Error
None
What does 3 < 1 return?
True
False
1
0
What is the result of 4 >= 4?
True
False
None
0
What is the result of 2 <= 1?
True
False
Error
1
Which operator is used for 'greater than'?
>
<
>=
==
What does == compare?
Data type
Object type
Values
Memory address
Which operator checks 'less than or equal to'?
<=
<
==
>=
What does 5 != 5 return?
True
False
5
None
What does x = 10 mean?
x is added 10
x becomes 10
x is deleted
10 becomes x
What does x += 2 mean?
x = x + 2
x = x - 2
x = 2
x * 2
What does x -= 1 mean?
x = x - 1
x = x + 1
x = 1
x = x / 1
What does x *= 3 mean?
x = x * 3
x = x + 3
x = 3
x = x - 3
What does x /= 2 do?
x = x / 2
x = 2 / x
x = x * 2
x = 2
Which operator is used for assigning values?
==
=
:=
=>
What happens with x = x + 1?
x increases by 1
x becomes 0
x is divided
x stays the same
What is another way to write x = x + 1?
x++
x += 1
x =+ 1
+x = 1
What is x = x * 2 used for?
Doubling x
Halving x
Squaring x
Making x zero
What does x = x - 5 do?
Adds 5
Subtracts 5
Multiplies by 5
Divides
What is x = x * 2 used for?
Doubling x
Halving x
Squaring x
Making x zero
What does x = x - 5 do?
Adds 5
Subtracts 5
Multiplies by 5
Divides by 5
What is the result of True and True?
True
False
None
1
What is the result of True and False?
False
True
None
Error
What is the result of True or False?
True
False
None
Error
What is the result of False or False?
True
False
Error
None
What is not True?
False
True
None
0
What is not False?
False
True
Error
None
Which condition returns False?
True and True
True or False
False and True
not False
Which condition returns True?
not True
False and False
True or False
False or False
Which of the following uses both logical and comparison operators?
3 + 2
x = 5
5 > 3 and 4 < 6
4 % 2
Why are logical operators useful?
To make decisions
To add numbers
To print messages
To create strings
What is conditional logic in programming?
Repeating a task
Making decisions
Drawing shapes
Creating variables
Which keyword is used to start a condition in Python?
when
condition
if
loop
What happens when the condition in an if statement is False?
Code runs anyway
Code is skipped
It gives an error
The program stops
What keyword is used when the condition is not true?
otherwise
else
skip
next
What does elif mean in Python?
End if
Else if
Extra loop
Entry level
Which of these is a correct comparison operator?
=
!=
:=
then
What does x == 5 check?
If x becomes 5
If x is equal to 5
If x is more than 5
If x is assigned 5
What is the output of if 10 > 5:?
Error
Nothing
The code inside runs
Program crashes
What is the result of if False:?
Runs
Skips
Loops
Crashes
Conditional logic is used to...
Build graphics
Make decisions
Store data
Repeat code
What does != mean?
Equal
Not equal
Assignment
Less than
What is the result of 4 < 7?
True
False
None
Error
What is the result of 10 >= 10?
False
True
Error
Maybe
Which of the following is a valid condition?
if 5 > 3
if 5 = 3
if = 3
if True =
What does if age > 18: do?
Checks if age is under 18
Checks if age is exactly 18
Checks if age is more than 18
Assigns 18 to age
What does <= mean?
Equal
Not equal
Greater than
Less than or equal to
What is the result of 8 == 8?
False
True
Error
0
If score = 90, what does score > 100 return?
True
False
Error
90
What is the use of comparison operators?
Assign values
Compare values
Add numbers
Multiply data
if x < 10: means?
Run if x is more than 10
Run if x is less than 10
Always run
Never run
Which block runs if the condition is False?
if
else
loop
def
What is the correct format?
if x > 5 then:
if x > 5:
if > x 5:
if (x > 5)
What does this print? python SalinEdit x = 7 if x < 10: print("Yes")
No
Yes
Nothing
Erro
What is the correct format?
if x > 5 then:
if x > 5:
if > x 5:
if (x > 5)
What does this print? x = 7 if x < 10: print("Yes")
No
Yes
Nothing
Error
What does this code do? if x == 5: print("Five") else: print("Not five")
Prints always
Makes error
Prints based on condition
Skips both
Can we use multiple elif?
No
Only once
Yes
Only after else
Which is the correct order?
elif → if → else
if → else → elif
if → elif → else
else → if → elif
What happens if all conditions are False?
All run
Only if runs
Only elif runs
Only else runs
if x != y: means?
x is equal to y
x is not equal to y
x becomes y
x minus y
Which of the following is valid?
if (x = 5)
if x == 5
if x => 5
if == x 5
What happens in this code? if True: print("Hello")
Skips print
Prints Hello
Errors
Prints False
What does and mean?
Both conditions must be True
One must be False
None should be True
Always False
What does or mean?
Both must be False
Only one must be True
All must be True
Neither condition matters
What does not do?
Add 1
Make it True
Reverse the result
Multiply
What is not True?
True
False
Error
None
Which condition is True?
False and False
True or False
False or False
False and True
What does this code return? if True and False: print("Yes")
Yes
Nothing
Error
False
What is not (4 > 2)?
True
False
Error
None
Which operator combines two True conditions?
or
not
and
=
Which of the following will return True?
5 > 10 and 2 < 3
4 == 4 or 3 > 5
10 < 5
not True
Which operator means "at least one is true"?
and
or
not
all
What does this mean? "You can play if it's Saturday or your homework is done"
Both must be true
Only Saturday is enough
Neither needed
Homework is not important
What does this logic check? if temperature > 30:
It's cold
It's hot
It's night
It's zero
Why is if important in programs?
To draw
To decide
To loop
To define
Can we nest if statements?
No
Yes
Only in loops
Only with numbers
What is this code? if rain and umbrella: print("Go out")
Wrong
Condition with and
Invalid
Nothing
What does if age >= 17: check?
If age is less
If age is more or equal
If age is 17
If age is not 17
What does if not raining: mean?
It is raining
It is not raining
It's sunny
It's winter
What's the output? x = 3 if x < 5: print("Small")
Small
Big
Error
None
What is the use of indentation after if?
Looks nice
To show block of code
For styling
Not required
When will this print "Allowed"? if age >= 18: print("Allowed")
When age is 18 or more
When age is less than 18
Always
Never
