wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

MEGAQUIZ 2

Total questions: 60

Worksheet time: 3600secs

Name
Class
Date
1.

Select the proper way to create an object prototype:

a)

var obj = function() {

b)

var obj = {

c)

var obj {

d)

var obj = new Object();

2.

Which of these colours is light purple?

a)

color(28, 248, 36)

b)

color(215, 175, 250)

c)

color(13, 21, 255)

d)

color(13, 21, 255)

3.

Which of these rectangles will appear at the bottom of the screen?

a)

rect(0, 330, 410, 80)

b)

rect(410, 330, 0, 80);

c)

rect(80, 410, 330, 0)

d)

rect(330, 80, 0, 410);

4.

Which of these ellipses should be placed first so we can see both of them?


a. ellipse(250, 250 ,140, 120);

b. ellipse(250, 250, 150, 150);

a)

a

b)

b

c)

It doesn't matter

5.

Which of these rects should be placed first so we can see both of them?


a. rect(125, 150, 150, 200, 30);

b. rect(135, 160, 130, 20, 150);

a)

a

b)

b

c)

It doesn't matter

6.

What should I use to make a change to every object in an array?

a)

For loop

b)

Switch case

c)

If statement

d)

Random function

7.

How do I access position i in an array?

a)

array[i]

b)

array.i

c)

array(i)

d)

array === i

8.

How do I get rid of the colour inside a shape?

a)

noFill();

b)

fill(null);

c)

empty();

d)

color(0);

9.

Which of these is a correct way to increase one variable by another variable?

a)

var1 ++ var2;

b)

var1 += var2;

c)

var1 = var2;

d)

var1 + var2;

10.

True or False: A function that contains animated shapes shouldn't be called in the draw function

a)

True

b)

False

11.

One ellipse is placed on the screen at the x position 135.


I want to place another ellipse symmetrical to it on the other half of the screen.


What should the x coordinate of this new ellipse be?

(a)  

12.

What is a correct way to add something to the end of an array?

a)

array++

b)

array =

c)

array.push()

d)

array.splice()

13.

Which of these is NOT a reserved word?

a)

draw

b)

size

c)

animate

d)

translate

14.

What will x be at the end of this for loop?


for (var i = 0; i < 100; i += 20) {

x ++;

}

(a)  

15.

What position is the word "a" in?


var words = ["Once", "upon", "a", "time"];

(a)  

16.

Which of these rectangles is the biggest?

a)

rect(10, 20, 100, 200);

b)

rect(200, 100, 40, 100);

c)

rect(300, 400, 40, 30);

d)

rect(20, 20, 200, 200);

17.

True or False: Shapes can appear on the screen without the draw function.

a)

True

b)

False

18.

What is the difference between the way the computer reads "word" and word?

a)

One is a string, the other is a variable

b)

One is an array, the other is just a string

c)

One is a character, the other is a string

d)

There is no difference

19.

True or False: Functions are a special type of variable

a)

True

b)

False

20.

Where on the screen will the circle appear?


ellipse(384, 29, 50, 50);

a)

Bottom Left

b)

Top Left

c)

Bottom Right

d)

Top Right

21.

What is the name of the function that fills the canvas with a colour?

(a)  

22.

Select all the functions that resetMatrix() affects/removes:

a)

rotate

b)

scale

c)

translate

d)

tint

23.

What is the proper name for this symbol?


*

a)

Asterisk

b)

Star

c)

Multiplier

d)

Dot

24.

What is the percent chance that nums will be less than 30?


var nums = random(0, 100);

a)

30

b)

60

c)

50

d)

100

25.

True or False: This shape is see-through


fill(0, 255, 0, 255);

a)

True

b)

False

26.

How do you make a shape multi-coloured?

a)

Use the color function

b)

Add more numbers to the fill function

c)

Build the shape out of smaller shapes and colour those individually

d)

You can't

27.

In what order should I put these functions?


fill(255, 0, 100); background(255); ellipse(200, 200, 50, 50);

a)

1, 3, 2

b)

3, 2, 1

c)

2, 1, 3

d)

2, 3, 1

28.

How many parameters does the quad function need?

(a)  

29.

Which symbols do you use to call a function?

a)

parentheses

b)

brackets

c)

braces

d)

asterisk

30.

True or False: Some numbers are too big or too small for the computer to understand

a)

True

b)

False

31.

I am trying to draw a grid of squares. What should go in the empty line?


for (var i = 0; i < 400; i += 40) {

for (var j = 0; j < 400; j += 40) {


}}

a)

rect(i, j, 20, 20);

b)

rect(i * 40, j * 40, 10, 10);

c)

rect(j, i, 20, 20);

d)

rect(j, i, 40, 40);

32.

Select everything you need to make a recursive function:

a)

recursive call (call itself inside the function)

b)

start condition (when does it start calling)

c)

passed parameters

d)

end condition (when does it stop calling)

33.

True or False: The number of lines of code a project has is directly connected to how good the code is

a)

True

b)

False

34.

What is the length of the array nums?


var nums = [];

for (var i = 0; i < 10; i++) {

nums[i] = [];

for (var j = 0; j < 10; j++) {

nums[i].push(random(100));

}}

(a)  

35.

What's wrong with this function?


var r = function(num) {

ellipse(200, 200, num, num);

r(num - 10);

};

a)

It will never end

b)

The ellipse won't appear because there is no fill

c)

Function names have to be more than one letter long

d)

Nothing - it will run fine

36.

What is an appropriate case for this switch?


switch(mouseX > 200) {

a)

case true:

b)

case mouseX:

c)

case 150:

d)

case < 100:

37.

Which of these is NOT a real function?

a)

pow();

b)

lerpColor();

c)

mouseOver();

d)

breakLoop();

38.

What text will appear on the screen?


var words = ["Gonna", "take", "my", "horse", "to", "the", "Old", "Town", "Road"];


text(words[28 % words.length], 200, 200);

(a)  

39.

Select all that use colons:

a)

Switch Cases

b)

Object Prototypes

c)

Object Literals

d)

While loops

40.

Which of these lines of code will calculate what week of the month it is?

a)

week = day() % 7;

b)

week = 52 % day() * 7;

c)

week = 365 - day() * 7;

d)

week = round(day() / 7);

41.

Which of these is a primitive data type?

a)

Boolean

b)

String

c)

Array

d)

Object

42.

Select the functions I could use to change the range of fill to spread evenly across the (400 x 400) canvas:

a)

colorMode

b)

map

c)

constrain

d)

range

43.

Where on the canvas will a shape be coloured black?


if (y < 100) {

fill(255, 0, 0);

} else if (y > 250) {

fill(0, 255, 0):

} else {

fill(0);

}

a)

y < 100

b)

100 < y < 250

c)

y > 250

d)

y > 400

44.

True or False: you can use use passed parameters in an object prototype.

a)

True

b)

False

45.

Which of these are defined recursively?

a)

n = m * 2

b)

n = (n - 1) + (n - 2)

c)

n = (n - 1)!

d)

n = 5;

46.

Where on the screen will the image "pic" show up?


imageMode(CENTER);

scale(0.5);

image(pic, 400, 200);

a)

It will be off the canvas

b)

In the middle towards the top

c)

Far right

d)

On the left halfway down the screen

47.

What colour will the ellipse be?


colorMode(HSB, 360, 100, 100);

fill(147, 100, 0);

ellipse(200, 200, 50, 50);

a)

Bright green

b)

Grey

c)

Black

d)

White

48.

How many dimensions does this array have?


var nums = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];

(a)  

49.

Evaluate this expression:


((True && False) || True)

a)

True

b)

False

50.

What text will be printed to the screen?


var name = "Brenda";

name = prompt("Enter your own name here:", "");

fill(0);

text(name, 200, 200);

a)

Brenda

b)

Nothing - name is an empty string

c)

Whatever the user types

d)

The word "name"

51.

How many circles will this code draw?


for (var i = 0; i < 100; i += 2) {

ellipse(random(400), random(400), 50, 50);

}

(a)  

52.

What's wrong with this code?


image(getImage(creatures/winston), 200, 200, 50, 50);

a)

Not enough parameters

b)

Too many parameters

c)

Missing quotes

d)

Missing comma

53.

Which of these numbers is biggest?

a)

3 + 2

b)

3 * 2

c)

3 % 2

d)

32

54.

Which of these is NOT a correct way to decrease x by 2?

a)

x = x - 2;

b)

x -= 2;

c)

x = x - 1 - 1;

d)

x--;

55.

What about the circle will change if I change x?


var x = 35;

fill(0);

ellipse(200, 100, x, 60);

a)

The width

b)

The colour

c)

The x position

d)

Nothing

56.

Which line of code is the problem?


draw = function() {

fill(48);

text("_\n_", 0, 0);

};

a)

1

b)

2

c)

3

d)

4

57.

True or False: = is the same as ===

a)

True

b)

False

58.

Which function changes the colour of a line function?

a)

fill();

b)

line();

c)

stroke();

d)

outline();

59.

What will x be at the end of this code?


var x = 5;

x = x * 2;

(a)  

60.

True or False: size is a reserved word in JavaScript

a)

True

b)

False