Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Intro to JS quiz

Total questions: 26

Worksheet time: 13mins

Name
Class
Date
1.

In the Khan Academy programming environment for Javascript, the bottom left of the drawing window has the coordinates:

a)

(0,0)

b)

(400,0)

c)

(0,400)

d)

(400,400)

2.

The JavaScript function for drawing an ellipse is:

a)

elli

b)

circle

c)

rect

d)

ellipse

3.

The following variable declaration declares a:

var value = 12;

a)

number

b)

whole number

c)

string

d)

decimal value

4.

The following code will :

num +=1

a)

Take 1 away from num

b)

Add 1 to the value of num

c)

Add 2 to the value of num

d)

Take 2 from the value of num

5.

The following code will:


num -= 4

a)

Take 4 from the value of num

b)

Take 1 from the value of num

c)

Add 4 to the value of num

d)

Add 1 to the value of num

6.

Draw = function() {

rect(1,1,4,4);

};

a)

Continuously repeat the drawing of a square

b)

Continuously repeat the drawing of a circle

c)

Draw a rectangle once

d)

draw a rectangle 4 times

7.

What will the following code do?


var x = 0;


draw = function(){

background(1,1,1);

rect(x+=1, 50, 50,50);

};

a)

Draw a rectangle once

b)

Animate a square across the screen (left to right)

c)

Animate a square across the screen (right to left)

d)

Animate a square across the screen (diagonally)

8.

The noStroke() function disables the outline when drawing shapes:

a)

True

b)

False

9.

The following command will:


ellipse(mouseX, mouseY, 30, 30);

a)

draw an ellipse

b)

draw a circle

c)

draw a circle that follows that movement of the mouse

d)

draw a circle 30 pixels by 30 pixels

10.

Each command line in JavaScript should generally end with a :

a)

Capital letter

b)

Semicolon

c)

Full stop

d)

Comma

11.

The following code will:


textSize(30);

text("Sophia", 41, 30);

a)

textSize(30);

text("Sophia", 41, 30); text

b)

Display the name "Sophia" on the screen with the size 30

c)

Display the name "Sophia" on the screen with the size 41

d)

Draw a rectangle

12.

What is the word in the command to create a circle?

a)

oval

b)

circle

c)

ellipse

d)

sphere

13.

What is the word in the command to create a square?

a)

square

b)

rect

c)

quadrilateral

d)

trap

14.

What ends a line of command?

a)

colon

b)

parentheses

c)

curly brace

d)

semi-colon

15.

These surround the text to display in a text command.

a)

quotation marks

b)

parentheses

c)

chevrons

d)

curly braces

16.

This command sets the color for the entire screen.

a)

fill

b)

color

c)

background

d)

paint

17.

To color a specific shape the fill command should go where?

a)

in the shape command

b)

right after the shape command

c)

near the shape command

d)

before the shape command

18.

How many values (numbers) are needed for the triangle command?

a)

3

b)

12

c)

4

d)

6

19.

What repeatedly calls a function during execution?

a)

draw function

b)

repeat function

c)

program restart

d)

reboot

20.

Which two arguments represent the current position of the cursor?

a)

cursorX & cursorY

b)

mouseX & mouseY

c)

pointerX & pointerY

d)

crosshairX & crosshairY

21.

The following is the correct command for a line:

a)

line(x, y, x1, y1)

b)

line(w, x, y, z)

c)

line(a, b, c, d)

d)

line(x1, y1, x2, y2)

22.

Which is the correct way to write a comment in JavaScript?

a)

(#...#)

b)

(!...!)

c)

{{.....}}

d)

//....

23.

RGB stands for what?

a)

REAL GOOD BASICS

b)

RED GREEN BLUE

c)

REFERENCE GOOD BACKGROUNDS

d)

RECTANGLE GOING BLUE

24.

If I want to add a variable for my eyes, which would be the correct line of code.

a)

var eyeSize;

b)

variable = eyeSize!

c)

variable (eyeSize)

d)

var = eyeSize

25.

The "X" parameter

a)

Moves the object left and right

b)

moves the object up and down

c)

changes the width

d)

changes the height

26.

The "Y" parameter

a)

moves the object left and right

b)

moves the object up and down

c)

makes the object wider or thinner

d)

makes the object taller or shorter