wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

JavaScript Test 2

Total questions: 32

Worksheet time: 13mins

Name
Class
Date
1.
You assign a VARIABLE by using 
a)
=
b)
" " or ' ' 
c)
[ ]
d)
>
2.
Variables cannot be changed.
a)
False
b)
True
3.
Variables are representative names in a program?
a)
TRUE
b)
FALSE
4.
Variables can contain data.
a)
TRUE
b)
FALSE
5.
The following code will:
x++;
a)
Add 1 to the previous value of x
b)
Add 1 to the previous value of y
c)
Subtract 1 from the previous value of x
d)
Give an error message
6.
Any code that is within the following draw function:
draw = function(){
......
}
a)
Will be performed twice
b)
Will not be performed
c)
Will be performed once
d)
Will be repeated over and over again
7.
In a programming language, __________ are used to store data values.
a)
tags
b)
codes
c)
files
d)
variables
8.
JavaScript uses the _______ keyword to define variables.
a)
vrb
b)
var
c)
vari
d)
va
9.

What keyword do you need to use to define a variable in JavaScript?

a)

variable

b)

var

c)

int

d)

x

10.
JavaScript comments starts with what? 
a)
" "
b)
()
c)
//
d)
;
11.
A while-true loop that repeats forever is called a(n) __________. 
a)
forever loop
b)
continuous loop
c)
nonstop loop
d)
infinite loop
12.
New values can be assigned to a variable at any time.
a)
True
b)
False
13.
Why are the curly braces needed for JavaScript?
a)
To tell the program where the loop begins and ends
b)
To tell the program where the loop is located
14.

Why do we use loops?

a)

It is easy to type

b)

To repeat a block of code without having to retype

15.
What surrounds a string?
a)
Quotations
b)
Curly Brackets
c)
Parenthesis
d)
Square Brackets
16.

A boolean;

a)

Expresses a true false statement

b)

can contain letters, numbers, spaces, and symbols.

17.

What surrounds an if/else statement?

a)

Square Brackets

b)

Curly Brackets

18.
What command removes the outlines from shapes?
a)
noOutline ();
b)
noColor();
c)
noBorder();
d)
noStroke ();
19.
Which command colors the background of your canvas?
a)
background 
b)
endShape
c)
var = color
d)
fill
20.
What command draws a rectangle?
a)
rec (10, 20, 100, 200);
b)
rect (10, 20, 100, 200)
c)
rect (10, 20, 100, 200);
d)
ellipse (10, 20, 40, 40)
21.
What command colors a shape?
a)
color (43, 255, 0);
b)
bucket (43, 255, 0);
c)
fill (43, 255, 0);
d)
bucket (43, 255, 0);
22.
What command draws a line?
a)
stroke (200, 220, 275, 220);
b)
line (200, 220, 275, 220);
c)
horizontal (200, 220,  60, 75);
d)
pencil (200, 220, 275, 220);
23.
What is at the end of a line of code?
a)
#
b)
;
c)
)
d)
>
24.
After running the following code, what will be the value of x?
y = 3;
x = 5 * y;
a)
3
b)
5
c)
15
d)
0
25.
A variable is used to:
a)
Store a value in memory
b)
Draw a circle
c)
Store a value that does not change
d)
Draw a rectangle
26.
A string is used for storing:
a)
Numbers
b)
Integers
c)
Images
d)
Text
27.
In a programming language, __________ are used to store data values.
a)
tags
b)
codes
c)
files
d)
variables
28.

What programming language are we learning?

a)

JavaScript

b)

Visual Basic

29.

Which of the following will decrease the value of x?

a)

x--;

b)

x-1;

c)

x=x;

d)

x=-x;

30.

Greater than or equal to

a)

<=

b)

> || =

c)

>=

31.

His name is Fred and he is less than 16 years old

a)

if (name = "fred" && age < 16 )

b)

if (name === "fred" && age < 16 )

32.

When we are done with a line what do we put at the end?

a)

a colon :

b)

a semi-colon ;

c)

a period .

d)

a quotation mark "