Web Technologies MCQs (Set-3)

Difficulty: Medium

When competing CSS declarations apply, what determines the cascaded value?

A DOM depth alone
B HTML source length
C Cascade precedence
D Selector spelling

Among common CSS selectors, which usually has greater specificity?

A #menu
B nav
C .menu
D *

During event bubbling, which direction does the event travel?

A Toward siblings
B Into stylesheets
C Across network layers
D Toward ancestors

How can code cancel a browser’s default action?

A stopPropagation()
B preventDefault()
C clearTimeout()
D JSON.parse()

Which JavaScript object represents eventual asynchronous completion?

A NodeList
B RegExp
C Promise
D Map entry

How does async/await handle a promise result?

A Blocks entire browser
B Suspends async function
C Changes CSS cascade
D Cancels network access

Which event fires after HTML parsing, before many resources finish loading?

A DOMContentLoaded
B load
C submit
D beforeunload

Why may a browser send a CORS preflight using OPTIONS?

A Download a page
B Refresh cookies
C Negotiate CSS
D Ask permission for request

With a 304 response, what should a cache use?

A Resource was created
B Authentication is missing
C Use stored representation
D Server failed

For cache validation, which response header can identify a representation?

A ETag
B Content-Length
C Accept
D Origin

When Cache-Control: no-store is sent, what should caches do?

A Store indefinitely
B Do not store response
C Revalidate always
D Share across origins

When comparing two web origins, which components matter?

A Path query and fragment
B Cookie and title
C Method body and status
D Scheme host and port

To allow credentialed CORS responses, which setting is required?

A Access-Control-Max-Age
B Access-Control-Expose-Headers
C Access-Control-Allow-Credentials
D Access-Control-Request-Method

How does PUT commonly differ from POST?

A POST is always safe
B PUT replaces target state
C PUT only retrieves data
D POST cannot carry content

Which JavaScript method adds a listener without inline HTML?

A addEventListener()
B querySelectorAll()
C setAttribute()
D JSON.stringify()

CSS custom properties are read with which function?

A ref(–accent)
B use(–accent)
C get(–accent)
D var(–accent)

If padding counts toward declared width, which box setting helps?

A display inline
B overflow hidden
C box-sizing border-box
D position absolute

When font-size uses em units, what is its reference?

A Root font size
B Parent font size
C Viewport width
D Pixel size

Which status usually indicates authentication is required?

A 401
B 403
C 409
D 422

How does HTTP 403 generally differ from a missing resource?

A Resource is missing
B Request succeeded
C Request is forbidden
D Server is redirecting

Why should a form control have an associated label?

A CSS generated content
B URL fragment only
C Placeholder color
D Associated label text

Which HTML element groups related form controls?

A datalist
B fieldset
C output
D picture

Valid JSON text becomes what kind of JavaScript value after parsing?

A JavaScript data value
B HTML element tree
C CSS declaration list
D HTTP response

Which response header can allow a specified cross-origin origin?

A Content-Security-Policy
B Strict-Transport-Security
C X-Content-Type-Options
D Access-Control-Allow-Origin

Why should GET avoid changing server state?

A GET requires a body
B GET disables caching
C GET is defined as safe
D GET encrypts content