wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

JavaScript Variables

Total questions: 26

Worksheet time: 16mins

Name
Class
Date
1.

Which is of the following not correct rule for writting variables names.

a)

These need to be in the lowercase or camel case

b)

spaces are allowed while naming these.

c)

These could be mix of letters, Numbers, _ or $

d)

you cannot start with a number

2.

Variable is not case sensitive

a)

True

b)

False

3.

One of the follwing statements is correct

a)

var myVariable = "Hello"

b)

var myVariable = /Hello/

c)

var myVariable = "Hello'

d)

var myVariable = Hello

4.

which the camel case variable name is correct

a)

var my _code_date = "c"

b)

var myCodeDate = "c"

c)

var MycodeDate = "c"

d)

var MyCodeDate = "c"

5.

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

a)

==

b)

!

c)

=

d)

+

6.

4 types of variables are:

a)

Boolean, String, int, double

b)

Boolean , String, Variable, conditions

c)

Boolean , String, Numbers, loops

d)

Boolean , String, ints, while loops

7.

Variables are useful because they allow us because:

a)

they store data and delete the programs

b)

store data and change the results of a program.

c)

change the results of a program only and does not store data,

8.

A variable is like a container with a name that can hold a value.

a)

True

b)

False

9.

Kyle is writing a program. He wants to use a variable that can store the money information. The money will have decimal points so he can display exact change. Which variable he needs to use.

a)

Boolean

b)

String

c)

Float

d)

Integer

10.

Madison is creating a JavaScript program. She likes to add some information that must print as is. She knows that she will need "" around her data but what type of variable she is using.

a)

String

b)

Boolean

c)

Ints

d)

Float

11.

We use the following to Declare a variable for the first time.

a)

var

b)

numApples

c)

bool

d)

variable

12.

String variables are not a sequence of characters.

a)

true

b)

false

13.

Which one is the correct print statement.

a)

println(numPlates);

b)

println(numCars)

c)

println(numHouses;

d)

printLn(numCups);

14.

How would you create a variable named: myHouse and give it a value "123 Dove St. Valley, CA, 99999".

4 lines
15.

Which is of the following not correct rule for writting variables names.

a)

These need to be in the lowercase or camel case

b)

spaces are allowed while naming these.

c)

These could be mix of letters, Numbers, _ or $

d)

you cannot start with a number

16.
A string;
a)
Expresses a true false statement
b)
can contain letters, numbers, spaces, and symbols.
c)
takes in an input, does something with it, and then returns an output.
d)
Runs a boolean (true/false) statement based on data entered
17.
A boolean;
a)
Expresses a true false statement
b)
can contain letters, numbers, spaces, and symbols.
c)
takes in an input, does something with it, and then returns an output.
d)
Runs a boolean (true/false) statement based on data entered
18.
An if/else statement;
a)
Expresses a true false statement
b)
can contain letters, numbers, spaces, and symbols.
c)
takes in an input, does something with it, and then returns an output.
d)
Runs a boolean (true/false) statement based on data entered
19.
A function;
a)
Expresses a true false statement
b)
can contain letters, numbers, spaces, and symbols.
c)
takes in an input, does something with it, and then returns an output.
d)
Runs a boolean (true/false) statement based on data entered
20.

What programming language did we learn in class this week?

a)

Karel

b)

Java

c)

JavaScript

d)

Visual Basic

21.

Which of these is a loop?

a)

if(x<10)

b)

while(x<10)

c)

var x=10;

d)

text(x,10;10)

22.

Greater than or equal to

a)

> or =

b)

> || =

c)

>=

d)

<=

23.

Repeat something 10 times

a)

repeat 10

b)

for (var i=0; i<10; i++)

c)

repeat { } until 10;

d)

while (i = 10)

24.

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 "

25.

When we surround a word with quotes "David" it's called ?

a)

a program

b)

a loop

c)

a string

d)

a command

26.
In a programming language, __________ are used to store data values.
a)
tags
b)
codes
c)
files
d)
variables