JavaScript Graphics

JavaScript Graphics

9th - 12th Grade

10 Qs

quiz-placeholder

Similar activities

OCR GCSE CS - 2.1 ERL sorts and searches

OCR GCSE CS - 2.1 ERL sorts and searches

10th - 11th Grade

9 Qs

INTRODUCCION A LA PROGRAMACION

INTRODUCCION A LA PROGRAMACION

6th Grade - University

10 Qs

MEDIA AND INFORMATION LITERACY

MEDIA AND INFORMATION LITERACY

12th Grade

10 Qs

PWPB - 11 RPL

PWPB - 11 RPL

11th Grade

15 Qs

Threats to Data

Threats to Data

9th - 12th Grade

11 Qs

HEALTH AND SAFETY 9

HEALTH AND SAFETY 9

7th - 9th Grade

11 Qs

Fundamentos PHP (Manejo de Fomularios y arreglos)

Fundamentos PHP (Manejo de Fomularios y arreglos)

9th Grade

10 Qs

Chapter 7: System life cycle

Chapter 7: System life cycle

9th - 11th Grade

15 Qs

JavaScript Graphics

JavaScript Graphics

Assessment

Quiz

Computers

9th - 12th Grade

Medium

Created by

Mrs. Shah

Used 31+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 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()

2.

MULTIPLE CHOICE QUESTION

30 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

3.

MULTIPLE CHOICE QUESTION

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

4.

MULTIPLE CHOICE QUESTION

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

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is printed to the screen if the user enters ‘5’ when the following program is run?

var userNum = readInt("Enter your favorite number: ");

var calculatedNum = (userNum * userNum) + userNum;

println(calculatedNum);

5

25

30

50

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What is the output of the following program: (Assume the user enters ‘Florence’ then ‘Fernandez’.)

Fernandez Florence

Florence

Fernandez

FlorenceFernandez

Florence Fernandez

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What is printed to the screen when the following program is run?

1

2

3

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?