Log in
Sign up for FREE
arrow_back
Library
Basic Programming Checkpoint - For loop
By Hiba Bou Ajram
star
star
star
star
star
Share
share
Last updated over 3 years ago
10 questions
Add this activity
Instructions
Read carefully through the questions and answer them
1
1
1
1
1
1
Question 1
1.
How many tiles will the character move using the following code? Assume that
forward()
moves the character forward one tile.
for i in range(1, 5):
forward()
5
4
3
6
Use this to try out the code
Question 2
2.
Which line of code will execute the
forward()
command?
## forward()
# forward()
forward()
Question 3
3.
Which of the following pieces of code will make the character
fire()
10 times?
Question 4
4.
Which of the following pieces of code will make the character
fire()
10 times?
for i in range(1, 10):
fire()
for i in range(11):
fire()
for i in range(-10):
#fire()
for i in range(10):
fire()
Question 5
5.
Which of the following is equivalent to the code be?
for i in range(2):
forward()
right()
fire()
left()
forward()
for i in range(2):
right()
fire()
left()
forward()
for i in range(2):
right()
fire()
left()
forward()
for i in range(3):
right()
fire()
left()
Write the code here to test it
6
7
8
zoom_in
1
Question 6
6.
Blank 1 is:
1
Question 7
7.
Blank 2 is:
1
Question 8
8.
Blank 3 is:
Question 9
9.
Use loops to write the code that prints
left
right
left
right
left
right
up
visibility
View drawing
10
zoom_in
1
Question 10
10.
Explain the code assuming that the first time the user enters June, then July then August. What will be printed in each of the cases?