Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Javascript Conditional Statements

Total questions: 20

Worksheet time: 11mins

Name
Class
Date
1.

Greater than or equal to

a)

> or =

b)

> || =

c)

>=

d)

<=

2.

What Javascript code matches this statement:

Their name is Kim and they are less than 16 years old

a)

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

b)

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

c)

if (name = "Kim" || age < 16 )

d)

if (name === "Kim" || age < 16 )

3.

What symbol represents the and operator in JavaScript?

a)

AND

b)

and

c)

&

d)

&&

4.

What symbol represents the or operator in JavaScript?

a)

OR

b)

or

c)

||

d)

|

5.
Comparision Operators
What is == ? 
a)
Equal to 
b)
Equal value and equal type
c)
Not equal
d)
Not equal value or not equal type
6.
Comparision Operators
What is === ? 
a)
Equal to
b)
Equal value and equal type
c)
Not equal
d)
Not equal value or not equal type
7.
Comparison Operators
What is != ?
a)
Equal to
b)
Equal value and equal type
c)
Not equal
d)
Not equal value or not equal type
8.
Comparision Operators
What is ! == ?
a)
Equal to 
b)
Equal value and equal type
c)
Not equal
d)
Not equal value or not equal type
9.
Comparison Operators
What is >= ?
a)
Greater than
b)
Less than
c)
Greater than or equal to
d)
Less than or equal to
10.
Comparison Operator
What is <= ?
a)
Greater than
b)
Less than
c)
Greater than or equal to
d)
Less than or equal to 
11.
Logical Operators
What is && ? 
a)
And
b)
Or
c)
Not
d)
Less than
12.
Logical Operators
What is ! ?
a)
And
b)
Or
c)
Not
d)
Less than
13.
The conditional statement, in Javascript, begins with the word _______.
a)
Then
b)
Else
c)
If
d)
OK
14.

What Javascript code matches this statement:

The score is not 0

a)

if (score != 0)

b)

if (score =! 0)

c)

if (score not 0)

d)

if (score !! 0)

15.

What Javascript code matches this statement:

The player's health is 0 and they still have a life remaining.

a)

if (health == "0" && lives > "0")

b)

if (health === 0 && lives > 0)

c)

if (health === 0 && lives >= 0)

d)

if (health <1 && lives > 0)

16.

What Javascript code matches this statement:

The player has gathered at least 300 coins or reached the end of the level.

a)

if ("coins" >= 300 && "end" == true)

b)

if (coins >= 300 || end == true)

c)

if ("coins" >= 300 OR "end" == true)

d)

if ("coins" >= 300 || "end" == true)

17.

Fill in the blank to match the statement:

The player has at least 2 lives remaining.


if( (a)   )


Do not use spaces.

18.

Fill in the blank to match the statement:

The score is no more than 20.


if( (a)   )


Do not use spaces.

19.

Fill in the blank to match the statement:

The machine is not running.


if( (a)   )


Do not use spaces. There are multiple possible answers.

20.

Fill in the blank to match the statement:

It is either this or that.


if( (a)   )


Do not use spaces. There are multiple possible answers.