wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Calculator

Total questions: 15

Worksheet time: 30mins

Name
Class
Date
1.

Inside which HTML element do we put the JavaScript?.

a)

Test

b)

Text

c)

<script>

2.

What is the correct JavaScript syntax to change the content of the HTML element below?

a)

document.getElementById(“demo“).innerHTML=”hello world”;

b)

attributes

c)

<>

3.

Where is the correct place to insert a JavaScript?

a)

img

b)

hyperlink

c)

Both <head> and <body>

d)

src

4.

How do you write "Hello World" in an alert box?

a)

Target=”new”

b)

msg(“Hello world”)

c)

alert(“Hello world”)

d)

Target=”_self”

5.

How to Write JS Comments?

a)

<!--this is a comment -->

b)

<-- this is a comment -->

c)

// this is a comment //

d)

None of the Above

6.

The external JavaScript file must contain the <script> tag.

a)

True

b)

False

7.

How do you create a function in JavaScript?

a)

fun function

b)

function para()

c)

function.mypara()

d)

<th>

8.

How do you call a function named "myFunction"?

a)

square

b)

call myfunction

c)

myfunction()

d)

myFunction()

9.

How does a WHILE loop start?

a)

<input type=”checkbox”>

b)

<input type=”date”>

c)

while(i <= 10)

10.

_____________ is a single variable that is used to store different elements

a)

array

b)

legend

c)

action

d)

method

11.

How does a WHILE loop start?

a)

for(i=0; i <= 5; i++)

b)

Heading in h2

c)

Do Nothing

12.

Which event occurs when the user clicks on an HTML element?

a)

elements

b)

OnClick

c)

Both elements and OnClick

13.

Which operator is used to assign a value to a variable?

a)

/

b)

=

c)

+

d)

-

14.

How do you declare a JavaScript variable?

a)

var carName;

b)

GET

c)

Request

d)

None of the above

15.

document.write(Hello there) what will this do?

a)

Hello there

b)

Hello there in the center of webpage

c)

document.write(Hello there)

d)

Both (a) and (b)