WorksheetsLoops
Total questions: 15
Worksheet time: 8mins
If I want a command to be inside of a loop, how many spaces should it be indented?
1
2
3
4
Which of the following would be the best situation to use a for loop?
To make a sprite say hi 5 times.
To make the background flash different colors.
To make a sprite move from one side of the screen to another.
To check if the user input is a correct answer.
While running this program, which direction will the sprite move?
Up
Down
Left
Right
After running this program, what is the final value of x, assuming x = 0 at the beginning of the program?
0
1
25
100
How many times will this loop run?
4 times
x times
50 times
200 times (50 * 4)
Which of the following will tell the For loop how many times to run?
Loop Range
Loop Length
List Length
Integer Variable
How many times will this loop run?
0
6
60
200
Which of the following is a programming construct that allows us to repeat steps?
conditional
variable
list
loop
If I want an action to be performed on every value in my list, what do I need?
input variable
loop through list
conditional
for loop with range
I have the following list: ["red", "orange", "yellow"] What would I need to make the background change to each color in the list?
If background_color == "red"
stage.set_background_color("red")
stage.set_background_color(value)
If background_color == value
What is the final value of the variable num?
0
2
5
10
If I want an action to be performed a certain number of times, what do I need?
input variable
loop through list
conditional
for loop with range
On which line of code is there an error in this program?
Line 1
Line 3
Line 5
Line 6
What will this program do?
The sprite will go from being very small to very big
The sprite will start at the left, move towards the right and then move back to the left.
The sprite will start at the bottom, move up, and then move back down.
Nothing, there's an error in this program.
Why are loops helpful to programmers?
They let you save space in your code so you don't the same lines over and over again
They free up more memory in your computer so everything runs faster
They allow a program to store information to remember for later.
They allow the program to see if a situation is true, and run code depending on that.
