NEW
Font size
WorksheetsCPA Practice 9-21-2021
Total questions: 18
Worksheet time: 10mins
What is the predefined system variable in p5 JavaScript that tracks the x coordinate of the mouse?
Xmouse
Xmousep
mouseX
pmouseX
Which replacement for /* missing code */ best matches the program output?
x < 400
x > 400
x = 400
What color would fill(255,255,0) make?
Yellow
Red
Green
Blue
What would best fill in the blank of this description from the p5 reference?
mouseX
mouseY
pmouseX
pmouseY
How many variables are defined in this JavaScript program? (Note: let works like var)
1
2
5
11
Which replacement for /* missing code */ best matches the program output?
fill(255,255,255);
fill(0,0,0);
fill(255,0,0);
fill(255,0,255);
Which of the following could assign the value 1 to the variable num?
A
B
C
none of these
Which replacement for /* missing code */ best matches the program output?
x < 0
x > 0
x = 0
Which of the these is a predefined system variable in p5 JavaScript?
A only
B only
C only
Both A and C
A, B and C
Which replacement for /* missing code */ best matches the program output?
fill(255,255,255);
fill(0,0,0);
fill(255,0,0);
fill(255,0,255);
Which if statement correct checks to see if the value of num is 1?
A
B
Both A and B
Neither A nor B
What is the scope of the variable diameter in this program?
Global (The entire program)
Local to the setup() function only
Local to the draw() function only
What is the scope of the variable diameter in this program?
Global (The entire program)
Local to the setup() function only
Local to the draw() function only
Which of the following is false about createCanvas(600,400);?
600 is the width and 400 is the height
It belongs in function setup()
It belongs in function draw()
It sets the dimensions of the drawing area
What do a and b represent in this function call?
The x and y coordinates of the shape's top left corner
The width and height of the shape
The x and y coordinates of the shape's center
The x and y coordinates of the shape's bottom right corner
This program is meant to "wrap" a moving circle around the screen when the x coordinate is too large, but it has an error. Which line has the error?
Line 1
Line 8
Line 10
Line 11
What will be printed by this program?
3
4
error
cannot be determined
How many functions are defined in this JavaScript program?
1
2
5
11
