WorksheetsUnderstanding BOM in JavaScript(14R)
Total questions: 15
Worksheet time: 8mins
What does BOM stand for in JavaScript?
Basic Object Management
Browser Output Model
Browser Object Model
Binary Object Model
Name one object that is part of the BOM.
capacitor
resistor
transistor
inductor
How can you access the browser window in JavaScript?
Call the 'getWindow()' function.
Use the 'document' object.
Use the 'window' object.
Access the 'navigator' object.
What method would you use to open a new browser window?
Use Ctrl + N or Command + N to open a new browser window.
Press F5 to open a new browser window.
Use Alt + F4 to open a new browser window.
Right-click and select 'Open New Window'.
Which property of the window object returns the current URL?
window.location.href
window.url
window.location.pathname
window.currentURL
What does the alert() function do in the BOM?
It creates a new browser window.
It logs a message to the console.
It displays an alert dialog with a message.
It redirects the user to a different webpage.
How can you get the screen width using BOM?
screen.width()
document.body.clientWidth
window.innerWidth
window.screen.width
What is the purpose of the navigator object in BOM?
The navigator object handles user authentication for web applications.
The navigator object provides information about the web browser and the user's environment.
The navigator object is used to manage cookies in the browser.
The navigator object controls the layout of the web page.
How do you change the current URL of the browser?
Invoke `window.navigate('newURL');` in JavaScript.
Use `window.location.href = 'newURL';` in JavaScript.
Use `document.changeURL('newURL');` in JavaScript.
Set `location.replace('newURL');` in JavaScript.
What method can be used to close a browser window?
Click the 'Home' button to exit the browser
Use 'Ctrl + N' to open a new window
Use 'Ctrl + W' or 'Command + W' keyboard shortcut, or click the 'X' button.
Press 'Alt + F4' to minimize the window
How can you detect the user's browser using BOM?
Check the 'window.location' object for browser information.
Utilize 'console.log()' to print the browser type.
Use 'document.title' to detect the user's browser.
Use 'navigator.userAgent' to detect the user's browser.
What is the role of the history object in BOM?
The history object manages cookies in the browser.
The history object stores user preferences.
The history object allows navigation through the browser's session history.
The history object tracks browser performance metrics.
How can you navigate back in the browser history?
Close the browser and reopen it to start fresh
Use the forward button to go back
Refresh the page to return to the previous site
Use the back button or keyboard shortcuts like 'Alt + Left Arrow' or 'Command + ['.
What does the location object represent in BOM?
The history of visited pages.
The size of the browser window.
The current URL of the document in the browser.
The settings of the browser.
How can you retrieve the hostname of the current page?
window.getHostname()
document.hostname
location.hostName
window.location.hostname
