Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

p5.js - shape, color, syntax

Total questions: 19

Worksheet time: 17mins

Name
Class
Date
1.

What is a function?

a)

A toaster

b)

Lines of code that perform specific tasks

c)

Input

d)

Kale Chip

2.

What are some shapes we can create with p5.js?

a)

Rectangle

b)

Circle

c)

Dog

d)

Triangle

3.

What is a correct code to create a rectangle in p5.js?

a)

rectangle(40,120);

b)

rect(40,120,120,40);

c)

rectangle(40,120,120,40);

d)

rect();

4.

How do I create a rectangle located 50px to the right and 80px down on the canvas?

a)

rect(40,100,80,50);

b)

rect(100,40,50,80);

c)

rect(80,50,100,40);

d)

rect(50,80,100,40);

5.

What function do we use to add color to a shape in p5.js?

a)

fill();

b)

color();

c)

colorize();

d)

paint();

6.

Which are correct ways to add color to a shape in p5.js?

a)

fill(‘yellow’);

b)

fill(amarillo);

c)

fill(255,255,0);

d)

fill(‘#ebe12d’);

7.

Which code makes an ellipse measuring 140px width and 100px height?

a)

ellipse(175, 130, 100, 140);

b)

circle(175, 130, 140, 100);

c)

ellip(175, 130, 140, 100);

d)

ellipse(175, 130, 140, 100);

8.

Which code sets the canvas' color to "pink" in p5.js?

a)

background-color('pink');

b)

background('pink');

c)

bg('pink');

d)

bg-color('pink');

9.
What, if anything, is the difference between function setup () and function draw()?
a)
Function setup is a loop and function draw only runs once.
b)
There are no differences.
c)
Function setup and function draw are both loops but they allow the programmer to do different things.
d)
Function setup runs once and function draw is a loop.
10.
How many parameters are there in the code for drawing a line in p5.js?
Hint: line(x1,y1,x2,y2)
a)
5
b)
1
c)
4
d)
2
11.
Which of the following is the correct syntax for drawing a rectangle? 
a)
Rect(x,y,width,height);
b)
rect(x,y,width,height);
c)
rect(width, height, x, y)
d)
rect(x1, x2, y1, y2, width, height);
12.

What is the height of the following ellipse?
ellipse(70, 120, 150, 180);

a)
70
b)
120
c)
150
d)
180
13.
What are the parameters in the 'createCanvas' function?
a)
x and y
b)
color
c)
width and height
d)
There are no parameters in this function.
14.
When using 'RGB' to fill the color of a shape, the 4th parameter controls the __________ of the color.
a)
stroke
b)
weight 
c)
transparency
d)
size
15.

Which of the following would create a blue fill?

a)

fill(255, 255, 255);

b)

fill(255, 0, 0);

c)

fill(0, 255, 0);

d)

fill(0, 0, 255);

16.

What x and y coordinates would you use to center a circle on a canvas that is 400 by 400 pixels?

a)

(100, 100)

b)

(200, 200)

c)

(300, 300)

d)

(400, 400)

17.

What number would you change to move the y position of this rectangle?

a)

20 (the first argument)

b)

30 (the second argument)

c)

100 (the third argument)

d)

150 (the fourth argument)

18.

How do you remove the outline on a shape?

a)

nofill()

b)

NoFill()

c)

dontFill()

d)

noFill()

19.

How do we fill a shape with green?

a)

fill("green")

b)

fill(255, 0, 0)

c)

fill(0, 255, 0)

d)

fill(verde)