Font size
WorksheetsFoundations of Computing: Final Review - Part 2
Total questions: 39
Worksheet time: 20mins
What would be the radius of the circle output from the following code?
10 pixels
20 pixels
30 pixels
40 pixels
What is the limit of conditions that can be used in an if/elif/else statement?
1
2
4
unlimited
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.
How would we write an if statement where Tracy will put the pen down if a variable called count was positive?
Option A
Option B
Option C
Option D
How many parameters can we use in each function?
As many as we need
1
2
4
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 would I collect a number from the user to use for the radius of a circle?
int(input("What is the radius?: "))
radius = int("What is the radius?: ")
radius = int(input("What is the radius?: "))
radius = int input("What is the radius?: ")
What is the correct way to ask a user for a color and store the answer as a variable?
color = input("Give a color: ")
user_color = "Give a color: "
input('Give a color: ')
user_color = input("Give a color: ")
Which command will Tracy perform when given the following code?
forward(10)
backward(10)
backward(10) circle(10)
circle(10)
Which command will Tracy perform when given the following code?
forward(200)
backward(200)
forward(201)
backward(201)
Can a user's input control the size of a circle? If so, how?
No, user input can only be a string.
Yes
circle(user_input=50)
Yes
radius = int(input("Radius: ")) circle(radius)
Yes
radius = input("Radius: ") circle(radius)
How can we use a variable to control the size of a circle?
radius = 50
circle(radius)
radius = circle(50)
circle(radius)
radius = 50
radius = 50
circle(50)
Which of these is an example of high abstraction?
I washed my car.
I went to the car wash. I put money in the machine. I used the brush to put soap on my car. I rinsed off my car.
I took my keys out of my bag. I unlocked my car. I opened the door. I sat down. I turned on the car. I put on my seatbelt. I put my phone in my bag. I put the car in drive.
I took my keys out of the right front pocket of my bag. I used the unlock button to unlock the car. I used my right hand to open the driver's side door. I put my phone in the left front pocket of my bag. I put my bag on the floor of the passenger side.
Which program will have Tracy move forward 15, then turn right and move forward 30?
Variables allow us to:
Name different parts of our programs
Use English words to communicate with Tracy
Store information to use in our programs
Change the words Tracy recognizes
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 program stops running
We get an error message
Tracy completes the indented code
Tracy skips the commands that are part of the if statement
If the following code was run, how far would Tracy move?
50 pixels
100 pixels
125 pixels
150 pixels
What character do single line (in-line) Python comments begin with?
%
#
"
/
Which of the following is NOT a valid type of comment in Python?
%% This is a comment
# This is a comment
"""
This is a comment
"""
Which is the proper way to call the function three_circles?
def three_circles:
three_circles():
def three_circles():
three_circles()
What two things must be included in your function definition?
A function name and commands to be performed
Function variables and commands to be performed
Commands to be performed and function arguments
A function name and function variables
What would be the output of the following command? circle(50,180,3)
Option A
Option B
Option C
Option D
What would be the output of the following command? circle(50,360,5)
Option A
Option B
Option C
Option D
What is the correct way to draw a circle that is filled in?
Option A
Option B
Option C
Option D
In which of the following situations would it be best to make a function?
You want Tracy to draw a blue line, and your program requires lots of blue lines.
You need Tracy to move forward by 100.
You need Tracy to turn right and then turn left.
You need to change Tracy’s color.
Suppose you want to make Tracy draw a mountain range, like the one shown in the image, starting from the left side. Which of the following functions would be the most useful function to write in order to solve this problem?
Which of the functions is defined correctly in the image?
Option A
Option B
Option C
Option D
What is the difference between defining and calling a function?
Defining a function means you are teaching the computer a new command. Calling a function means you are commanding the computer to complete defined actions.
There is no difference.
Calling a function means you are teaching the computer a new command. Defining a function means you are commanding the computer to complete defined actions.
Defining a function must be done each time you want to use the function. Calling a function can only happen once in your code.
Which program below includes no errors?
Which of the following commands can NOT be used to draw one square?
circle(50, 360, 4)
What shape will be drawn with the following command? circle(50, 360, 3)
A hexagon
A triangle
A square
A circle
Which of these are valid function names in Python?
circle circle
2_circles
two_circles
make_2_circles
What punctuation is needed to end a multi-line comment in Python?
#
/
"""
*
What is the purpose of a comment in Python?
To explain or provide notes about the code.
To end a command.
To make the code run more smoothly.
To make the code longer and more complex.
Why do we use functions in programming?
Make our code easier to use again
Shorten our code
Make our code more readable
Make math easier
Suppose you write a function. How many times can you call the function in your code?
Once
As many times as you want
It depends on the function
Not more than the number of commands the function holds
What is the correct way to change your line or fill color?
color("red")
color "red"
line(red)
color(red)
Which function name below follows all of the naming rules for Python?
Make_Tree
make_tree
make tree
my_function
