wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

JavaScript_Revision

Total questions: 45

Worksheet time: 26mins

Name
Class
Date
1.
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
2.
What surrounds a string?
a)
Quotations
b)
Curly Brackets
c)
Parenthesis
d)
Square Brackets
3.
To display writing on the screen you must include this direction;
a)
Document Write
b)
documentWrite
c)
document.write( )
d)
document.write
4.
A variable;
a)
Expresses a true false statement
b)
stores a string, number, or boolean, and gives it a specific, case-sensitive name
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
5.
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
6.
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
7.
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
8.
What surrounds an if/else statement?
a)
Quotations
b)
Curly Brackets
c)
Parenthesis
d)
Square Brackets
9.
An array is;
a)
Shapes
b)
Sizes
c)
Options
d)
Lists of data
10.
What surrounds an array?
a)
Quotations
b)
Curly Brackets
c)
Parenthesis
d)
Square Brackets
11.

Which of these is a loop?

a)

if(x<10)

b)

while(x<10)

c)

var x=10;

d)

text(x,10;10)

12.

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

a)

increment (x)

b)

x++;

c)

x=x;

d)

x+1;

13.

Which of the following will decrease the value of x?

a)

x--;

b)

x-1;

c)

x=x;

d)

x=-x;

14.

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

a)

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

b)

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

c)

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

d)

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

15.

Repeat something 10 times

a)

repeat 10

b)

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

c)

repeat { } until 10;

d)

while (i = 10)

16.

A short form writing the word variable is

a)

rav

b)

VAR

c)

var

d)

varia

17.
What command removes the outlines from shapes?
a)
noOutline ();
b)
noColor();
c)
noBorder();
d)
noStroke ();
18.
What is at the end of a line of code?
a)
#
b)
;
c)
)
d)
>
19.

The "stroke" command means

a)

color inside shape

b)

color outside shape

c)

color of blocks

d)

border

20.

What does the "fill" command do

a)

put letters in the shape

b)

put pictures in the shape

c)

put color in the shape

d)

put code in the shape

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

Javascript is _________ language.

a)

Programming

b)

Scripting

c)

Application

d)

applet

23.

JavaScript is designed for following purpose -

a)

To Style HTML Pages

b)

To Perform Server Side Scripting Opertion

c)

To add interactivity to HTML Pages.

d)

To Execute Query Related to DB on Server

24.

JavaScript is can be written -

a)

directly into JS file and included into HTML

b)

directly into HTML pages

c)

directly on the Server Script

d)

None of these

25.

Is this correct syntax to include JS Code inside HTML Page ?

<script type="text/javascript">

...

</script>

a)

Yes

b)

No

26.

Which of these is a method?

a)

getElementById( )

b)

style

c)

document

d)

color

27.

What would this piece of code do?

a)

change the background color of the word demo to red

b)

change the font color of the demo element to red

c)

this is not correct

d)

styles the element with the class demo

28.

What is the correct syntax to transform a string to upper case?

a)

var txt = "Hello!" ;

toUpperCase( txt );

b)

var txt = "Hello!" ;

toUpperCase.txt();

c)

var txt = "Hello!" ;

txt.toUpperCase();

d)

var txt = "Hello!" ;

txt(toUpperCase);

29.

What would this piece of code display?

a)

10

20

30

40

b)

1

2

3

4

c)

10

20

30

40

50

d)

11

22

33

44

30.
Which one of the following is NOT a logical operator?
a)
||
b)
&&
c)
$$
d)
!
31.
Which of the following is the correct way to declare a variable?
a)
variable myName
b)
var myName
c)
MY_NAME
d)
VAR myName
32.
Arithmetic Operators
What is -- ?
a)
Division
b)
Modulo
c)
Increment
d)
Decrement
33.

Which of the following are valid keywords for JavaScript?

a)

let

b)

var

c)

const

d)

def

34.

What would alert(6 + '2') show?

a)

8

b)

62

c)

6+'2'

d)

6'2'

35.

Look at the following code:


let attendees = 568;

attendees++

document.write(attendees)


What will print to the browser?

a)

568

b)

570

c)

569

d)

An error message

36.

Look at the following code:


let total_price = 40;

total_price--

--total_price

document.write(total_price)


What will print to the browser?

a)

39

b)

40

c)

38

d)

42

37.

Read the code below:


alert(true || false);


What would the output be?

a)

True

b)

False

38.

Read the code below:


alert(false && true);


What would the output be?

a)

True

b)

False

39.

Read the code below:


alert(!false);


What would the output be?

a)

True

b)

False

40.

Determine what result each expression yields if it is True or False. Given that x= 8 and y= 16.


(x!== 9 && y===16 ) || ( x>10 || y!=16)

a)

False

b)

True

41.

Determine what result each expression yields if it is True or False. Given that x= 8 and y= 16.


( x === 8 || y > 5) && ( x! == 7 && y > "11")

a)

True

b)

False

42.

Determine what result each expression yields if it is True or False. Given that x= 8 and y= 16.


( x > "4" || y<=10) || x === 8|| y>15)

a)

True

b)

False

43.

Determine what result each expression yields if it is True or False. Given that x= 8 and y= 16.


( x > 3 && y ! == 7)&&( x>= 6 && y == 16)

a)

True

b)

False

44.

Determine what result each expression yields if it is True or False. Given that x= 7 and y= 9.


( x >2 && y ! == 9)&&( x>= 6 && y ==9)

a)

True

b)

False

45.

Determine what result each expression yields if it is True or False. Given that x= 5 and y= 3.


( x==2 || y == 3 )||( x<6 && y<9)

a)

True

b)

False