WorksheetsUnit 1-4 Review
Total questions: 35
Worksheet time: 18mins
Which shape has an optional parameter called roundness that determines how closely it resembles a circle?
Oval
Rect
Star
Circle
What parameter can be used to change the way the text looks in a label created with the Label function?
Bold
Italic
Font
Size
Which parameter is used to set the thickness of a line drawn with the Line function?
lineWidth
border
dashes
opacity
For which shape is the align parameter the only property that CANNOT be changed after the shape is defined?
Polygon
Arc
Circle
Line
What is the default color for the fill parameter in all shapes?
Black
White
Red
Green
In the RGB color model, what does the first value represent?
Intensity of Blue
Intensity of Red
Intensity of Green
Intensity of Black
Which shape does NOT have an optional parameter called size to control the font size of the text?
Line
Oval
Polygon
Label
What is the purpose of using the pass statement in a function?
To terminate the function execution
To skip the function entirely
To tell Python to do nothing for that function
To pass arguments to the function
Which of the following is a legal function name in Python?
2hello
hello world
Say_hi
helloWorld
How are parameters and arguments related in a function?
They can be used interchangeably
They must match in number and order
Arguments are optional, parameters are mandatory
Parameters are only used for mouse events
What does the onMousePress(mouseX, mouseY) function do?
Adds a shape to the canvas
Prints the mouse coordinates
Executes when the mouse is released
Modifies existing shapes on mouse press
What is the purpose of using the print statement in coding, especially during debugging?
To display information for users
To delete code
To help understand and debug the code
To access the inspector
When is top-level code executed in a Python program?
After any event is called
Before any event is called
Only when mouse events occur
When the program terminates
Which arithmetic operator is used to divide in Python?
+
-
*
/
To modify a shape after creating it, what should you do?
Use the delete statement
Store the shape in a local variable
Store the shape in a global variable
Use the += operator
What is a property that cannot be changed after a shape is initialized?
borderWidth
Align
Size
RotateAngle
Which shape-specific property is associated with the Circle shape?
points
roundness
radius
size
What is the purpose of the onMouseMove(x, y) function?
Called when the mouse is pressed and moved
Runs only if a specific condition is true
Called every time the mouse is moved and not pressed
Defines a helper function
When does the onMouseDrag(x, y) function get called?
When the mouse is pressed and not moved
When the mouse is moved and not pressed
Every time the mouse is moved and not pressed
When the mouse is pressed and moved
What is the purpose of an if statement in Python?
To define a helper function
To run code regardless of conditions
To run code only if a specified condition is true
To call another function
What happens if the condition in an if statement is false, and there is an else statement?
The code in the else body is skipped
The code in the else body is always executed
The code in the if body is skipped
The program terminates
Which comparison operator is used to check if x is less than or equal to y?
(x < y)
(x <= y)
(x == y)
(x >= y)
What is the primary purpose of using helper functions in programming?
To create mouse events
To define conditions in if statements
To help another function perform its work
To manually call other functions
What is the recommended way to check if two values are equal in an if statement?
(x = y)
(x != y)
(x == y)
(x >= y)
Can functions use parameters from another function?
Yes, always
No, functions cannot use parameters from another function
Only if the functions are defined in the same file
Only if the functions have the same number of parameters
What is the purpose of using elif in an if-elif-else statement?
To add another test after the first one
To run code only if the first test is False
To represent the arrow keys
To initialize custom properties
When does the code in an else body run?
Only if the first test is True
Regardless of whether the tests before it were True or False
Only if the test before it is False
Only if there is no elif statement
When is the onKeyPress function called?
When a key is released
When a key is pressed
When the user clicks the mouse
When a shape is clicked
Which parameter is used in the onKeyPress function to test which key was pressed?
keyCode
keyName
key
keyPressed
What does the onKeyRelease function do?
Calls onKeyPress function
Runs code when a key is pressed
Runs code when a key is released
Initializes custom properties
How are custom properties added to shapes?
By using app.stop()
By using the contains method
By using toFront() and toBack() methods
By assigning values directly, like c.count = 0
Which method brings a shape to the front of other shapes?
bringFront()
toFront()
contains()
addPoint()
What does the contains(x, y) method do?
Adds a point to a polygon
Checks if a shape contains another shape
Tests if a shape hits another shape
Tells if a shape contains a specific point (x, y)
When is app.stop() called?
When a key is pressed
When a shape is clicked
When we want no more events to happen
When a key is released
In the RGB color model, what does the second value represent?
Intensity of Blue
Intensity of Red
Intensity of Gray
Intensity of Green
