wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

IST_OPENING_DOM Review 11.14

Total questions: 29

Worksheet time: 14mins

Name
Class
Date
1.

What does the following code log?

<p>Para 1</p>

<p>Para 2</p>

<p>Para 3</p>

    console.log(document.getElementsByTagName("p").innerHTML);

a)

A. "Para 1, Para 2, Para3"

b)

undefined

c)

It throws an error

d)

 None of the choices

2.
Indicates the beginning  and the end of a JavaScript section.
a)
<html> </html>
b)
<style> </style>
c)
<article> </article>
d)
<script> </script>
3.

The following code will:

x++;

a)

Add 1 to the previous value of x

b)

Add 1 to the previous value of y

c)

Subtract 1 from the previous value of x

d)

Give an error message

e)

Add 2 to the previous value of x.

4.

A developer will use this to see details about code that she does not want the site user to necessarily see:

a)

document.write();

b)

var debug();

c)

print.console();

d)

console.log();

5.

If I want to check whether two values are equal, which operator should I use?

a)

=

b)

==

c)

equal

d)

::

e)

--

6.

An example of camel casing:

a)

getElementsByTagName

b)

GetElementsByTagName

c)

getelementsbytagName

d)

GetelementsbytagName

e)

getelementsbytagname

7.

DOM get element by id is?

a)

Document.Getelementbyid()

b)

DOM.getElmentById()

c)

Document.getElementByID()

d)

document.getElementById()

8.

What DOM Property is used to update the text of an HTML tag?

a)

innerHTML

b)

value

c)

string

d)

id

9.

A variable:

a)

Expresses a true-false statement

b)

Takes in an input, does something with it, and then returns an output.

c)

Runs a boolean (true/false) statement based on data entered

d)

Stores a string, number, or boolean, and gives it a specific, case-sensitive name

10.

What surrounds an if/else statement?

a)

Quotations " "

b)

Parenthesis ( )

c)

Square Brackets [ ]

d)

Curly Brackets { }

11.

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

a)

alert

b)

prompt

c)

console.log

d)

<p> tag

12.
What best describes a variable?
a)
they allow the user to change language settings
b)
they allow the user to change the variable's data type
c)
they allow the user to save and call values
d)
they allow the user to declare a new data type
13.
A user-defined name for a memory location whose value can change over time.
a)
variable
b)
syntax
c)
operator
d)
token
14.
In JavaScript, you should include a semi-colon at the end of each statement.
a)
yes
b)
no
15.
How do we declare a variable that can change?
a)
constant
b)
const
c)
letter
d)
let
16.

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


How many times will this loop execute

a)

51 times

b)

49 times

c)

50 times

d)

0 times

17.

How do you define a function in JavaScript

a)

function = climbUp();

b)

fun = "climbUp";

c)

function climbUp();

d)

fun = (climbUp());

18.
What surrounds a string?
a)
Quotations
b)
Curly Brackets
c)
Parenthesis
d)
Square Brackets
19.

A short form writing the word variable is

a)

rav

b)

VAR

c)

var

d)

varia

20.

WHAT do "purple", "green" in this code refer to?


var x1= document.getElementById("purple").checked;

var x2= document.getElementById("green").checked;

a)

They are the IDs of RadioButtons.

b)

They are the names of radiobuttons

c)

They are the names of textboxes

d)

They are the names of drop-down list items

21.

How do you change the text to "Alma Thomas"?

a)

A

b)

B

c)

C

22.

Which argument should we use to get the right DOM element?

(a)  

23.

How to get all elements by their tag name in JavaScript?

a)

document.getElementsByTagName();

b)

document.getElementsByTag();

c)

document.getElementsByTabName();

d)

document.getElementByTagName();

24.

In Document Object Model (DOM), all the properties, methods and events that are available to a web developer for manipulating and creating web pages are organised into:

a)

Classes

b)

Objects

c)

Modules

d)

Variables

25.

DOM represents a webpage in what way?

a)

Dynamic structure

b)

Recursive structure

c)

Tree-like structure

d)

Hash table structure

26.

What are HTML Tags?

a)

HTML tags are composed of three things: an opening tag, content and ending tag. Some tags are unclosed tags.

b)

HTML tags are composed of three things: an opening tag, content and ending tag. All tags need to be closed.

c)

HTML tags define metadata about an HTML document. Metadata is data (information) about data.

d)

I didn't know that I was supposed to be studying

27.

It is used mostly in the web pages to generate the dynamic content such as writing the validation message, password strength etc

a)

innerHTML

b)

innerDocument

c)

innerText

d)

innerTag

28.

•The document object represents the whole html document.

a)

True

b)

False

29.

JavaScript can't change all the HTML elements in the page

a)

True

b)

False