What does this line of code do?
dist(mouseX, mouseY, 200, 200);
Reading Code
Quiz
•
Computers
•
3rd - 12th Grade
•
Hard
Brenda McLachlin
Used 6+ times
FREE Resource
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does this line of code do?
dist(mouseX, mouseY, 200, 200);
Checks how far the mouse is from the center of the screen
Checks if the mouse is clicking on a round button
Creates a circle with a diameter of 200 on the screen at position mouseX, mouseY
Changes the size of the canvas to 200, 200
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does this line of code do?
fill(random(255), random(255), random(255), 50);
Sets the colour of a shape to a random shade of grey
Sets the colour of a shape to a random transparent colour
Sets the colour of a line to white
Sets the colour of a line to a random transparent colour
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does this line of code do?
for (var i = 0; i < nums.length; i++) {
Repeats for every number that exists
Loops through all the items in the array nums
Counts from zero to the size of the canvas
Nothing - there's an error
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does this line of code do?
speed *= -1;
Changes the sign of the variable "speed"
Changes the variable speed to its logical opposite
Decreases the framerate by 1
Decreases the speed of an animation by 1
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does this line of code do?
var x = i % 2 === 0;
Stores the remainder of i / 2 in the variable x
Makes x true if i is even and false if i is odd
Calculates half of i and stores it in the variable x
Assigns x the value 2 and i the value 0
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does this line of code do?
rect(200, 200, 100, mouseX);
Makes a rectangle that changes width based on the mouse
Makes a rectangle that changes height based on the mouse
Makes a rectangle that follows the mouse
Makes a rectangle that you can only see when the mouse hovers over it
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does this line of code do?
Obj.draw = function() {
Reassigns the method "draw" of object "Obj" to be a new method
Creates a function that runs 60 times per second
Creates a new object prototype
Changes the way the reserved function "draw" works
15 questions
Intro to Small Basic
Quiz
•
KG - 7th Grade
15 questions
2D Arrays
Quiz
•
9th - 12th Grade
18 questions
Javascript Arrays
Quiz
•
5th Grade
16 questions
QUIZ #1 JAVASCRIPT
Quiz
•
11th Grade
20 questions
CSA Unit 7 Test
Quiz
•
9th Grade
15 questions
Grasshopper App Quiz
Quiz
•
4th - 6th Grade
20 questions
AQA GCSE Computer Science Paper 1
Quiz
•
9th - 11th Grade
15 questions
Javascript
Quiz
•
10th - 12th Grade
15 questions
Character Analysis
Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
10 questions
American Flag
Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25
Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers
Quiz
•
6th - 8th Grade
15 questions
Character Analysis
Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25
Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers
Quiz
•
6th - 8th Grade
20 questions
Taxes
Quiz
•
9th - 12th Grade