wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Understanding BOM in JavaScript(14R)

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

What does BOM stand for in JavaScript?

a)

Basic Object Management

b)

Browser Output Model

c)

Browser Object Model

d)

Binary Object Model

2.

Name one object that is part of the BOM.

a)

capacitor

b)

resistor

c)

transistor

d)

inductor

3.

How can you access the browser window in JavaScript?

a)

Call the 'getWindow()' function.

b)

Use the 'document' object.

c)

Use the 'window' object.

d)

Access the 'navigator' object.

4.

What method would you use to open a new browser window?

a)

Use Ctrl + N or Command + N to open a new browser window.

b)

Press F5 to open a new browser window.

c)

Use Alt + F4 to open a new browser window.

d)

Right-click and select 'Open New Window'.

5.

Which property of the window object returns the current URL?

a)

window.location.href

b)

window.url

c)

window.location.pathname

d)

window.currentURL

6.

What does the alert() function do in the BOM?

a)

It creates a new browser window.

b)

It logs a message to the console.

c)

It displays an alert dialog with a message.

d)

It redirects the user to a different webpage.

7.

How can you get the screen width using BOM?

a)

screen.width()

b)

document.body.clientWidth

c)

window.innerWidth

d)

window.screen.width

8.

What is the purpose of the navigator object in BOM?

a)

The navigator object handles user authentication for web applications.

b)

The navigator object provides information about the web browser and the user's environment.

c)

The navigator object is used to manage cookies in the browser.

d)

The navigator object controls the layout of the web page.

9.

How do you change the current URL of the browser?

a)

Invoke `window.navigate('newURL');` in JavaScript.

b)

Use `window.location.href = 'newURL';` in JavaScript.

c)

Use `document.changeURL('newURL');` in JavaScript.

d)

Set `location.replace('newURL');` in JavaScript.

10.

What method can be used to close a browser window?

a)

Click the 'Home' button to exit the browser

b)

Use 'Ctrl + N' to open a new window

c)

Use 'Ctrl + W' or 'Command + W' keyboard shortcut, or click the 'X' button.

d)

Press 'Alt + F4' to minimize the window

11.

How can you detect the user's browser using BOM?

a)

Check the 'window.location' object for browser information.

b)

Utilize 'console.log()' to print the browser type.

c)

Use 'document.title' to detect the user's browser.

d)

Use 'navigator.userAgent' to detect the user's browser.

12.

What is the role of the history object in BOM?

a)

The history object manages cookies in the browser.

b)

The history object stores user preferences.

c)

The history object allows navigation through the browser's session history.

d)

The history object tracks browser performance metrics.

13.

How can you navigate back in the browser history?

a)

Close the browser and reopen it to start fresh

b)

Use the forward button to go back

c)

Refresh the page to return to the previous site

d)

Use the back button or keyboard shortcuts like 'Alt + Left Arrow' or 'Command + ['.

14.

What does the location object represent in BOM?

a)

The history of visited pages.

b)

The size of the browser window.

c)

The current URL of the document in the browser.

d)

The settings of the browser.

15.

How can you retrieve the hostname of the current page?

a)

window.getHostname()

b)

document.hostname

c)

location.hostName

d)

window.location.hostname