Font size
WorksheetsMEGAQUIZ
Total questions: 100
Worksheet time: 2hrs 40mins
Which of these options best describes a string?
expresses a true/false statement
takes in an input, does something with it, and then returns an output
can contain letters, numbers, spaces, and symbols
makes a choice based on a true/false statement
What symbols tell the computer a word is a string and not a variable?
Quotation marks
Parentheses
Brackets
Braces
Which of these options best describes a variable?
stores a string, number, or boolean, and gives it a specific, case-sensitive name
takes in an input, does something with it, and then returns an output
can contain letters, numbers, spaces, and symbols
makes a choice based on a true/false statement
Which of these options best describes a Boolean?
expresses a true/false statement
takes in an input, does something with it, and then returns an output
can contain letters, numbers, spaces, and symbols
makes a choice based on a true/false statement
Which of these options best describes a function?
stores a string, number, or boolean, and gives it a specific, case-sensitive name
takes in an input, does something with it, and then returns an output
can contain letters, numbers, spaces, and symbols
makes a choice based on a true/false statement
Which of these options best describes an if statement?
expresses a true/false statement
takes in an input, does something with it, and then returns an output
can contain letters, numbers, spaces, and symbols
makes a choice based on a true/false statement
What symbols tell the computer the data stored in a variable is an array?
Quotation marks
Parentheses
Brackets
Braces
What type of data is stored in the variable spaghetti?
var spaghetti = 2;
int
Boolean
char
String
What type of data is stored in the variable spaghetti?
var spaghetti = "delicious";
int
Boolean
char
String
What type of data is stored in the variable spaghetti?
var spaghetti = 'p';
int
Boolean
char
String
What is the correct way to comment out a line of text?
// Tic Tac Yum
*/ Tic Tac Yum /*
/ Tic Tac Yum /
\\ Tic Tac Yum
Which line of code will draw a perfect circle?
ellipse (80, 60, 100, 105);
circle (80, 60, 80, 60):
ellipse(80, 60, 100, 100);
ellipse (80, 60, 105, 100);
Name this symbol:
;
semicolon
colon
brace
winky eyes
Name this symbol:
>=
Increment
Exponent
Less than
Greater than or equal to
What does this operator do?
++
add two numbers together
combine two strings of characters
increment by 1
increment by 10
What is the proper name for these symbols:
()
parentheses
braces
curly brackets
brackets
What is the proper name for these symbols:
{}
parentheses
braces
curly brackets
brackets
What is the proper name for these symbols:
[]
parentheses
braces
curly brackets
brackets
How many parameters can the fill function take?
1
2
3
4
all of the above
Which of the following is NOT a reserved word in Javascript:
plus
var
size
this
What does this symbol do?
=
Compares two values
Creates a function
Sets the meaning (data) of a variable
Changes data to its opposite
True or False: This is the correct way to write a compound conditional
(mouseX > 100 && < 200)
True
False
What does this symbol do?
%
Divides two numbers and returns the quotient
Returns the square root of a number
Makes the second number the exponent of the first
Divides two numbers and returns the remainder
Which function changes the colour of the entire canvas?
fill();
background();
stroke();
size();
What does the second() function do?
Returns how many seconds it has been since the last real-world minute
Marks a variable as number 2 in a list
Counts how many seconds have passed since it was called
Causes the draw function to pause for one second
Which of these does NOT affect the colours on the screen?
stroke();
fill();
text();
tint();
Which parameter of fill(r, g, b, a) affects its transparency?
r
g
b
a
Select all the functions:
for
stroke
draw
beginShape
How many parameters does the translate function accept?
1
2
3
4
Select all the user-defined functions
bezier
color
return
drawPicture
Which of these functions accept parameters?
noFill();
vertex();
point();
resetMatrix();
Which function changes the colour of a line?
fill();
tint();
bezier();
stroke();
True or False: This function definition will cause an error:
var myFunction = function() {
};
True
False
True or False: This function definition will cause an error:
var height = function() {
};
True
False
Which function draws a four-sided shape?
arc();
quad();
ellipse();
sq();
Why SHOULD you create functions?
To avoid typing out the same code many times
To organize your code
To confuse other programmers
To make your code longer
I want to be able to use the variables x and y in my function. Which function definition should I use?
var spaghetti = function(x, y) {
var spaghetti = function() {
var spaghetti = function(var x, var y) {
You can't use variables in a function
True or False: ellipseMode() is a function
True
False
What does the fifth parameter of rect() do?
Changes its transparency
Changes its height
Sets its location on the z axis
Rounds its corners
True or False: rgb() is a function
True
False
What is the symbol in Javascript for AND?
(a)
What is the symbol in Javascript for OR?
(a)
What is the symbol in Javascript for NOT?
(a)
What is the symbol in Javascript for equals? (comparison, not assignment)
(a)
What is the symbol in Javascript for not equals?
(a)
Evaluate this expression:
(x === 0 && x === 5)
True
False
Evaluate this expression, where bool can be either true or false (it doesn't make a difference):
(bool || !bool)
True
False
What will be the value of i?
var i = 0;
if (i === 5) {
i++;
}
(a)
Evaluate this expression:
False === False
True
False
Evaluate this expression:
False || True
True
False
Evaluate this expression, where bool is false:
(!bool && 2+2 === 4)
True
False
What should bool be to make this statement true?
(bool || 1 < 0)
True
False
Evaluate this expression:
(1 + 1 = 0 && 10 > 20)
True
False
Evaluate this expression:
(3 % 2 === 0 || 3 / 2 === 0)
True
False
Evaluate this expression:
4 % 2 === 2
True
False
What will i be at the end of this code if i starts at 0?
while (i < 4) {
i++;
}
(a)
What will i be at the end of this code if i starts at 5?
while (i > 10) {
i--;
}
(a)
What will i be at the end of this code if i starts at 0?
while (i < 10 && i % 2 === 1) {
i++;
}
(a)
Assuming this statement is true, what do we know about x?
x > 10 && x % 2 = 0
x is a number that is bigger than 10
x is even
x is true
x is a multiple of 3
Assuming bool is true, evaluate this expression:
bool === false
True
False
How many circles will this code draw?
for (var i = 0; i < 100; i += 10) {
ellipse(random(400), random(400), 50, 50);
}
(a)
What will i be at the end of this code?
for (var i = 0; i < 10; i+= 3) {
}
(a)
What's wrong with this code?
for (var i = 0; i < 10; i++) {
i = 2;
}
Using i inside the for loop will throw an error
i will never reach 10 and the loop will never end
i will skip over the number 10 as it increases, so the loop will not end
There is nothing wrong with the code
What will x be at the end of this code?
var x = 0;
for (var i = 0; i < 5; i += 2) {
x+= i;
}
(a)
What does this code do?
numbers.push(5);
Puts the number 5 in the first available position in the array "numbers"
Splits the values in the array "numbers" into five different arrays
Puts the number 5 in the last possible position in the array "numbers"
Removes 5 values from the array "numbers"
What is in position 0 of this array?
var nums = [[1, 2, 3], [4, 5, 6], [7, 8 9]];
There is no position 0 in this array
[1, 2, 3]
1
123
How do you access the number 5 in this array?
var nums = [[1, 2, 3], [4, 5, 6], [7, 8 9]];
nums[4]
nums[0][5]
nums[1]
nums[1][1]
What does this code do?
nums[3].push(10);
Puts the number 10 in the first available position in the array "nums"
Puts 10 new positions into the array "nums"
Puts the number 10 in the first available position in the array at position 3 in the array "nums"
Puts the number 10 into the array "nums" three times
What number is stored in x?
var nums = [[1,2,3], [4,5,6]];
x = nums.length;
(a)
What number is stored in x?
var nums = [[1,2,3], [4,5,6]];
x = nums[0].length;
(a)
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)
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);
}
[[1, 2, 3], [1, 2, 3], [1, 2, 3]]
[1, 1, 1, 2, 2, 2, 3, 3, 3];
[1, 2, 3, 1, 2, 3, 1, 2, 3]
[[1, 1, 1], [2, 2, 2], [3, 3, 3]]
What does this code do?
theArray.splice(0, 1);
Removes 1 item from theArray at position 0
Swaps the data at positions 0 and 1 in theArray
Removes 0 items from theArray at position 1
Copies the data from position 0 into position 1 in theArray
What's wrong with this code?
for (var i = 0; i <= theArray.length; i++) {
theArray[i]++;
}
There is no data at theArray[theArray.length]
There is no data at theArray[0]
You can't increment an array
Missing semicolon
What type of data is stored in nums?
var nums = [1, 2, 3, 4, 5];
integer
array of integers
character
string
What type of data is stored in nums[i]?
var nums = [1, 2, 3, 4, 5];
integer
array of integers
character
string
Can you store different types of data in the same array?
e.g. var stuff = [12, "Superman", false];
Yes, this is the best way to use arrays and never causes any problems
Yes, but you have to careful to keep track of the types
No, this is impossible in javascript
Only if you download a library from the internet
What is the proper name for this symbol?
:
Colon
Comma
Semicolon
Two periods in a trench coat
What are the numbers that go inside a function called? e.g. what is the name for the blanks in fill(___, ___, ___).
Parameters
Indices
Operators
Vertices
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.
Index
Parameter
Place
Item
Why isn't my square showing up?
background(255);
fill(0, 0, 255);
quad(150, 150, 75, 75);
There aren't enough numbers in background
Quad cannot draw squares
There aren't enough numbers in quad
There's no draw function
Why isn't my code running?
if (x > 12)
fill(0);
else
fill(255, 0, 0);
x can't be greater than 12
The first fill doesn't have enough numbers in it
Else is not a keyword in javascript
Missing braces after if and else
var draw = fuction() {
fill(255, 0, 255);
ellipse(x, 200, 50, 50);
x++;
};
Missing a comma
Unnecessary semicolon
A word is misspelled
= should be ===
for (var i = 0; 1 < 20; i++) {
ellipse(random(400), random(400), 50, 50);
}
Missing semicolon
You wrote 1 instead of i
Random doesn't have enough numbers in it
Improper definition of i
Why isn't my code working?
var Thing = {
x : 12,
size : 20,
};
var thing1 = new Thing();
Thing is not an object prototype
Commas should be semicolons
Size is a reserved word
You can't use numbers in variable names
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;
}
Less than sign should be greater than sign
Missing semicolon
Missing else statement
= should be ===
var draw() {
fill(255, 255, 0);
rect(150, 150, 75, 75);
};
Unnecessary semicolon
Improper declaration of draw
A word is misspelled
Extra comma
var draw = function() {
fill(0, 255, 0,);
ellipse(200, 200, 50, 50);
}
Extra comma
A word is misspelled
Improper declaration of draw
Unnecessary semicolon
if (0 === round(random(0, 1)) {
fill(255);
}
Missing parenthesis
=== should be =
0 and round(random(0, 1)) should be swapped
Missing semicolon
var x = 5;
fill(0);
text("x", 200, 200);
The textSize hasn't been set
It's white text on a white background
Unnecessary quotes
There aren't enough numbers in text
Why isn't my code working?
image(getImage(creatures/winston), 200 ,200);
Missing draw function
Improper spacing
Missing quotes
Not enough numbers in the image function
Why isn't my code working?
for (var j = 0; j < myArray.length; i++) {
myArray[j] = new Object();
}
i should be j
< should be <=
= should be ===
Missing semicolon
Why isn't my code working?
if (x = "Start") {
fill(0, 255, 0);
}
= should be ===
A string can't be stored in a variable
Unnecessary quotes
Missing semicolon
Why isn't anything showing up on the screen?
rotate(90);
fill(50, 100);
rect(0, 0, 20, 20);
Not enough numbers in fill
The rect has been drawn outside the limits of the canvas
Unnecessary comma
Misspelled word
Why isn't my circle colourful?
fill(random(0, 255));
ellipse(200, 200, 50, 50);
Missing draw function
Missing parenthesis
Not enough numbers in fill
Misspelled word
Why won't my code run?
for (var i = 0; i < 20; i++) {
fill(random(255));
ellipse(random(400), random(400), 50, 50);
};
Unnecessary semicolon
Not enough numbers in fill
Missing parenthesis
Misspelled word
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 = 6, b = -2
a = 2, b = 4
a = 4, b = 2
a = 0, b = 4
What function calculates the length of a line between two points?
line()
dist()
scale()
print()
On which floor do I live?
(a)
What's Geetha's favourite colour?
(a)
