21.) What does the window.open() method do?
A) Reloads the current page.
B) Closes the current window.
C) Navigates to a new URL in the same window.
D) Opens a new browser tab or window.
22.) How do you check the browser’s viewport width in JavaScript?
A) document.body.width
B) window.innerWidth
C) screen.width
D) viewport.size
23.) What does the window.scrollTo() method do?
A) Adjusts the browser zoom level.
B) Saves the current scroll position.
C) Scrolls the document to a specific position..
D) Highlights the content on the page.
24.) Which API is used to make WebSocket connections?
A) fetch()
B) WebSocket
C) HTTP
D) Ajax
25.) What does the Notification API do?
A) Sends notifications to the user’s email.
B) Displays browser notifications.
C) Tracks the user’s activity.
D) Updates the webpage title.
26.) How can you monitor changes to the size of an element?
A) Using the ResizeObserver API.
B) Using the MutationObserver API.
C) Using the IntersectionObserver API.
D) Using the performance.now() method.
27.) What is the purpose of the Clipboard API?
A) To save user data locally.
B) To read and write data to the clipboard.
C) To access file data.
D) To modify the DOM.
28.) How do you register an event that triggers once and then removes itself?
A) Use the once option in addEventListener().
B) Use addEventListener() followed by removeEventListener().
C) Use the triggerOnce() method.
D) Use the oneTimeEvent() function.
29.) What does the crypto.randomUUID() method do?
A) Generates a unique identifier.
B) Encrypts a string.
C) Decrypts a string.
D) Creates a random number.
30.) How can you determine the type of device being used?
A) Using the device.check() method.
B) Using the window.deviceType property.
C) Using the screen.type property.
D) Using the navigator.userAgent property.
Related