Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CMU Unit 2 Practice Test

Total questions: 17

Worksheet time: 34mins

Name
Class
Date
1.

Which of the following would be a legal function call for the given function definition for drawWords()?

a)

drawWords(20,'blue)

b)

drawWords(100, 100)

c)

drawWords('blue', 'red')

d)

drawWords('blue',20)

2.

Which of the following are parameter(s) of the function drawWords() from question 1?

a)

color

b)

fontSize

c)

color and fontSize

d)

None of the above

3.

Which of the following are argument(s) of the Label function call inside the drawWords function definition?

a)

r.centerX, r.centerY, and r

b)

color, True, and r

c)

r.value and color

d)

None of the above

4.

What will be displayed on the screen when we call func()

a)

I pity the

b)

foo

c)

foo I pity the

d)

I pity the foo

5.

How many shapes are drawn in the code shown?

a)

4

b)

7

c)

8

d)

12

6.

Which of the following is not a valid property of rectangles?

a)

right

b)

bottom

c)

translation

d)

fill

7.

Both circles in the following image have a red fill. What could be the opacity of the circle on the left?

a)

10

b)

15

c)

30

d)

55

8.

Which of the following correctly multiplies the centerY of rectangle called r by 10 and updates its value?

a)

r.centerY = 10

b)

r.centerY * 10

c)

r.centerY *= 10

d)

r.centerY =* 10

9.

What is the value of c.right after the mouse is pressed 15 times?

a)

230

b)

220

c)

210

d)

180

10.

Which of the following is the correct way to bring an oval named o to the back of the canvas?

a)

toBack(o)

b)

back(o)

c)

o.toBack

d)

o.toBack()

11.

Which function gets called if we make the function call func(True)

a)

func() and bringUmbrella()

b)

func() and bringSunScreen()

c)

func() and isRaining()

d)

func()

12.

How many times is func(x) called when we call foo('red',10)

a)

0

b)

1

c)

2

d)

3

13.

Which of the following is a valid call to the function foo and will have func(x) be called 3 times?

a)

foo(5,10)

b)

foo(4, 9)

c)

foo(7, 8)

d)

foo(7, 11)

14.

Which of the following function(s) is called when turtlesSaved = 20?

a)

youAreSad()

b)

reachedGoal()

c)

youAreVeryHappy()

d)

reachedGoal() and youAreVeryHappy()

15.

Which of the following functions is called?

a)

drawCat() and drawNose()

b)

drawCat() and drawWhiskers()

c)

drawCat() and drawSphinxCat()

d)

drawCat()

16.

If we call checkID(), what is the maximum number of functions that can be called (including checkID, which counts as 1) ?

a)

3

b)

4

c)

5

d)

6

17.

Which of the following is true about if/elif/else statements?

a)

In one branch group, we can have multiple elifs run.

b)

You can use an elif without an if

c)

Code in an else has to run if all tests before it were False

d)

After using an if, you can only add one elif and one else.