Font size
WorksheetsConditional statements
Total questions: 80
Worksheet time: 55mins
What is the output?
3
3
7
3
5
7
7
What is the output?
True
NIL
True
NIL
True
NIL
NIL
What is the output?
level 3
level 3
level 1
level 3
level 1
NIL
level 3
level 2
level 1
NIL
What part of an if statement should be indented?
All of it
The statements within it
the first line
the lines within the brackets
Given the nested if-else below, what will be the value x when the code is executed successfully.
0
4
2
3
Given the nested if-else structure below, what will be the value of x after code execution completes.
2
0
3
4
What is the output of the following if statement?
False
True
What is the result of the code:
team = Cowboys
if team = Cowboys:
print(Dallas is #1)
Error
Cowboys
Team
Dallas is #1
What will be the output after the following statements?
0
1
2
15
error
What will be the output after the following statements?
15
yes
equal
no
error
What will be the output after the following statements?
false
true
not false
not true
error
What will be the output after the following statements?
true
not false
false
not true
error
What will be the output after the following statements?
true
not false
false
not true
error
What will be the output after the following statements?
true
not false
false
not true
error
What will be the output after the following statements?
true
not false
false
not true
error
What will be the output after the following statements?
true
not false
false
not true
error
What will be the output after the following statements?
true
not false
false
not true
error
What will be the output after the following statements?
true
not false
false
not true
error
What will be the output after the following statements?
true
not false
false
not true
error
What will be the output after the following statements?
true
not false
false
not true
error
What will be the output after the following statements?
true
not false
false
not true
error
Five c
Under the blue sea
Blue and white c
Blue sea
Crossroads
Two roads
Two white roads
Roads & roads
Animal
Cat
Black cat
Big black cat
Coffee
Coffee Gap
Coffee Break
Space between coffee
Comfortable
Come & 4 Tables
Come for table
Come to tables
Naelc
Clean up
Clean room
Black clean
(Time: 10s) Pick the odd one out
A
B
C
D
How many cubes altogether ?
(a)
When the 5 pieces shown are fitted together correctly, the result is a rectangle with a calculation written on it.
What is the answer to this calculation?
(a)
Can you find which number is missing?
(a)
Which cube it will be?
print(not (0<1))
TRUE
FALSE
TYPE ERROR
print(8!=8)
TRUE
FALSE
print(9>2 and 6<=6)
TRUE
FALSE
Choose correct option.
False
True
Error
None of these
What is the purpose of the "else" statement in an "if-else" block?
To execute a block of code if the condition is true
To execute a block of code if the condition is false
To repeat a block of code multiple times
To skip the current iteration of a loop
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")
Greater than 3
Less than or equal to 3
Invalid syntax
No output
1.How many possible values are there for a boolean variable?
0
1
2
3
2.Which of the following is not a comparison operator?
<=
?
!=
>
3.What does this Python expression evaluate to?
1000 != 1000
"False"
"True"
False
True
4.Which of the following is not a logical operator in Python?
or
and
not
because
5.What will print to the screen when the following program is run?
number = 20
greater_than_zero = number >10
print(type(number))
<class ‘bool’>
<class ‘int’>
20
10
6.What will be the output of this program?
number = 10
greater_than_zero = number > 5
if greater_than_zero:
print(number)
10
5
Nothing will print
True
7.What will be the output of this program?
number = 10
less_than_zero = number < 0
if less_than_zero:
print(number)
number = number-2
less_than_zero = number > 0
if less_than_zero:
print(number)
8
10
8
10
10
8
What is the output of the Python code :
(a)
Identify output :
OK
ERROR
No output
What will be the output of the above code:
A
B
A and B
Error
What will be the output of the expression:
3<(10 or 2)
True
False
3
10
What will be the output:
(50<100)and(10<100)
50
100
True
False
Evaluate the expression :
a=10
b=15
a and b
10
15
True
False
Predict the output:
a,b=10,20
c=b
print(b is c)
True
False
Predict the output:
a=b=10
c,b=b,a+5
print(a,b,c)
10 10 10
15 10 10
10 15 10
10 15 15
Predict the output:
"5" in [1,2,3,4,5]
True
False
Predict the output:
print(2+12//4-25%3)
12
6
4
0
If the following expression is evaluated, what type of error will occur?
x=10/0
print(x)
logical error
Syntax error
Runtime error
No error
What will be the output of the following expression:
-14>-15
True
False
Error
No output
Predict the output of the following code:
a,b,c=5,12,35
x,y,z=c-20,b+3,a*2
print(x,y,z)
15 10 15
15 15 10
10 15 15
15 10 10
Predict the output of the following code:
L=[10,24,23,45,67]
print(100//10 in L)
TRUE
FALSE
ERROR
NO OUTPUT
Predict the output of the following code:
x=8
y=2
x+=y
y-=x
print(x,y)
10 -6
10 -8
8 -6
8 -8
