WorksheetsCMU Unit 2 Practice Test
Total questions: 17
Worksheet time: 34mins
Which of the following would be a legal function call for the given function definition for drawWords()?
drawWords(20,'blue)
drawWords(100, 100)
drawWords('blue', 'red')
drawWords('blue',20)
Which of the following are parameter(s) of the function drawWords() from question 1?
color
fontSize
color and fontSize
None of the above
Which of the following are argument(s) of the Label function call inside the drawWords function definition?
r.centerX, r.centerY, and r
color, True, and r
r.value and color
None of the above
What will be displayed on the screen when we call func()
I pity the
foo
foo I pity the
I pity the foo
How many shapes are drawn in the code shown?
4
7
8
12
Which of the following is not a valid property of rectangles?
right
bottom
translation
fill
Both circles in the following image have a red fill. What could be the opacity of the circle on the left?
10
15
30
55
Which of the following correctly multiplies the centerY of rectangle called r by 10 and updates its value?
r.centerY = 10
r.centerY * 10
r.centerY *= 10
r.centerY =* 10
What is the value of c.right after the mouse is pressed 15 times?
230
220
210
180
Which of the following is the correct way to bring an oval named o to the back of the canvas?
toBack(o)
back(o)
o.toBack
o.toBack()
Which function gets called if we make the function call func(True)
func() and bringUmbrella()
func() and bringSunScreen()
func() and isRaining()
func()
How many times is func(x) called when we call foo('red',10)
0
1
2
3
Which of the following is a valid call to the function foo and will have func(x) be called 3 times?
foo(5,10)
foo(4, 9)
foo(7, 8)
foo(7, 11)
Which of the following function(s) is called when turtlesSaved = 20?
youAreSad()
reachedGoal()
youAreVeryHappy()
reachedGoal() and youAreVeryHappy()
Which of the following functions is called?
drawCat() and drawNose()
drawCat() and drawWhiskers()
drawCat() and drawSphinxCat()
drawCat()
If we call checkID(), what is the maximum number of functions that can be called (including checkID, which counts as 1) ?
3
4
5
6
Which of the following is true about if/elif/else statements?
In one branch group, we can have multiple elifs run.
You can use an elif without an if
Code in an else has to run if all tests before it were False
After using an if, you can only add one elif and one else.
