wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

js DOM

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

Which function among the following lets to register a function to be invoked once?

a)

setTimeout()

b)

setTotaltime()

c)

setInterval()

d)

settime()

2.

How is everything treated in HTML DOM?

a)

Node

b)

Attributes

c)

Elements

d)

Arrays

3.

Which object is the top of the hierarchy?

a)

Window Object

b)

Document Object

c)

Form Object

d)

Form Control Elements

4.

What among the following is an appropriate event handler for input text among the below options ?

a)

onclick

b)

onchange

c)

onkeyup

d)

onblur

5.

How are the objects organized in the HTML DOM?

a)

Class-wise

b)

Queue

c)

Hierarchy

d)

Stack

6.

Consider the below code:

Identify the correct code in order to fetch the value entered in username text field?

< body>

< form name="register">

Enter username < input value="John" id="name" name="username">

< /form>

< /body>

a)

document.register.name.value

b)

document.getElementById ("name").value

c)

document.getElementByName ("name").value

d)

None of the above

7.

What will be printed in the console on execution of the below code?

var materials = [

'Hydrogen',

'Helium',

'Lithium',

'Beryllium'

];

console.log(materials.map (material => material.length));

a)

[8, 6, 7, 9]

b)

4

c)

[4]

d)

8, 6, 7, 9

8.

The paragraph P Tag is a part of_______

a)

<body>

b)

<html>

c)

<h1>

d)

both <body> <html>

9.

The node directly above a node is called

a)

sibling

b)

child

c)

parent

d)

ancestral

10.

The node that represent html elements

a)

subclassesnodes

b)

windownodes

c)

htmlnodes

d)

elementnodes

11.

What is the reason for avoiding the attributes property in the HTML DOM?

a)

Found unnecessary

b)

Attributes don’t have attributes

c)

Attributes have attributes

d)

Considered irrelevant

12.

The primary purpose of the array map() function is that it __________

a)

maps the elements of another array into itself

b)

passes each element of the array and returns the necessary mapped elements

c)

passes each element of the array on which it is invoked to the function you specify, and returns an array containing the values returned by that function

d)

pass the elements of the array into another array

13.

In general, event handler is nothing but ____________

a)

function

b)

interface

c)

event

d)

handler

14.

What is the purpose of a return statement in a function ?

a)

Returns the value and continues executing rest of the statements, if any

b)

Returns the value and stops the program

c)

Returns the value and stops executing the function

d)

Stops executing the function and returns the value

15.

What is the purpose of the Attr object in the HTML DOM?

a)

Used to focus on a particular part of the HTML page

b)

HTML Attribute

c)

Used to arrange elements

d)

CSS attribute

16.

The focus and blur events are also part of _________

a)

Element events

b)

Handler events

c)

Window events

d)

Scroll events

17.

Which syntax is used to describe elements in CSS?

a)

Protectors

b)

Selectors

c)

Both Protectors and Selectors

d)

Protectors or Selectors

18.

Remove an item from the end of an array.

let cats = ['Bob', 'Willy', 'Mini'];


cats.pop();

a)

['Bob','willy','Mini'];

b)

['Bob','willy'];

c)

['willy','Mini'];

d)

['Bob','Mini'];

19.

What is mean by "this" keyword in javascript?

a)

It refers current object

b)

It referes previous object

c)

It is variable which contains value

d)

None of the above

20.

In JavaScript, Window.prompt() method return true or false value ?

a)

False

b)

True