Web Development MCQs

100 MCQs  (Page 10 of 10)

What does the spread copy const b = [...a]; do when a contains objects?
It makes a deep copy of everything
It makes a shallow copy: a new array, but the same object references inside it
It makes b a reference to a
It copies only the first element
What is 'event delegation'?
Removing all listeners
Assigning events to another developer
Attaching one listener to a parent element and handling events from its children through bubbling, using event.target
Firing events on a timer
What does Array.prototype.map() return?
undefined
A single accumulated value
The original array, modified in place
A new array with the callback's result for each element; the original array is unchanged
Which statement about Node.js is correct?
It is a JavaScript runtime built on V8 that uses an event-driven, non-blocking I/O model, mainly for server-side code
It is a browser
It is a front-end CSS framework
It runs only in Chrome
What does position: sticky do?
It is the same as fixed
It works only on images
The element acts as relatively positioned until a scroll threshold is reached, then sticks like a fixed element within its container
It removes the element from the flow
What is the purpose of the srcset attribute on <img>?
It lets the browser choose an appropriately sized image for the screen's resolution and size
It defines CSS styles
It sets the alt text
It loads all the images at once
Which hosting type gives you dedicated virtual resources and root access at a moderate cost?
Shared hosting
A static CDN only
Free subdomain hosting
VPS (Virtual Private Server)
Which statement about cookies and localStorage is correct?
Cookies are sent to the server with every matching HTTP request; localStorage stays in the browser and is never sent automatically
localStorage is sent; cookies are not
Both are sent with every request
Neither is ever accessible to JavaScript