wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

JavaScript Variables and Arithmetic

Total questions: 14

Worksheet time: 8mins

Name
Class
Date
1.

Which of these is NOT a JavaScript operator?

a)

+

b)

*

c)

++

d)

*=

e)

=+

2.

What symbol is most likely to appear in a JavaScript program?

a)

; (semicolon)

b)

= (equals)

c)

" (quote)

d)

, (comma)

3.

Which of these is a JavaScript keyword?

a)

var

b)

variable

c)

equal

d)

add

4.

var a = 2;

Which of these will cause a to be 3 times larger?

a)

a += 3;

b)

a += 4;

c)

a += 1

d)

a++;

5.

Which of these will cause a syntax error?

a)

var strA = "She says, "Hi There" ";

b)

var a = 4.98 - 15;

c)

var b = b;

d)

var strB = "\"quoted\""

6.

What is the result of this code?


var a = 15 % 3;

a)

a = 0

b)

a = 5

c)

a = 12

d)

a = 45

7.

Which of the following is NOT a valid starting character for JS variable names?

a)

A (uppercase letter)

b)

a (lowercase letter)

c)

$ (dollar sign)

d)

_ (underscore)

e)

3 (digit)

8.

Which of the following is a symbol that must NOT be present in any JS variable name?

a)

A

b)

z

c)

_

d)

%

9.

Which of the following operator is used for the Assignment Operator?

a)

==

b)

!

c)

=

d)

+

10.

What is the symbol used for the INCREMENT operator in JS?

a)

+

b)

++

c)

=

d)

==

11.

used to write comments

a)

++

b)

=

c)

//

d)

--

12.

Which of these will increase the value of the variable X?

a)

increment (x)

b)

x++;

c)

x=x;

d)

x+1;

13.
What surrounds a string?
a)
Quotations
b)
Curly Brackets
c)
Parenthesis
d)
Square Brackets
14.

To make things easier in JavaScript, you can exchange upper- and lower-case letters whenever you wish.

a)

True

b)

False