Font size
WorksheetsCMU AP CSP - Student Created Questions WHS
Total questions: 71
Worksheet time: 36mins
When you move your mouse, Python calls:
onMouseTrack
onMoveMouse
VariableName.fill will change which property of the variable
visible
variable name
What is the name of a common debugging technique?
Pair Programming
Eraser top tracing
Bug Locus Point
Which of the following is NOT a line property?
Local and regional variables
Scope and local variables
0
Functions do not have paramters.
2
No more than 5
Which is the correct way to change the fill to blue?
moon = Circle(200, 170, 100, fill='gold')
moon.fill='Blue'
moonFill='blue'
moonFill:'Blue'
Events are another name for conditional statements.
colon
period
semi-Colon
asterisk
Which of the following properties is only used by the Star shape?
How many degrees will the following line rotate when the user clicks on the screen?
The program has a syntax error
Which is the correct Python function definition?
def mousePress( mouseX, mouseY)
Def OnmousePress( mouseX, mouseY)
def OnMousePress( mouseX, mouseY)
def onmousePress (MouseX, MouseY)
An if statement is a conditional statement
which executes when the conditional evaluates to True
It answers a question
It runs whether a condition is true or false
Which symbol does not complete a comparison in an if statement
equivalent
What is the AP Exam equivalent to the
Python comparison symbol
!=
==
<>
≠
!=
x is greater than or equal to y
x equal to y
Set x equal to y
x not equal to y
What symbol do you need at the end of an if statement in Python
)
;
If statements are not case sensitive.
They will run correctly when the whether or not the word if is capitalized.
How must you write an if statement
IF (-----):
if (-----):
if (------)>
If (-----):
A operator statement
A case statement
When the statement evaluates to undecided
When the statement evaluates to True
When the statement evaluates to False
When the statement evaluates to a variable
Which one is correct?
if (totalCounter.value == 5):
app.background = 'lightGreen'
if (totalCounter.value == 5)
app.background = 'lightGreen'
if (totalCounter.value == 5):
app.background = lightGreen
If (totalCounter.value = 5):
app.background = 'lightGreen'
def
Def
What symbol do we use to compare if two values are equal?
What is the output of the Python code?
14
12
7
15
Which statement updates X to add one to the value stored in X?
X += 1
X == 1
X + 1
X =+ 1
The property addPoint can only be used with what shape?
Line
Rect
Polygon
Star
What is the error:
"Rect" should be written "rect"
Mousex, Mousey should be written mouseX, mouseY
The comparison in the if statement should be <<
Not enough arguments for the shape Rect
What is wrong with this code?
The variables should be (mouseX, mouseY) instead of (x, y)
The function is onMouseRelease NOT onMousePress
Circles require more arguments than shown
To do a comparison in the if statement, it should read (x == 5) instead of (x = 5)
What is the error in the function?
there should be a conditional statement
the variable radius is not defined as a parameter
Which conditional statement would correctly compare mouseX?
if mouseX = 30:
if (mouseX = 30):
In python, what is wrong with this conditional statement:
If (x<y):
the I in if is capitalized
the comparison is x<<y not x<y
What is the outcome of the following code?
Arg Count Error: Circle() takes 3 arguments
SyntaxError at line 1: invalid syntax. Perhaps you forgot a comma?
The code works. It creates two circles when the mouse is pressed.
The code works. Only the blue circle is visible when the mouse is pressed.
Which function is written correctly in Python language?
def onMouseClick (mousex, mousey):
def onMousePress (mouseX, mouseY)
Def onMousePress (mouseX, mouseY):
def onMousePress (mouseX, mouseY):
How do you make this rectangle named red visible?
red.rectVisible = True
Find the Error in the Code
The I in if and the E in else should not be capitalized.
onMouseWasPressed
is the correct command, not onMousePress
Incorrect indentation.
The Else: statement should line up under the Circle line
Incorrect number of arguments on the Circle function.
What is the outcome of this conditional statement?
There is an error.
The if statement requires parentheses around the comparison.
If the mouse is clicked on the left half of screen, the eyes and mouth will be chocolate. On the right side, they will be yellow.
There is an error.
If and Else should be capitalized.
There is an error.
The indentation is incorrect. The else should align with the mouth.fill above it.
Which conditional statement is written correctly?
Assume all variables have been correctly defined.
if (mouseX < 100):
If (spikes = 10):
Which of the following is correct?
If (dot.hits(myshape) == False:
Which of the following is not a method?
The toFront() and toBack() shape methods are built in to CMU Python?
Will the following code run correctly?
Would this conditional statement work?
Yes, Everything is written correctly.
No. The statement would end with an error because the
: at the end of the if line is missing.
No. You cannot access the value of the counter using a property statement.
No. The statement would end in an error because the if statement is missing parentheses.
Find the error
Incorrect number of arguments in shape calls
The comparison statement is incorrect
else statement is missing a comparison
What is the outcome of this code?
Syntax error
Runtime Error
Logical Error
The code will run with a counter that increases by one each time the mouse is clicked.
Select all the errors in the code.
A. Missing colon(s)
B. Mismatched quotes
C. Indentation error
D. Missing parentheses
A, D
B, C
C
D
When will the body of an if statement NOT run?
When the statement evaluates to both true or false
When the statement evaluates to true
When the statement evaluates to false
When it is called by a function
Is Python code case sensitive?
what will the value of result be at the completion of this code?
What must precede an elif statement?
a colon
the word def
what is the correct way to bring an object to the front?
tofront(front)
.toFront(front)
