wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

MEGAQUIZ

Total questions: 100

Worksheet time: 2hrs 40mins

Name
Class
Date
1.

Which of these options best describes a string?

a)

expresses a true/false statement

b)

takes in an input, does something with it, and then returns an output

c)

can contain letters, numbers, spaces, and symbols

d)

makes a choice based on a true/false statement

2.

What symbols tell the computer a word is a string and not a variable?

a)

Quotation marks

b)

Parentheses

c)

Brackets

d)

Braces

3.

Which of these options best describes a variable?

a)

stores a string, number, or boolean, and gives it a specific, case-sensitive name

b)

takes in an input, does something with it, and then returns an output

c)

can contain letters, numbers, spaces, and symbols

d)

makes a choice based on a true/false statement

4.

Which of these options best describes a Boolean?

a)

expresses a true/false statement

b)

takes in an input, does something with it, and then returns an output

c)

can contain letters, numbers, spaces, and symbols

d)

makes a choice based on a true/false statement

5.

Which of these options best describes a function?

a)

stores a string, number, or boolean, and gives it a specific, case-sensitive name

b)

takes in an input, does something with it, and then returns an output

c)

can contain letters, numbers, spaces, and symbols

d)

makes a choice based on a true/false statement

6.

Which of these options best describes an if statement?

a)

expresses a true/false statement

b)

takes in an input, does something with it, and then returns an output

c)

can contain letters, numbers, spaces, and symbols

d)

makes a choice based on a true/false statement

7.

What symbols tell the computer the data stored in a variable is an array?

a)

Quotation marks

b)

Parentheses

c)

Brackets

d)

Braces

8.

What type of data is stored in the variable spaghetti?


var spaghetti = 2;

a)

int

b)

Boolean

c)

char

d)

String

9.

What type of data is stored in the variable spaghetti?


var spaghetti = "delicious";

a)

int

b)

Boolean

c)

char

d)

String

10.

What type of data is stored in the variable spaghetti?


var spaghetti = 'p';

a)

int

b)

Boolean

c)

char

d)

String

11.

What is the correct way to comment out a line of text?

a)

// Tic Tac Yum

b)

*/ Tic Tac Yum /*

c)

/ Tic Tac Yum /

d)

\\ Tic Tac Yum

12.

Which line of code will draw a perfect circle?

a)

ellipse (80, 60, 100, 105);

b)

circle (80, 60, 80, 60):

c)

ellipse(80, 60, 100, 100);

d)

ellipse (80, 60, 105, 100);

13.

Name this symbol:


;

a)

semicolon

b)

colon

c)

brace

d)

winky eyes

14.

Name this symbol:


>=

a)

Increment

b)

Exponent

c)

Less than

d)

Greater than or equal to

15.

What does this operator do?


++

a)

add two numbers together

b)

combine two strings of characters

c)

increment by 1

d)

increment by 10

16.

What is the proper name for these symbols:


()

a)

parentheses

b)

braces

c)

curly brackets

d)

brackets

17.

What is the proper name for these symbols:


{}

a)

parentheses

b)

braces

c)

curly brackets

d)

brackets

18.

What is the proper name for these symbols:


[]

a)

parentheses

b)

braces

c)

curly brackets

d)

brackets

19.

How many parameters can the fill function take?

a)

1

b)

2

c)

3

d)

4

e)

all of the above

20.

Which of the following is NOT a reserved word in Javascript:

a)

plus

b)

var

c)

size

d)

this

21.

What does this symbol do?


=

a)

Compares two values

b)

Creates a function

c)

Sets the meaning (data) of a variable

d)

Changes data to its opposite

22.

True or False: This is the correct way to write a compound conditional


(mouseX > 100 && < 200)

a)

True

b)

False

23.

What does this symbol do?


%

a)

Divides two numbers and returns the quotient

b)

Returns the square root of a number

c)

Makes the second number the exponent of the first

d)

Divides two numbers and returns the remainder

24.

Which function changes the colour of the entire canvas?

a)

fill();

b)

background();

c)

stroke();

d)

size();

25.

What does the second() function do?

a)

Returns how many seconds it has been since the last real-world minute

b)

Marks a variable as number 2 in a list

c)

Counts how many seconds have passed since it was called

d)

Causes the draw function to pause for one second

26.

Which of these does NOT affect the colours on the screen?

a)

stroke();

b)

fill();

c)

text();

d)

tint();

27.

Which parameter of fill(r, g, b, a) affects its transparency?

a)

r

b)

g

c)

b

d)

a

28.

Select all the functions:

a)

for

b)

stroke

c)

draw

d)

beginShape

29.

How many parameters does the translate function accept?

a)

1

b)

2

c)

3

d)

4

30.

Select all the user-defined functions

a)

bezier

b)

color

c)

return

d)

drawPicture

31.

Which of these functions accept parameters?

a)

noFill();

b)

vertex();

c)

point();

d)

resetMatrix();

32.

Which function changes the colour of a line?

a)

fill();

b)

tint();

c)

bezier();

d)

stroke();

33.

True or False: This function definition will cause an error:


var myFunction = function() {


};

a)

True

b)

False

34.

True or False: This function definition will cause an error:


var height = function() {


};

a)

True

b)

False

35.

Which function draws a four-sided shape?

a)

arc();

b)

quad();

c)

ellipse();

d)

sq();

36.

Why SHOULD you create functions?

a)

To avoid typing out the same code many times

b)

To organize your code

c)

To confuse other programmers

d)

To make your code longer

37.

I want to be able to use the variables x and y in my function. Which function definition should I use?

a)

var spaghetti = function(x, y) {

b)

var spaghetti = function() {

c)

var spaghetti = function(var x, var y) {

d)

You can't use variables in a function

38.

True or False: ellipseMode() is a function

a)

True

b)

False

39.

What does the fifth parameter of rect() do?

a)

Changes its transparency

b)

Changes its height

c)

Sets its location on the z axis

d)

Rounds its corners

40.

True or False: rgb() is a function

a)

True

b)

False

41.

What is the symbol in Javascript for AND?

(a)  

42.

What is the symbol in Javascript for OR?

(a)  

43.

What is the symbol in Javascript for NOT?

(a)  

44.

What is the symbol in Javascript for equals? (comparison, not assignment)

(a)  

45.

What is the symbol in Javascript for not equals?

(a)  

46.

Evaluate this expression:


(x === 0 && x === 5)

a)

True

b)

False

47.

Evaluate this expression, where bool can be either true or false (it doesn't make a difference):


(bool || !bool)

a)

True

b)

False

48.

What will be the value of i?


var i = 0;

if (i === 5) {

i++;

}

(a)  

49.

Evaluate this expression:


False === False

a)

True

b)

False

50.

Evaluate this expression:


False || True

a)

True

b)

False

51.

Evaluate this expression, where bool is false:


(!bool && 2+2 === 4)

a)

True

b)

False

52.

What should bool be to make this statement true?


(bool || 1 < 0)

a)

True

b)

False

53.

Evaluate this expression:


(1 + 1 = 0 && 10 > 20)

a)

True

b)

False

54.

Evaluate this expression:


(3 % 2 === 0 || 3 / 2 === 0)

a)

True

b)

False

55.

Evaluate this expression:


4 % 2 === 2

a)

True

b)

False

56.

What will i be at the end of this code if i starts at 0?


while (i < 4) {

i++;

}

(a)  

57.

What will i be at the end of this code if i starts at 5?


while (i > 10) {

i--;

}

(a)  

58.

What will i be at the end of this code if i starts at 0?


while (i < 10 && i % 2 === 1) {

i++;

}

(a)  

59.

Assuming this statement is true, what do we know about x?


x > 10 && x % 2 = 0

a)

x is a number that is bigger than 10

b)

x is even

c)

x is true

d)

x is a multiple of 3

60.

Assuming bool is true, evaluate this expression:


bool === false

a)

True

b)

False

61.

How many circles will this code draw?


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

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

}

(a)  

62.

What will i be at the end of this code?


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

}

(a)  

63.

What's wrong with this code?

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

i = 2;

}

a)

Using i inside the for loop will throw an error

b)

i will never reach 10 and the loop will never end

c)

i will skip over the number 10 as it increases, so the loop will not end

d)

There is nothing wrong with the code

64.

What will x be at the end of this code?

var x = 0;

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

x+= i;

}

(a)  

65.

What does this code do?


numbers.push(5);

a)

Puts the number 5 in the first available position in the array "numbers"

b)

Splits the values in the array "numbers" into five different arrays

c)

Puts the number 5 in the last possible position in the array "numbers"

d)

Removes 5 values from the array "numbers"

66.

What is in position 0 of this array?


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

a)

There is no position 0 in this array

b)

[1, 2, 3]

c)

1

d)

123

67.

How do you access the number 5 in this array?


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

a)

nums[4]

b)

nums[0][5]

c)

nums[1]

d)

nums[1][1]

68.

What does this code do?


nums[3].push(10);

a)

Puts the number 10 in the first available position in the array "nums"

b)

Puts 10 new positions into the array "nums"

c)

Puts the number 10 in the first available position in the array at position 3 in the array "nums"

d)

Puts the number 10 into the array "nums" three times

69.

What number is stored in x?

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

x = nums.length;

(a)  

70.

What number is stored in x?

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

x = nums[0].length;

(a)  

71.

What will x be at the end of the code?

var x = 0;

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

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

x++;

}

}

(a)  

72.

What will x be at the end of the code?

for (var i = 1; i < 4; i++) {

var sample = [];

for (var j = 1; j < 4; j++) {

sample.push(i);

}

x.push(sample);

}

a)

[[1, 2, 3], [1, 2, 3], [1, 2, 3]]

b)

[1, 1, 1, 2, 2, 2, 3, 3, 3];

c)

[1, 2, 3, 1, 2, 3, 1, 2, 3]

d)

[[1, 1, 1], [2, 2, 2], [3, 3, 3]]

73.

What does this code do?


theArray.splice(0, 1);

a)

Removes 1 item from theArray at position 0

b)

Swaps the data at positions 0 and 1 in theArray

c)

Removes 0 items from theArray at position 1

d)

Copies the data from position 0 into position 1 in theArray

74.

What's wrong with this code?

for (var i = 0; i <= theArray.length; i++) {

theArray[i]++;

}

a)

There is no data at theArray[theArray.length]

b)

There is no data at theArray[0]

c)

You can't increment an array

d)

Missing semicolon

75.

What type of data is stored in nums?


var nums = [1, 2, 3, 4, 5];

a)

integer

b)

array of integers

c)

character

d)

string

76.

What type of data is stored in nums[i]?


var nums = [1, 2, 3, 4, 5];

a)

integer

b)

array of integers

c)

character

d)

string

77.

Can you store different types of data in the same array?


e.g. var stuff = [12, "Superman", false];

a)

Yes, this is the best way to use arrays and never causes any problems

b)

Yes, but you have to careful to keep track of the types

c)

No, this is impossible in javascript

d)

Only if you download a library from the internet

78.

What is the proper name for this symbol?


:

a)

Colon

b)

Comma

c)

Semicolon

d)

Two periods in a trench coat

79.

What are the numbers that go inside a function called? e.g. what is the name for the blanks in fill(___, ___, ___).

a)

Parameters

b)

Indices

c)

Operators

d)

Vertices

80.

What is the number that refers to a spot in an array called? E.g. what is i in array[i]. Fun fact: it's the reason we use the variable i in for loops.

a)

Index

b)

Parameter

c)

Place

d)

Item

81.

Why isn't my square showing up?


background(255);

fill(0, 0, 255);

quad(150, 150, 75, 75);

a)

There aren't enough numbers in background

b)

Quad cannot draw squares

c)

There aren't enough numbers in quad

d)

There's no draw function

82.

Why isn't my code running?


if (x > 12)

fill(0);

else

fill(255, 0, 0);

a)

x can't be greater than 12

b)

The first fill doesn't have enough numbers in it

c)

Else is not a keyword in javascript

d)

Missing braces after if and else

83.

var draw = fuction() {

fill(255, 0, 255);

ellipse(x, 200, 50, 50);

x++;

};

a)

Missing a comma

b)

Unnecessary semicolon

c)

A word is misspelled

d)

= should be ===

84.

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

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

}

a)

Missing semicolon

b)

You wrote 1 instead of i

c)

Random doesn't have enough numbers in it

d)

Improper definition of i

85.

Why isn't my code working?


var Thing = {

x : 12,

size : 20,

};

var thing1 = new Thing();

a)

Thing is not an object prototype

b)

Commas should be semicolons

c)

Size is a reserved word

d)

You can't use numbers in variable names

86.

I'm trying to reset my ellipse to the left side of the screen when it goes to far right. Why has it disappeared?


if (x < 400) {

x = -50;

}

a)

Less than sign should be greater than sign

b)

Missing semicolon

c)

Missing else statement

d)

= should be ===

87.

var draw() {

fill(255, 255, 0);

rect(150, 150, 75, 75);

};

a)

Unnecessary semicolon

b)

Improper declaration of draw

c)

A word is misspelled

d)

Extra comma

88.

var draw = function() {

fill(0, 255, 0,);

ellipse(200, 200, 50, 50);

}

a)

Extra comma

b)

A word is misspelled

c)

Improper declaration of draw

d)

Unnecessary semicolon

89.

if (0 === round(random(0, 1)) {

fill(255);

}

a)

Missing parenthesis

b)

=== should be =

c)

0 and round(random(0, 1)) should be swapped

d)

Missing semicolon

90.

var x = 5;

fill(0);

text("x", 200, 200);

a)

The textSize hasn't been set

b)

It's white text on a white background

c)

Unnecessary quotes

d)

There aren't enough numbers in text

91.

Why isn't my code working?


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

a)

Missing draw function

b)

Improper spacing

c)

Missing quotes

d)

Not enough numbers in the image function

92.

Why isn't my code working?


for (var j = 0; j < myArray.length; i++) {

myArray[j] = new Object();

}

a)

i should be j

b)

< should be <=

c)

= should be ===

d)

Missing semicolon

93.

Why isn't my code working?


if (x = "Start") {

fill(0, 255, 0);

}

a)

= should be ===

b)

A string can't be stored in a variable

c)

Unnecessary quotes

d)

Missing semicolon

94.

Why isn't anything showing up on the screen?


rotate(90);

fill(50, 100);

rect(0, 0, 20, 20);

a)

Not enough numbers in fill

b)

The rect has been drawn outside the limits of the canvas

c)

Unnecessary comma

d)

Misspelled word

95.

Why isn't my circle colourful?


fill(random(0, 255));

ellipse(200, 200, 50, 50);

a)

Missing draw function

b)

Missing parenthesis

c)

Not enough numbers in fill

d)

Misspelled word

96.

Why won't my code run?


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

fill(random(255));

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

};

a)

Unnecessary semicolon

b)

Not enough numbers in fill

c)

Missing parenthesis

d)

Misspelled word

97.

Assume a = 2 and b = 4. What will they be at the end of this code?


a = a + b;

b = a - b;

a = a - b

a)

a = 6, b = -2

b)

a = 2, b = 4

c)

a = 4, b = 2

d)

a = 0, b = 4

98.

What function calculates the length of a line between two points?

a)

line()

b)

dist()

c)

scale()

d)

print()

99.

On which floor do I live?

(a)  

100.

What's Geetha's favourite colour?

(a)