wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Programming in JavaScript

Total questions: 11

Worksheet time: 8mins

Name
Class
Date
1.

Which are the following are commands, (not variables)?

a)

c.fillStyle = 'green';

b)

color = 'pink';

c)

c.fillRect(50, 120, 10, 300);

d)

drawStackedBoxes(10, 10, 50, 100);

2.

Ah! There's a bug in this command! How should we debug?

c.fillstyle = 'blue';

a)

It should be "blue"

b)

Capitalize the s

c)

Add a space after "c."

d)

Capitalize the f

3.

I need some help assigning the value of 1 to the variable x. What should I do?

a)

1=x;

b)

=1x;

c)

;=x1

d)

x=1;

4.

I used the (a)   analogy to describe what a variable is.

5.

A function is a series of (a)   grouped together.

6.

How many times can I use a function?

a)

1 time

b)

5 times

c)

100 times

d)

Infinite times (there is no limit)

7.

Which of the following contain arguments?

a)

function paintCanvas(color) {

b)

function drawPlayer(x, y) {

c)

drawCanvas();

d)

drawPlayer(150, 20, 'red', 'blue');

8.

Which of the following are examples of User Input?

a)

Key Click

b)

Button Click

c)

Joystick

d)

Eating

9.

Why is the setInterval command useful?

a)

We can loop a block of code infinite times

b)

We create an interval of between the loops

c)

We can tell the functions to run by themselves without calling them

d)

We can automatically assign value to variables

10.

Write any example of an if-else statement! Remember the one I used:


IF you eat all your dinner, then you can have dessert; ELSE (otherwise) you can just sit

here and watch everyone else have dessert.

4 lines
11.

Which are game states?

a)

Menu Screen

b)

Finish Screen

c)

Playing the game

d)

Debugging your game