Font size
WorksheetsPython conditional execution, loops. Rev 3
Total questions: 24
Worksheet time: 48mins
What part of an if statement should be indented?
All of it
The statements within it
the first line
the lines within the brackets
What is the output?
condition
True
Program has a syntax error.
3 > 2
What is the output?
True
NIL
True
NIL
True
NIL
NIL
What will be the output
four
4
one , two
three
What will be the output?
x is greater than 5
x is equal to 10
x is greater than 5
x is greater than 10
x is equal to 10
What will be the output?
a and b is 7
a or b is 4
not a is True
a and b is 4
a or b is 7
not a is False
Syntax error
a and b is False
a or b is True
not a is True
Which two statements are used to implement iteration/Repetition)?
What does the following program display?
1,2,3,4
counter,counter,counter,counter,counter
1,2,3,4,5
0,1,2,3,4,5
what is the name of the variable used in the following code?
counter
for
#example
What will this code do?
0,1, 2, 3, 4, 5, 6, 7, 8, 9,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
Print Error
‘If’ is a decision making statement
TRUE
FALSE
Which character must be at the end of the line for if?
:
;
.
{
Failure
What is an algorithm?
A set of steps for performing a task, like a recipe.
To add something to the end; for example, adding letters onto the end of a string or adding elements to the end of a list or array.
A value passed to a function.
A rhythm designed for people named "Al."
A set of instructions that is repeated until a condition is reached is
a loop
code
a function
an expression
What is a variable?
a type of graphics
A box(memory location) where you store values
Data type
a type of memory
A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly
True
False
Loop that runs till the condition is true
list
while
for
if
In Python, the two types of loops are _____ and _______
while
for
list
if
FOR loops are
loops which run an unknown number of times
loops which run for a specific number of times
the same as if statements
not part of programming
