wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Intro to CS Spring Final Review

Total questions: 90

Worksheet time: 45mins

Name
Class
Date
1.

What is the value of s.radius after the mouse click?

a)

20

b)

30

c)

50

d)

70

2.

What is the value of s.points after the mouse click?

a)

1

b)

9

c)

10

d)

11

3.

What is the value of s.roundness after the mouse click?

a)

4

b)

14

c)

40

d)

100

4.

If the user clicks the mouse at (100, 200). What value is printed for mouseY?

a)

mouseY = 100

b)

mouseY = 101

c)

mouseY = 200

d)

mouseY = 201

5.

If the user clicks the mouse at (100, 200). What value is printed for sky.height?

a)

sky.height = 100

b)

sky.height = 101

c)

sky.height = 200

d)

sky.height = 201

6.

What value is printed for counter.value after the user clicks the mouse?

a)

counter.value = 1

b)

counter.value = 15

c)

counter.value = 16

d)

There is a runtime error

7.

What value is printed for counter.value after the user clicks the mouse?

a)

counter.value = 1

b)

counter.value = 15

c)

counter.value = 16

d)

There is a runtime error

8.

What value is printed for counter.value after the user clicks the mouse?

a)

counter.value = 1

b)

counter.value = 15

c)

counter.value = 16

d)

There is a runtime error

9.

Which of following correctly adds and updates the value of a label 'counter' by 3?

a)

counter.value=counter.value+3

b)

counter.value+=3

c)

counter.value+3

d)

counter.value=3

e)

counter.value=+3

10.

Boolean expression: an expression that evaluates to either true or false.

(3 > 2) is

a)

True

b)

False

11.

Boolean values are true or false. Which parameter is a boolean?


Rect(left, top, width, height, fill='black', opacity=100, visible=True)

a)

left

b)

fill

c)

opacity

d)

visible

12.

A Boolean expression .....

a)

Loops the programs to continue infinitely

b)

Sets everything in it equal to eachother

c)

Checks if something is True or False

d)

Fixes any errors in the line of code

13.

How many values does a Boolean variable have?

a)

1

b)

2

c)

4

d)

infinite

14.

Where can boolean expressions be found?

a)

variables

b)

If statements

c)

By itself

d)

assignment statement

15.

Which numbers for x would cause the boolean expression x <= 14 to be True?

a)

3, 17, 20

b)

1, 11, 14

c)

14, 18, 20

d)

13, 14, 15

16.

Fill in the blank so that people that are 18 years old and older are allowed to vote.

a)

<

b)

>

c)

<=

d)

>=

17.

How many shapes are drawn according to the code below?

a)

2

b)

3

c)

5

d)

6

e)

8

18.

How many shapes are drawn according to the code below?

a)

2

b)

3

c)

5

d)

6

e)

8

19.

How many shapes are drawn according to the code below?

a)

1

b)

2

c)

3

d)

4

20.

How many shapes are drawn according to the code below?

a)

1

b)

2

c)

3

d)

4

21.

Which of the following is drawn when the mouse is released?

a)

Two non-touching circles

b)

red circle covering part of the blue circle

c)

blue circle covering part of the red circle

d)

blue circle covering the red circle

e)

red circle covering the blue circle

22.

Which of the following is drawn when the mouse is released?

a)

Two non-touching circles

b)

red circle covering part of the blue circle

c)

blue circle covering part of the red circle

d)

blue circle covering the red circle

e)

red circle covering the blue circle

23.

What are the line #'s of the function definition?

a)

38

b)

39

c)

40

d)

41

e)

43

24.

What are the line #'s of the function body?

a)

38

b)

39

c)

40

d)

41

e)

43

25.

What are the line #'s of the function call?

a)

38

b)

39

c)

40

d)

41

e)

43

26.

Select the function parameters

a)

x

b)

y

c)

color

d)

140

e)

'red'

27.

What are the line #'s of the function definition?

a)

38

b)

39

c)

40

d)

41

e)

43

28.

What are the line #'s of the function body?

a)

38

b)

39

c)

40

d)

41

e)

43

29.

What are the line #'s of the function call?

a)

38

b)

39

c)

40

d)

41

e)

43

30.

Select the function parameters

a)

x

b)

y

c)

color

d)

140

e)

'red'

31.

Select the function arguments

a)

x

b)

y

c)

color

d)

140

e)

'red'

32.

What is the function name?

a)

def drawCompartment(x, y, color):

b)

def drawCompartment

c)

drawCompartment

d)

drawCompartment(140, 105, 'red')

33.

The function body must be indented.

a)

True

b)

False

34.

How many times is line 39 executed?

a)

1

b)

8

c)

9

d)

Depends

35.

How many arguments are required for the "Rect" code?

a)

None

b)

1

c)

2

d)

3

e)

4

36.

What are the required arguments for the "Rect" code?

a)

left

b)

top

c)

width

d)

height

e)

fill

37.

What is the default fill value?

a)

None

b)

black

c)

white

d)

none of the above

38.

For the "Rect" code, fill, border and borderWidth

a)

are required arguments

b)

do not have default values

c)

are optional arguments

d)

have default values

39.

For the "Rect" code, left, top, width and length

a)

are required arguments

b)

do not have default values

c)

are optional arguments

d)

have default values

40.

How many arguments are required for the "Rect" code?

a)

None

b)

1

c)

2

d)

3

e)

4

41.

What are the required arguments for the "Rect" code?

a)

left

b)

top

c)

width

d)

height

e)

fill

42.

What is the default fill value?

a)

None

b)

black

c)

white

d)

none of the above

43.

For the "Rect" code, fill, border and borderWidth

a)

are required arguments

b)

do not have default values

c)

are optional arguments

d)

have default values

44.

For the "Rect" code, left, top, width and length

a)

are required arguments

b)

do not have default values

c)

are optional arguments

d)

have default values

45.

What is the default border value?

a)

None

b)

black

c)

white

d)

none of the above

46.

What is the default borderWidth value?

a)

None

b)

1

c)

2

d)

none of the above

47.

What color is rgb(0,0,0)?

a)

white

b)

red

c)

black

d)

blue

48.

What color is rgb(255,255,255?

a)

white

b)

red

c)

black

d)

blue

49.

What is a radial gradient?

a)

fade straight across the shape

b)

fade from the ouside of the shape towards the center

c)

fade from the center of the shape outwards to its border

d)

fade straight across the shape from top to bottom

50.

What is a linear gradient?

a)

fade straight across the shape specified by start

b)

fade from the ouside of the shape towards the center specified by start

c)

fade from the center of the shape outwards to its border specified by start

d)

fade straight across the shape from top to bottom specified by start

51.

What is the default value for the optional argument start?

a)

left

b)

top

c)

center

d)

right

e)

left top

52.

This is an invalid value for the optional argument start?

a)

left-bottom

b)

center

c)

top-right

53.

What is the default value for the optional argument opacity?

a)

50

b)

0

c)

100

54.

Which of the following mouse events have we not learned?

a)

onMouseRelease

b)

onMouseMove

c)

onDragRelease

d)

onMouseDrag

55.

Which of the following is not a valid test to use in a conditional?

a)

x >= y

b)

x <= y

c)

x = y

d)

x != y

56.

Which of the following functions gets called every time we move the mouse?

a)

onMouseMove

b)

onMousePress

c)

onMouseRelease

d)

onMouseDrag

57.

How many stars will this code draw?

a)

0

b)

1

c)

2

d)

3

58.

Which of the following tests will be true given x is 20?

a)

x != 20

b)

x > 25

c)

x < 25

d)

x == 25

59.

Which function will be called?

a)

f(x)

b)

g(x)

c)

Both

d)

Neither

60.

How many times will f(x) be called when x = 25?

a)

1

b)

2

c)

3

d)

4

61.

Which of the following tests would be false if y is 4?

a)

y > 3

b)

y <= 3

c)

y >= 2

d)

y == 4

62.

Which of the following is false about helper functions?

a)

They are used to help another function perform its work

b)

Helper functions can be called from event functions

c)

Helper functions can use other function’s parameters

d)

None of the above

63.

Which of the following is drawn if the mouse is being pressed and moved across the canvas?

a)

Teal stars

b)

Labels that say ‘Hi’

c)

Both teal stars and labels that say ‘Hi’

d)

Nothing

64.

When the user clicks the mouse, where is Awesome printed?

a)

Top Half of the Canvas

b)

Bottom Half of the Canvas

c)

Right Side of the Canvas

d)

Left Side of the Canvas

65.

When the user clicks the mouse, where is Wonderful printed?

a)

Top Half of the Canvas

b)

Bottom Half of the Canvas

c)

Right Side of the Canvas

d)

Left Side of the Canvas

66.

When the user clicks the mouse, where is Fantastic printed?

a)

Top Half of the Canvas

b)

Bottom Half of the Canvas

c)

Right Side of the Canvas

d)

Left Side of the Canvas

67.

When the user clicks the mouse, where is Amazing printed?

a)

Top Half of the Canvas

b)

Bottom Half of the Canvas

c)

Right Side of the Canvas

d)

Left Side of the Canvas

68.

dotRed.centerX=

a)

dotGreen.centerX

b)

dotYellow.centerX

c)

dotBlue.centerX

69.

dotRed.centerY=

a)

dotGreen.centerY

b)

dotYellow.centerY

c)

dotBlue.centerY

70.

dotGreen.centerX=

a)

400 - dotRed.centerX

b)

400 - dotBlue.centerX

c)

400 - dotRed.centerY

d)

400 - dotBlue.centerY

71.

dotGreen.centerY=

a)

400 - dotRed.centerY

b)

400 - dotBlue.centerY

c)

400 - dotRed.centerX

d)

400 - dotBlue.centerX

72.

When the user clicks the mouse, where is Awesome printed?

a)

Top Half of the Canvas

b)

Bottom Half of the Canvas

c)

Right Side of the Canvas

d)

Left Side of the Canvas

73.

When the user clicks the mouse, where is Wonderful printed?

a)

Top Half of the Canvas

b)

Bottom Half of the Canvas

c)

Right Side of the Canvas

d)

Left Side of the Canvas

74.

When the user clicks the mouse, where is Fantastic printed?

a)

Top Half of the Canvas

b)

Bottom Half of the Canvas

c)

Right Side of the Canvas

d)

Left Side of the Canvas

75.

When the user clicks the mouse, where is Amazing printed?

a)

Top Half of the Canvas

b)

Bottom Half of the Canvas

c)

Right Side of the Canvas

d)

Left Side of the Canvas

76.

dotRed.centerX=

a)

dotGreen.centerX

b)

dotYellow.centerX

c)

dotBlue.centerX

77.

dotRed.centerY=

a)

dotGreen.centerY

b)

dotYellow.centerY

c)

dotBlue.centerY

78.

dotGreen.centerX=

a)

400 - dotRed.centerX

b)

400 - dotBlue.centerX

c)

400 - dotRed.centerY

d)

400 - dotBlue.centerY

79.

dotGreen.centerY=

a)

400 - dotRed.centerY

b)

400 - dotBlue.centerY

c)

400 - dotRed.centerX

d)

400 - dotBlue.centerX

80.

Which of the following is a valid function name?

a)

None

b)

1234

c)

drawCircle

d)

def

81.

Given the function shown, which of the following would be a valid function call?

a)

drawBigCircle(“purple”, 20, 300)

b)

drawBigCircle(200, 200, “red”)

c)

drawBigCircle(300, “blue”, 200)

d)

Circle(200, 300, “green”)

82.

Which of the following correctly uses the print function to print to the console?

a)

print helloWorld

b)

print(“hello world”)

c)

print(helloWorld)

d)

print “hello world”

83.

Which of the following shapes does not have a radius property?

a)

Circle

b)

RegularPolygon

c)

Star

d)

Rect

84.

Which of the following is not a fill or border property?

a)

borderStyle

b)

fill

c)

dashes

d)

borderWidth

85.

What do you click to run all of the test cases given in the problem?

a)

Run button

b)

Reset

c)

Test case 1

d)

Autograder

86.

Which of the following is false about global variables?

a)

They should be used sparingly

b)

They should be used all the time

c)

They are used to refer to shapes

d)

They can be used inside and outside of functions

87.

Which of the following is l.value?

a)

‘Hello’

b)

200

c)

20

d)

Label

88.

Which of the following is not a property of all shapes?

a)

bottom

b)

radius

c)

visible

d)

align

89.

Which properties of the given RegularPolygon correspond to a value of 50 and 20 respectively?

a)

s.centerX and s.centerY

b)

s.centerX and s.radius

c)

s.radius and s.centerX

d)

s.centerY and s.radius

90.

Which argument is OPTIONAL when using Rect()

a)

left

b)

fill

c)

width

d)

top