wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Javascript

Total questions: 25

Worksheet time: 24mins

Name
Class
Date
1.
Indicates the beginning  and the end of a JavaScript section.
a)
<html> </html>
b)
<style> </style>
c)
<article> </article>
d)
<script> </script>
2.
A JavaScript file has an extension name of
a)
.jscp
b)
.js
c)
.css
d)
.Jp
3.
Which keyword do we need to define a function?
a)
function
b)
method
c)
onclick
d)
functionName()
4.
Which 1 of the following symbols is used for JavaScript comments?
a)
\\
b)
^
c)
?
d)
//
5.
What type of variable is
var typeOfApples="Fuji";
a)
Int
b)
Float
c)
Boolean
d)
String
6.

How can a developer show a pop-up message to the user?

a)

alert

b)

prompt

c)

console.log

d)

<p> tag

7.
Which message will the user see?
a)
"Hello user"
b)
No message
c)
"Goodbye user"
d)
"message + user"
8.

What attribute/value do we use to make a button execute JavaScript when clicked?

a)

onclick="doSomething;"

b)

on-click="doSomething;"

c)

onclick="doSomething();"

d)

onclick=doSomething();

9.
How do I declare a new variable?
a)
var newVariable = 5;
b)
Variable int = new Variable();
c)
var 5 = myVariable;
d)
int var = 5;
10.
What is CSS used for?
a)
styling web pages
b)
formatting script correctly
c)
client side scripting
d)
server side scripting
11.
How do we generate a random number?
a)
Math.random()
b)
random.number()
c)
number.random()
d)
Random.math()
12.

Which of the following platform(s) can be used to run Javascript Code (you can choose more than one answer)

a)

Google Chrome

b)

Firefox

c)

Microsoft Edge

d)

Safari

13.
How do I change the size of an image?
a)
width / height
b)
scale
c)
size
d)
shrink
14.

What is the correct syntax for referring to an external JavaScript script?

a)

<script src="myscript.js"></script>

b)

<script href="myscript.js"></script>

c)

<js href="myscript.js"></js>

d)

<js src="myscript.js"></js>

15.
Which attribute(s) of the FORM and INPUT tags become the properties of the created object?
a)
value
b)
value and name
c)
name
d)
name and type
16.

Which one of the following symbols is used for JavaScript comments?

a)

\\

b)

^

c)

?

d)

//

17.

What type of variable is

a)

Boolean

b)

Number

c)

String

18.

Which message will the user see?

a)

"Hello user"

b)

No message

c)

"Goodbye user"

d)

"message + user"

19.

How do I declare a new variable?

a)

var newVariable = 5

b)

Variable int = new Variable()

c)

var 5 = myVariable

d)

int var = 5

20.

Which of these is a loop?

a)

if(x<10)

b)

while(x<10)

c)

var x=10;

d)

text(x,10;10)

21.

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

Which of the following is the best way to write the above statement?

a)

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

b)

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

c)

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

d)

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

22.

A programming language used for webpage functionality such as interactivity, data processing, animation, and development of purpose built apps such as mobile and desktop apps and more.

a)

HTML5

b)

CSS

c)

JS

d)

C#

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.

A short form writing the word variable is

a)

rav

b)

war

c)

var

d)

varia

25.

A store has 20 apples in its inventory. How can you store this information in a JavaScript variable?

a)

var numApples == 20;

b)

20 = numApples;

c)

var numApples = 20;

d)

var num apples = 20;