wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Javascript Quiz 1

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

The ______ nethod returns an array of elements that match a specified tag name.

a)

getElementById()

b)

getElementByTagName()

c)

getElementByClass()

d)

querySelector()

2.

Which of the following is the correct syntax for accessing an element with the id value for a headline?

a)

document. getElementByID("headline")

b)

document. getElementByID(headline)

c)

document. getElementById("headline")

d)

document. GetElementByID("headline")

3.

The following code returns a list of all elements where the id = "intro"

var x = document.getElemensByClassName("intro");

a)

TRUE

b)

FALSE

4.

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

<p id="demo">This is a demonstration.</p>

a)

document.getElementbyId('demo").innerHTML="Hello World!";

b)

document.getElementById('demo").innerHTML="Hello World!"; #demo.innerHTML = "Hello World!";

c)

document.getElementbyId('demo").innerHTML=Hello World!;

d)

document.GetElementById('demo").innerHTML="Hello World!";

5.

The Document Object Model (DOM) is a World Wide Web Consortium (W3C) standard.

a)

TRUE

b)

FALSE

6.

Each element on a web page is represented in the HTML DOM by its own object.

a)

TRUE

b)

FALSE

7.

The ____ property of the Image object allows Javascript to dynamically change an image.

a)

id

b)

class

c)

size

d)

src

8.

Which of these lines of code is valid javascript for defining a variable?

a)

var noseSize = 10;

b)

var noseSize == 10;

c)

noseSize is 10;

d)

var nose Size = 10;

9.

Which of these is a valid variable name in Javascript?

a)

123abc

b)

abc 123

c)

abc123

d)

abc123!

10.

What is the correct syntax to use an external script called "new.js"?

a)

<script src = "new.js">

b)

<script name = "new.js">

c)

<script href = "new.js">

d)

<script content = "new.js">

11.

Can you test Javascript code inside web browsers like Firefox, Chrome, Microsoft Edge?

a)

TRUE

b)

FALSE

12.

Who created Javascript Language?

a)

Brendan Eich

b)

Douglas Crockford

c)

James Gosling

d)

Ryan Dahl

13.

Javascript works inside web browsers only?

a)

TRUE

b)

FALSE

14.

What is Javascript?

a)

Scripting Language that follows ECMAScript standard

b)

Client-side scripting language (web browsers)

c)

Server-side scripting language

d)

All of the choices are correct

15.

Inside what HTML tag you would put JavaScript code?

a)

<js>

b)

<scripting>

c)

<script>

d)

<javascript>