A store has 20 apples in its inventory. How can you store this information in a JavaScript variable?
JavaScript and Graphics

Quiz
•
Computers
•
9th - 12th Grade
•
Medium
Adam Dennison
Used 356+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
var numApples == 20;
20 = numApples;
var numApples = 20;
var num apples = 20;
2.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
You want to read input from the user to know how many apples they would like to buy. Which statement should you use to read in a number from the user?
var applesToBuy = readLine("How many apples would you like? ");
var applesToBuy = println("How many apples would you like? ");
var applesToBuy = readInt("How many apples would you like? ");
var applesToBuy = nextInt("How many apples would you like? ");
3.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
You are splitting up all of your apples equally between 3 people. Which statement below will calculate how many apples will be left over?
var leftOver = numApples / 3;
var leftOver = 3 / numApples;
var leftOver = numApples % 3;
var leftOver = 3 % numApples;
4.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
In a graphics canvas, what are the coordinates of the bottom right corner of the window?
0, 0
0, getWidth()
getHeight(), getWidth()
getWidth(), getHeight()
5.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
What are the coordinates of the center of the window?
getWidth(), getHeight()
getWidth() / 2, getHeight() / 2
getHeight() - getWidth(), getWidth() - getHeight()
getHeight() / 2, getWidth() / 2
6.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
In the following code:
var size = 20;
var x = 100;
var y = 200;
var ball = new Circle(size);
ball.setPosition(x, y);
What is the meaning of the x variable?
The x coordinate of the center of the circle
The x coordinate of the left edge of the circle
The radius of the circle
The position of the circle
7.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
The following program should draw a circle on the screen
1 function start(){
2 var circle = new Circle(40);
3 circle.setPosition(getWidth() / 2, getHeight() / 2);
4 circle.setColor(Color.blue);
5 }
But when we run this code, we don’t see the circle. What is missing from our start function?
We never set the circle’s radius.We need to add the linecircle.setRadius(40);After line 4
We are setting the position of the ball to be off the canvas.
We need to change line 3 to be
circle.setPosition(0, 0);
We are creating the circle incorrectly. We need to specify the width and height.
We need to change line 2 to be
var circle = new Circle(40, 40);
We create the circle and position it correctly on the screen, but we never add it to the screen.
We need to add the line
add(circle);
after line 4
Create a free account and access millions of resources
Similar Resources on Quizizz
11 questions
JS: Conditionals!

Quiz
•
6th Grade - University
20 questions
Unit 5 Quiz - Loops & Lists (code.org)

Quiz
•
10th - 12th Grade
15 questions
JavaScript Control Structures Quiz Unit 5 Test A

Quiz
•
11th Grade
17 questions
Python

Quiz
•
6th - 10th Grade
20 questions
AIB_2Q

Quiz
•
12th Grade
15 questions
JavaScript Quiz

Quiz
•
9th - 10th Grade
20 questions
Arrays in Java

Quiz
•
9th - 12th Grade
19 questions
JavaScript Test

Quiz
•
12th Grade
Popular Resources on Quizizz
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
Discover more resources for Computers
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
20 questions
Taxes

Quiz
•
9th - 12th Grade
17 questions
Parts of Speech

Quiz
•
7th - 12th Grade
20 questions
Chapter 3 - Making a Good Impression

Quiz
•
9th - 12th Grade
20 questions
Inequalities Graphing

Quiz
•
9th - 12th Grade
10 questions
Identifying equations

Quiz
•
KG - University