Font size
WorksheetsIntro to CS Spring Final Review
Total questions: 90
Worksheet time: 45mins
What is the value of s.radius after the mouse click?
20
30
50
70
What is the value of s.points after the mouse click?
1
9
10
11
What is the value of s.roundness after the mouse click?
4
14
40
100
If the user clicks the mouse at (100, 200). What value is printed for mouseY?
mouseY = 100
mouseY = 101
mouseY = 200
mouseY = 201
If the user clicks the mouse at (100, 200). What value is printed for sky.height?
sky.height = 100
sky.height = 101
sky.height = 200
sky.height = 201
What value is printed for counter.value after the user clicks the mouse?
counter.value = 1
counter.value = 15
counter.value = 16
There is a runtime error
What value is printed for counter.value after the user clicks the mouse?
counter.value = 1
counter.value = 15
counter.value = 16
There is a runtime error
What value is printed for counter.value after the user clicks the mouse?
counter.value = 1
counter.value = 15
counter.value = 16
There is a runtime error
Which of following correctly adds and updates the value of a label 'counter' by 3?
counter.value=counter.value+3
counter.value+=3
counter.value+3
counter.value=3
counter.value=+3
Boolean expression: an expression that evaluates to either true or false.
(3 > 2) is
True
False
Boolean values are true or false. Which parameter is a boolean?
Rect(left, top, width, height, fill='black', opacity=100, visible=True)
left
fill
opacity
visible
A Boolean expression .....
Loops the programs to continue infinitely
Sets everything in it equal to eachother
Checks if something is True or False
Fixes any errors in the line of code
How many values does a Boolean variable have?
1
2
4
infinite
Where can boolean expressions be found?
variables
If statements
By itself
assignment statement
Which numbers for x would cause the boolean expression x <= 14 to be True?
3, 17, 20
1, 11, 14
14, 18, 20
13, 14, 15
Fill in the blank so that people that are 18 years old and older are allowed to vote.
<
>
<=
>=
How many shapes are drawn according to the code below?
2
3
5
6
8
How many shapes are drawn according to the code below?
2
3
5
6
8
How many shapes are drawn according to the code below?
1
2
3
4
How many shapes are drawn according to the code below?
1
2
3
4
Which of the following is drawn when the mouse is released?
Two non-touching circles
red circle covering part of the blue circle
blue circle covering part of the red circle
blue circle covering the red circle
red circle covering the blue circle
Which of the following is drawn when the mouse is released?
Two non-touching circles
red circle covering part of the blue circle
blue circle covering part of the red circle
blue circle covering the red circle
red circle covering the blue circle
What are the line #'s of the function definition?
38
39
40
41
43
What are the line #'s of the function body?
38
39
40
41
43
What are the line #'s of the function call?
38
39
40
41
43
Select the function parameters
x
y
color
140
'red'
What are the line #'s of the function definition?
38
39
40
41
43
What are the line #'s of the function body?
38
39
40
41
43
What are the line #'s of the function call?
38
39
40
41
43
Select the function parameters
x
y
color
140
'red'
Select the function arguments
x
y
color
140
'red'
What is the function name?
def drawCompartment(x, y, color):
def drawCompartment
drawCompartment
drawCompartment(140, 105, 'red')
The function body must be indented.
True
False
How many times is line 39 executed?
1
8
9
Depends
How many arguments are required for the "Rect" code?
None
1
2
3
4
What are the required arguments for the "Rect" code?
left
top
width
height
fill
What is the default fill value?
None
black
white
none of the above
For the "Rect" code, fill, border and borderWidth
are required arguments
do not have default values
are optional arguments
have default values
For the "Rect" code, left, top, width and length
are required arguments
do not have default values
are optional arguments
have default values
How many arguments are required for the "Rect" code?
None
1
2
3
4
What are the required arguments for the "Rect" code?
left
top
width
height
fill
What is the default fill value?
None
black
white
none of the above
For the "Rect" code, fill, border and borderWidth
are required arguments
do not have default values
are optional arguments
have default values
For the "Rect" code, left, top, width and length
are required arguments
do not have default values
are optional arguments
have default values
What is the default border value?
None
black
white
none of the above
What is the default borderWidth value?
None
1
2
none of the above
What color is rgb(0,0,0)?
white
red
black
blue
What color is rgb(255,255,255?
white
red
black
blue
What is a radial gradient?
fade straight across the shape
fade from the ouside of the shape towards the center
fade from the center of the shape outwards to its border
fade straight across the shape from top to bottom
What is a linear gradient?
fade straight across the shape specified by start
fade from the ouside of the shape towards the center specified by start
fade from the center of the shape outwards to its border specified by start
fade straight across the shape from top to bottom specified by start
What is the default value for the optional argument start?
left
top
center
right
left top
This is an invalid value for the optional argument start?
left-bottom
center
top-right
What is the default value for the optional argument opacity?
50
0
100
Which of the following mouse events have we not learned?
onMouseRelease
onMouseMove
onDragRelease
onMouseDrag
Which of the following is not a valid test to use in a conditional?
x >= y
x <= y
x = y
x != y
Which of the following functions gets called every time we move the mouse?
onMouseMove
onMousePress
onMouseRelease
onMouseDrag
How many stars will this code draw?
0
1
2
3
Which of the following tests will be true given x is 20?
x != 20
x > 25
x < 25
x == 25
Which function will be called?
f(x)
g(x)
Both
Neither
How many times will f(x) be called when x = 25?
1
2
3
4
Which of the following tests would be false if y is 4?
y > 3
y <= 3
y >= 2
y == 4
Which of the following is false about helper functions?
They are used to help another function perform its work
Helper functions can be called from event functions
Helper functions can use other function’s parameters
None of the above
Which of the following is drawn if the mouse is being pressed and moved across the canvas?
Teal stars
Labels that say ‘Hi’
Both teal stars and labels that say ‘Hi’
Nothing
When the user clicks the mouse, where is Awesome printed?
Top Half of the Canvas
Bottom Half of the Canvas
Right Side of the Canvas
Left Side of the Canvas
When the user clicks the mouse, where is Wonderful printed?
Top Half of the Canvas
Bottom Half of the Canvas
Right Side of the Canvas
Left Side of the Canvas
When the user clicks the mouse, where is Fantastic printed?
Top Half of the Canvas
Bottom Half of the Canvas
Right Side of the Canvas
Left Side of the Canvas
When the user clicks the mouse, where is Amazing printed?
Top Half of the Canvas
Bottom Half of the Canvas
Right Side of the Canvas
Left Side of the Canvas
dotRed.centerX=
dotGreen.centerX
dotYellow.centerX
dotBlue.centerX
dotRed.centerY=
dotGreen.centerY
dotYellow.centerY
dotBlue.centerY
dotGreen.centerX=
400 - dotRed.centerX
400 - dotBlue.centerX
400 - dotRed.centerY
400 - dotBlue.centerY
dotGreen.centerY=
400 - dotRed.centerY
400 - dotBlue.centerY
400 - dotRed.centerX
400 - dotBlue.centerX
When the user clicks the mouse, where is Awesome printed?
Top Half of the Canvas
Bottom Half of the Canvas
Right Side of the Canvas
Left Side of the Canvas
When the user clicks the mouse, where is Wonderful printed?
Top Half of the Canvas
Bottom Half of the Canvas
Right Side of the Canvas
Left Side of the Canvas
When the user clicks the mouse, where is Fantastic printed?
Top Half of the Canvas
Bottom Half of the Canvas
Right Side of the Canvas
Left Side of the Canvas
When the user clicks the mouse, where is Amazing printed?
Top Half of the Canvas
Bottom Half of the Canvas
Right Side of the Canvas
Left Side of the Canvas
dotRed.centerX=
dotGreen.centerX
dotYellow.centerX
dotBlue.centerX
dotRed.centerY=
dotGreen.centerY
dotYellow.centerY
dotBlue.centerY
dotGreen.centerX=
400 - dotRed.centerX
400 - dotBlue.centerX
400 - dotRed.centerY
400 - dotBlue.centerY
dotGreen.centerY=
400 - dotRed.centerY
400 - dotBlue.centerY
400 - dotRed.centerX
400 - dotBlue.centerX
Which of the following is a valid function name?
None
1234
drawCircle
def
Given the function shown, which of the following would be a valid function call?
drawBigCircle(“purple”, 20, 300)
drawBigCircle(200, 200, “red”)
drawBigCircle(300, “blue”, 200)
Circle(200, 300, “green”)
Which of the following correctly uses the print function to print to the console?
print helloWorld
print(“hello world”)
print(helloWorld)
print “hello world”
Which of the following shapes does not have a radius property?
Circle
RegularPolygon
Star
Rect
Which of the following is not a fill or border property?
borderStyle
fill
dashes
borderWidth
What do you click to run all of the test cases given in the problem?
Run button
Reset
Test case 1
Autograder
Which of the following is false about global variables?
They should be used sparingly
They should be used all the time
They are used to refer to shapes
They can be used inside and outside of functions
Which of the following is l.value?
‘Hello’
200
20
Label
Which of the following is not a property of all shapes?
bottom
radius
visible
align
Which properties of the given RegularPolygon correspond to a value of 50 and 20 respectively?
s.centerX and s.centerY
s.centerX and s.radius
s.radius and s.centerX
s.centerY and s.radius
Which argument is OPTIONAL when using Rect()
left
fill
width
top
