CodeHS Javascript and Graphics Practice Test

CodeHS Javascript and Graphics Practice Test

Assessment

Quiz

Computers

9th - 12th Grade

Practice Problem

Medium

Created by

Coral Riley

Used 108+ times

FREE Resource

About this resource

This quiz focuses on introductory JavaScript programming with graphics, covering essential programming concepts appropriate for grades 9-12. The questions assess fundamental programming skills including variable declaration and naming conventions, user input handling with readInt() and readLine() functions, mathematical operations including the modulus operator, and basic graphics programming using coordinate systems and shape creation. Students need to understand JavaScript syntax, the difference between assignment (=) and equality (==) operators, coordinate plane concepts where (0,0) represents the top-left corner, and how to manipulate graphics objects through positioning, sizing, and adding them to the canvas. The quiz also tests comprehension of program flow, debugging skills when graphics objects don't display properly, and mathematical problem-solving involving unit conversions and formula applications. Created by Coral Riley, a Computers teacher in US who teaches grade 9-12. This assessment serves as an excellent tool for formative assessment during an introductory JavaScript and computer graphics unit, allowing teachers to gauge student understanding of core programming concepts before advancing to more complex topics. The quiz works effectively as a review activity before a summative assessment, as homework to reinforce classroom learning, or as a warm-up activity to activate prior knowledge at the beginning of a lesson. Teachers can use individual question analysis to identify specific areas where students need additional support, such as distinguishing between different input methods or understanding coordinate systems in graphics programming. This quiz aligns with CSTA K-12 Computer Science Standards, particularly 1A-AP-10 (developing programs with sequences and simple loops), 1A-AP-14 (observing intellectual property rights), and 1A-AP-15 (creating programs using variables to represent and manipulate data).

See more

Student preview

quiz-placeholder

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

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

var numApples == 20;

20 = numApples;

var numApples = 20;

var num apples = 20;

2.

MULTIPLE CHOICE QUESTION

45 sec • 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

45 sec • 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

45 sec • 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

45 sec • 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

45 sec • 1 pt

Media Image

In the following code:

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

45 sec • 1 pt

Media Image

The following program should draw a circle on the screen, 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 line

circle.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

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?