wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

CPA Practice 9-21-2021

Total questions: 18

Worksheet time: 10mins

Name
Class
Date
1.

What is the predefined system variable in p5 JavaScript that tracks the x coordinate of the mouse?

a)

Xmouse

b)

Xmousep

c)

mouseX

d)

pmouseX

2.

Which replacement for /* missing code */ best matches the program output?

a)

x < 400

b)

x > 400

c)

x = 400

3.

What color would fill(255,255,0) make?

a)

Yellow

b)

Red

c)

Green

d)

Blue

4.

What would best fill in the blank of this description from the p5 reference?

a)

mouseX

b)

mouseY

c)

pmouseX

d)

pmouseY

5.

How many variables are defined in this JavaScript program? (Note: let works like var)

a)

1

b)

2

c)

5

d)

11

6.

Which replacement for /* missing code */ best matches the program output?

a)

fill(255,255,255);

b)

fill(0,0,0);

c)

fill(255,0,0);

d)

fill(255,0,255);

7.

Which of the following could assign the value 1 to the variable num?

a)

A

b)

B

c)

C

d)

none of these

8.

Which replacement for /* missing code */ best matches the program output?

a)

x < 0

b)

x > 0

c)

x = 0

9.

Which of the these is a predefined system variable in p5 JavaScript?

a)

A only

b)

B only

c)

C only

d)

Both A and C

e)

A, B and C

10.

Which replacement for /* missing code */ best matches the program output?

a)

fill(255,255,255);

b)

fill(0,0,0);

c)

fill(255,0,0);

d)

fill(255,0,255);

11.

Which if statement correct checks to see if the value of num is 1?

a)

A

b)

B

c)

Both A and B

d)

Neither A nor B

12.

What is the scope of the variable diameter in this program?

a)

Global (The entire program)

b)

Local to the setup() function only

c)

Local to the draw() function only

13.

What is the scope of the variable diameter in this program?

a)

Global (The entire program)

b)

Local to the setup() function only

c)

Local to the draw() function only

14.

Which of the following is false about createCanvas(600,400);?

a)

600 is the width and 400 is the height

b)

It belongs in function setup()

c)

It belongs in function draw()

d)

It sets the dimensions of the drawing area

15.

What do a and b represent in this function call?

a)

The x and y coordinates of the shape's top left corner

b)

The width and height of the shape

c)

The x and y coordinates of the shape's center

d)

The x and y coordinates of the shape's bottom right corner

16.

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?

a)

Line 1

b)

Line 8

c)

Line 10

d)

Line 11

17.

What will be printed by this program?

a)

3

b)

4

c)

error

d)

cannot be determined

18.

How many functions are defined in this JavaScript program?

a)

1

b)

2

c)

5

d)

11