No student devices needed. Know more
15 questions
Why are parameters useful?
They allow us to tailor functions to be used in multiple situations
They allow us to change the order of commands in a function
They give us the ability to use variables in loops
They allow the user to give input
How many parameters can we use in each function?
1
2
4
As many as we need
What is the best way to write a program that uses parameters to draw a square with sides that are 50 pixels long?
def make_square(length):
for i in range(4):
forward(length)
left(90)
make_square(50)
def make_square(length):
for i in range(4):
forward(50)
left(90)
make_square(50)
def make_square(50):
for i in range(4):
forward(50)
left(90)
make_square(50)
def make_square(length):
for i in range(4):
forward(length)
left(90)
make_square(length)
What is the default starting value of i in a for loop?
0
1
2
10
What will the values of i be at each iteration of the loop below?
1, 2, 3
0, 1, 2, 3
0, 1, 2
2, 3
What will happen when the value of i reaches 5 in the loop below?
for i in range(5):
left(i)
right(90)
Tracy will turn 5 degrees to the right
Tracy will turn 5 degrees to the left
Tracy will turn 90 degrees to the right
Tracy will turn 90 degrees to the left
Why do we use if statements?
To tell Tracy to stop our code if there’s an error
To have Tracy make decisions based on conditional statements
To tell Tracy to do something if we run our code
To have Tracy complete one function at a time
If we write an if statement and the condition is false, what does Tracy do?
The code stops running
Tracy gives us an error
Tracy completes the indented code
Tracy skips the commands under the if statement
How would we write an if statement where Tracy will put the pen down if a variable called count was positive?
if count >= 0:
pendown()
if count > 0():
pendown()
if count > 0:
pendown()
if count < 0:
pendown()
Which comparison operator means ‘is not equal to’?
==
=
!=
?
Which of the following is an example of an if/else statement scenario?
If it is raining, bring an umbrella.
If it is cold out wear a coat. If it is raining, wear a hat.
If it is raining, bring an umbrella. If not, wear sunglasses.
If it is not cold out, don’t wear a coat.
What is the limit of conditions that can be used in an if/else statement?
1
2
99
There is no limit
Which of the following does the clear command do?
A. Clears the screen of any markings left by Tracy
B. Turns Tracy to face right
C. Sends Tracy to position (0,0)
A only
A and B
A and C
A, B, and C
Which of the following statements is true about control structures?
Placing a for loop inside another for loop will create an infinite loop.
For loops and while loops cannot be used in the same function
If/else statements can be used inside for loops.
User input must always be turned into an integer value in order to be used to control commands
The thing I like most about remote learning is..
Doing schoolwork in my pajamas
Sleeping until 4:00 in the afternoon
Only getting out of bed to eat
Binge watching Netflix
Explore all questions with a free account