Font size
WorksheetsMEGAQUIZ 2
Total questions: 60
Worksheet time: 3600secs
Select the proper way to create an object prototype:
var obj = function() {
var obj = {
var obj {
var obj = new Object();
Which of these colours is light purple?
color(28, 248, 36)
color(215, 175, 250)
color(13, 21, 255)
color(13, 21, 255)
Which of these rectangles will appear at the bottom of the screen?
rect(0, 330, 410, 80)
rect(410, 330, 0, 80);
rect(80, 410, 330, 0)
rect(330, 80, 0, 410);
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
b
It doesn't matter
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
b
It doesn't matter
What should I use to make a change to every object in an array?
For loop
Switch case
If statement
Random function
How do I access position i in an array?
array[i]
array.i
array(i)
array === i
How do I get rid of the colour inside a shape?
noFill();
fill(null);
empty();
color(0);
Which of these is a correct way to increase one variable by another variable?
var1 ++ var2;
var1 += var2;
var1 = var2;
var1 + var2;
True or False: A function that contains animated shapes shouldn't be called in the draw function
True
False
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)
What is a correct way to add something to the end of an array?
array++
array =
array.push()
array.splice()
Which of these is NOT a reserved word?
draw
size
animate
translate
What will x be at the end of this for loop?
for (var i = 0; i < 100; i += 20) {
x ++;
}
(a)
What position is the word "a" in?
var words = ["Once", "upon", "a", "time"];
(a)
Which of these rectangles is the biggest?
rect(10, 20, 100, 200);
rect(200, 100, 40, 100);
rect(300, 400, 40, 30);
rect(20, 20, 200, 200);
True or False: Shapes can appear on the screen without the draw function.
True
False
What is the difference between the way the computer reads "word" and word?
One is a string, the other is a variable
One is an array, the other is just a string
One is a character, the other is a string
There is no difference
True or False: Functions are a special type of variable
True
False
Where on the screen will the circle appear?
ellipse(384, 29, 50, 50);
Bottom Left
Top Left
Bottom Right
Top Right
What is the name of the function that fills the canvas with a colour?
(a)
Select all the functions that resetMatrix() affects/removes:
rotate
scale
translate
tint
What is the proper name for this symbol?
*
Asterisk
Star
Multiplier
Dot
What is the percent chance that nums will be less than 30?
var nums = random(0, 100);
30
60
50
100
True or False: This shape is see-through
fill(0, 255, 0, 255);
True
False
How do you make a shape multi-coloured?
Use the color function
Add more numbers to the fill function
Build the shape out of smaller shapes and colour those individually
You can't
In what order should I put these functions?
fill(255, 0, 100); background(255); ellipse(200, 200, 50, 50);
1, 3, 2
3, 2, 1
2, 1, 3
2, 3, 1
How many parameters does the quad function need?
(a)
Which symbols do you use to call a function?
parentheses
brackets
braces
asterisk
True or False: Some numbers are too big or too small for the computer to understand
True
False
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) {
}}
rect(i, j, 20, 20);
rect(i * 40, j * 40, 10, 10);
rect(j, i, 20, 20);
rect(j, i, 40, 40);
Select everything you need to make a recursive function:
recursive call (call itself inside the function)
start condition (when does it start calling)
passed parameters
end condition (when does it stop calling)
True or False: The number of lines of code a project has is directly connected to how good the code is
True
False
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)
What's wrong with this function?
var r = function(num) {
ellipse(200, 200, num, num);
r(num - 10);
};
It will never end
The ellipse won't appear because there is no fill
Function names have to be more than one letter long
Nothing - it will run fine
What is an appropriate case for this switch?
switch(mouseX > 200) {
case true:
case mouseX:
case 150:
case < 100:
Which of these is NOT a real function?
pow();
lerpColor();
mouseOver();
breakLoop();
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)
Select all that use colons:
Switch Cases
Object Prototypes
Object Literals
While loops
Which of these lines of code will calculate what week of the month it is?
week = day() % 7;
week = 52 % day() * 7;
week = 365 - day() * 7;
week = round(day() / 7);
Which of these is a primitive data type?
Boolean
String
Array
Object
Select the functions I could use to change the range of fill to spread evenly across the (400 x 400) canvas:
colorMode
map
constrain
range
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);
}
y < 100
100 < y < 250
y > 250
y > 400
True or False: you can use use passed parameters in an object prototype.
True
False
Which of these are defined recursively?
n = m * 2
n = (n - 1) + (n - 2)
n = (n - 1)!
n = 5;
Where on the screen will the image "pic" show up?
imageMode(CENTER);
scale(0.5);
image(pic, 400, 200);
It will be off the canvas
In the middle towards the top
Far right
On the left halfway down the screen
What colour will the ellipse be?
colorMode(HSB, 360, 100, 100);
fill(147, 100, 0);
ellipse(200, 200, 50, 50);
Bright green
Grey
Black
White
How many dimensions does this array have?
var nums = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
(a)
Evaluate this expression:
((True && False) || True)
True
False
What text will be printed to the screen?
var name = "Brenda";
name = prompt("Enter your own name here:", "");
fill(0);
text(name, 200, 200);
Brenda
Nothing - name is an empty string
Whatever the user types
The word "name"
How many circles will this code draw?
for (var i = 0; i < 100; i += 2) {
ellipse(random(400), random(400), 50, 50);
}
(a)
What's wrong with this code?
image(getImage(creatures/winston), 200, 200, 50, 50);
Not enough parameters
Too many parameters
Missing quotes
Missing comma
Which of these numbers is biggest?
3 + 2
3 * 2
3 % 2
32
Which of these is NOT a correct way to decrease x by 2?
x = x - 2;
x -= 2;
x = x - 1 - 1;
x--;
What about the circle will change if I change x?
var x = 35;
fill(0);
ellipse(200, 100, x, 60);
The width
The colour
The x position
Nothing
Which line of code is the problem?
draw = function() {
fill(48);
text("_\n_", 0, 0);
};
1
2
3
4
True or False: = is the same as ===
True
False
Which function changes the colour of a line function?
fill();
line();
stroke();
outline();
What will x be at the end of this code?
var x = 5;
x = x * 2;
(a)
True or False: size is a reserved word in JavaScript
True
False
