Questions: Web Technologies
Back to Topics List

Web Technologies Questions

Page 4 of 13 (Displaying Questions 301 – 400 of 1207 Total)

301. Explain the principle of Least Privilege.

Show Answer

A security principle that requires a user or application process to be given only the minimum levels of access or permissions necessary to perform its intended job.

Added: Nov 30, 2025

302. What is the purpose of a nonce in CSP?

Show Answer

A cryptographic random value included in the CSP header and embedded in script/style tags to prevent the injection of unauthorized scripts.

Added: Nov 30, 2025

303. What is the difference between HTTPS and S-HTTP?

Show Answer

HTTPS is the secure version of HTTP using SSL/TLS. S-HTTP (Secure Hypertext Transfer Protocol) was an alternative, less widely adopted protocol for secure communication.

Added: Nov 30, 2025

304. What is a load balancer?

Show Answer

A device or software that distributes network traffic efficiently across multiple servers to ensure high availability and reliability.

Added: Nov 30, 2025

305. Explain horizontal scaling versus vertical scaling.

Show Answer

Horizontal scaling adds more machines (e.g., servers). Vertical scaling adds more resources (CPU, RAM) to an existing single machine.

Added: Nov 30, 2025

306. What is eventual consistency in distributed systems?

Show Answer

A consistency model where if no new updates are made, all reads will eventually return the last updated value, often used in large-scale databases.

Added: Nov 30, 2025

307. What is CAP Theorem?

Show Answer

A theorem stating that it is impossible for a distributed data store to simultaneously provide more than two out of three guarantees: Consistency, Availability, and Partition tolerance.

Added: Nov 30, 2025

308. What is the importance of versioning APIs?

Show Answer

It allows developers to make changes to an API without breaking backward compatibility for existing applications that rely on older versions.

Added: Nov 30, 2025

309. What is the purpose of the OPTIONS HTTP method?

Show Answer

It is used by the client to describe the communication options for the target resource, often used in CORS preflight requests.

Added: Nov 30, 2025

310. What is the difference between a 301 and 302 HTTP status code?

Show Answer

301 (Moved Permanently) means the resource has permanently moved, and search engines update the index. 302 (Found) means temporary redirect.

Added: Nov 30, 2025

311. Explain the purpose of the `If-Modified-Since` header.

Show Answer

A conditional header used in a GET request to tell the server to send the resource only if it has been modified since the specified date.

Added: Nov 30, 2025

312. What is ETag (Entity Tag)?

Show Answer

A unique identifier (like a hash) assigned by the server to a specific version of a resource, used for efficient caching validation.

Added: Nov 30, 2025

313. What is Web Push?

Show Answer

A technology that enables a service worker to display notifications to a user even if the corresponding web page is not currently open.

Added: Nov 30, 2025

314. What is a PWA Shell Architecture?

Show Answer

A pattern where the application's UI (header, navigation) is cached by the Service Worker and loaded instantly, while content is loaded dynamically.

Added: Nov 30, 2025

315. Explain the concept of App Shell caching.

Show Answer

Caching the minimal HTML, CSS, and JavaScript required to power the user interface (the shell) so that it loads instantly on subsequent visits, even offline.

Added: Nov 30, 2025

316. How do you debug a Service Worker?

Show Answer

Using the browser's developer tools (Application tab), which allows inspection of the Service Worker registration, state, and cache storage.

Added: Nov 30, 2025

317. What are the benefits of using HTTP/3?

Show Answer

It uses QUIC protocol over UDP instead of TCP, offering faster connection establishment and eliminating head-of-line blocking, especially on poor networks.

Added: Nov 30, 2025

318. What is the WebGL API?

Show Answer

A JavaScript API for rendering high-performance 2D and 3D graphics in any compatible web browser without the use of plug-ins.

Added: Nov 30, 2025

319. What is the purpose of the `document.write()` method? Why is it discouraged?

Show Answer

It writes directly to the HTML document. It is discouraged because if executed after the page is loaded, it overwrites the entire document, and it can be render-blocking.

Added: Nov 30, 2025

320. What is the role of `isomorphic` or `universal` JavaScript?

Show Answer

Code that can run both on the client (browser) and the server (Node.js), allowing for server-side rendering and client-side interactivity.

Added: Nov 30, 2025

321. Explain the `import()` function for dynamic imports.

Show Answer

A function that returns a Promise and allows loading ES Modules asynchronously and on demand, enabling features like code splitting and lazy loading.

Added: Nov 30, 2025

322. What is a `WeakRef` (Weak Reference)?

Show Answer

An object that holds a weak reference to another object, allowing the referenced object to be garbage collected if no other strong references exist.

Added: Nov 30, 2025

323. What is the difference between `element.remove()` and `element.removeChild(child)`?

Show Answer

`element.remove()` removes the element itself from its parent. `element.removeChild(child)` removes a specified child node of the element.

Added: Nov 30, 2025

324. What is the benefit of using `passive` event listeners?

Show Answer

Setting `{ passive: true }` on touch/scroll event listeners tells the browser the handler won't call `preventDefault()`, allowing scrolling to happen without delay.

Added: Nov 30, 2025

325. How do you measure script execution time in JavaScript?

Show Answer

Using the `performance.now()` method or the `console.time()`/`console.timeEnd()` methods.

Added: Nov 30, 2025

326. What are `SharedArrayBuffer`s and why were they temporarily disabled?

Show Answer

A JavaScript object used to represent a generic, fixed-length raw binary data buffer that can be shared between workers. They were disabled due to the Spectre side-channel vulnerability.

Added: Nov 30, 2025

327. Explain the purpose of the `COOP` and `COEP` headers.

Show Answer

Cross-Origin Opener Policy (COOP) and Cross-Origin Embedder Policy (COEP) are security headers used to enable cross-origin isolation, which is required for features like `SharedArrayBuffer` and high-resolution timers.

Added: Nov 30, 2025

328. What is the IndexedDB API?

Show Answer

A low-level API for client-side storage of significant amounts of structured data, including files/blobs, and supports transactions for reliability.

Added: Nov 30, 2025

329. What is the difference between `fetch` and `XMLHttpRequest`?

Show Answer

`fetch` is a modern, Promise-based API for making network requests, offering a cleaner syntax. `XMLHttpRequest` (XHR) is the older API, typically requiring callbacks for handling responses.

Added: Nov 30, 2025

330. Explain the difference between `Promise.resolve()` and simply returning a value from a `then()` block.

Show Answer

Returning a value from a `then()` block resolves the next Promise in the chain with that value. `Promise.resolve()` explicitly creates a new Promise that resolves with the given value.

Added: Nov 30, 2025

331. What is `Promise.race()`?

Show Answer

A Promise static method that returns a Promise that settles as soon as one of the promises in the input array settles (either resolves or rejects).

Added: Nov 30, 2025

332. What is the role of the V8 engine in Chrome and Node.js?

Show Answer

V8 is Google's open-source JavaScript engine that executes JavaScript code directly into machine code, including Just-In-Time (JIT) compilation.

Added: Nov 30, 2025

333. Explain Just-In-Time (JIT) compilation.

Show Answer

A compilation technique used by JavaScript engines where code is compiled into native machine code at runtime, immediately before execution, combining the speed of compiled code with the flexibility of interpretation.

Added: Nov 30, 2025

334. What is hidden class optimization in JavaScript engines?

Show Answer

An optimization technique used to speed up property access on objects by grouping objects with the same structure into a "hidden class," similar to static typing.

Added: Nov 30, 2025

335. How does garbage collection work in JavaScript?

Show Answer

It is an automatic memory management process (typically using a mark-and-sweep algorithm) that identifies and frees up memory that is no longer referenced by the program.

Added: Nov 30, 2025

336. What is the concept of a "memory leak" in JavaScript?

Show Answer

A situation where objects that are no longer needed by the application are still being referenced, preventing the garbage collector from freeing the memory they occupy.

Added: Nov 30, 2025

337. What is the purpose of the `Object.defineProperty()` method?

Show Answer

It allows you to define a new property or modify an existing property on an object and precisely control its characteristics (e.g., writability, enumerability, configurability).

Added: Nov 30, 2025

338. What are JavaScript iterators and iterables?

Show Answer

An iterable is an object that can be iterated over (e.g., Array, Map, String). An iterator is an object with a `next()` method that returns the next value in the sequence.

Added: Nov 30, 2025

339. Explain the use of the `Symbol.iterator` method.

Show Answer

A well-known Symbol that defines the default iterator for an object. It is called by `for...of` loops to get the iterator object.

Added: Nov 30, 2025

340. What is the purpose of the `Reflect` API?

Show Answer

A built-in object that provides methods for interceptable JavaScript operations, often used in conjunction with the `Proxy` object for metaprogramming.

Added: Nov 30, 2025

341. What is the difference between `element.setAttribute()` and `element.id = "value"`?

Show Answer

`element.setAttribute()` manipulates the element's HTML attribute. Direct property assignment (e.g., `element.id`) manipulates the DOM property, which is often faster and preferred.

Added: Nov 30, 2025

342. What is the purpose of the `MutationObserver`?

Show Answer

It allows developers to register callbacks that fire when changes occur to the DOM tree, such as element additions, removals, or attribute changes.

Added: Nov 30, 2025

343. What are Custom Events in JavaScript?

Show Answer

User-defined events created using `new CustomEvent()` that can carry custom data and be dispatched on elements, allowing for decoupled communication.

Added: Nov 30, 2025

344. What is the benefit of `addEventListener(type, listener, { once: true })`?

Show Answer

It ensures the event listener is automatically removed after it has been invoked once, preventing potential memory leaks and simplifying cleanup.

Added: Nov 30, 2025

345. How do you check if an object is an Array in JavaScript?

Show Answer

Using `Array.isArray(obj)` or `Object.prototype.toString.call(obj) === '[object Array]'`.

Added: Nov 30, 2025

346. What is the purpose of the `URLSearchParams` API?

Show Answer

It provides a utility for working with the query string of a URL (search parameters), making it easier to read, modify, and build complex query strings.

Added: Nov 30, 2025

347. What is `document.createDocumentFragment()` used for?

Show Answer

It is a lightweight container for DOM nodes that is not part of the main DOM tree. Using it to append multiple nodes improves performance by reducing reflows and repaints.

Added: Nov 30, 2025

348. What is the purpose of the `matchMedia` API?

Show Answer

It allows developers to test if a given CSS media query matches the current document, enabling JavaScript to react to screen size or device changes.

Added: Nov 30, 2025

349. How does `document.cookie` work?

Show Answer

It provides a string interface to get or set all cookies accessible by the current document. Setting it requires specifying the cookie name, value, and optionally, domain, path, and expiry.

Added: Nov 30, 2025

350. Explain the purpose of the `defer` attribute on a script tag.

Show Answer

It tells the browser to download the script in parallel, but execute it only after the document has been completely parsed, preserving the script execution order.

Added: Nov 30, 2025

351. What is the CSS `initial` keyword?

Show Answer

A value that resets a property to its initial (default) value, as specified by the CSS specification, overriding any inherited or explicit values.

Added: Nov 30, 2025

352. What is the CSS `unset` keyword?

Show Answer

A keyword that resets a property to its inherited value if the property is normally inherited, or to its initial value if it is not inherited.

Added: Nov 30, 2025

353. Explain the concept of `writing-mode` in CSS.

Show Answer

A property that defines whether text lines are laid out horizontally or vertically, and the direction in which successive lines are written (e.g., `vertical-rl`).

Added: Nov 30, 2025

354. What is the difference between `flex-basis` and `width` in a Flexbox container?

Show Answer

`width` sets the size regardless of the content. `flex-basis` sets the initial size of a flex item before the remaining space is distributed according to `flex-grow` and `flex-shrink`.

Added: Nov 30, 2025

355. What is the CSS property `contain` and its benefit?

Show Answer

It tells the browser that an element's subtree is independent, allowing for isolated layout, style, and paint calculations, significantly improving rendering performance.

Added: Nov 30, 2025

356. How do you target the language of an element in CSS?

Show Answer

Using the `:lang()` pseudo-class (e.g., `:lang(fr)`), which selects an element if its language is the same as the specified language in the `lang` attribute.

Added: Nov 30, 2025

357. What is the purpose of the `@layer` rule in CSS?

Show Answer

It allows developers to create explicit cascade layers, giving precise control over the specificity of styles and preventing issues caused by unpredictable selector competition.

Added: Nov 30, 2025

358. What is the CSS property `aspect-ratio`?

Show Answer

A property that defines the preferred aspect ratio for the box, which is used to calculate the dimensions of the box if no other dimensions are explicitly set.

Added: Nov 30, 2025

359. How does `scroll-snap` work in CSS?

Show Answer

It allows developers to define points where the scrolling container will land when the user finishes scrolling, creating a smooth, paginated experience.

Added: Nov 30, 2025

360. What is the purpose of the `::marker` pseudo-element?

Show Answer

It allows for styling of the bullet or number/symbol of a list item defined by `<li>` or elements with `display: list-item`.

Added: Nov 30, 2025

361. What is the difference between an `<a>` and a `<button>` semantically?

Show Answer

`<a>` is for navigation to a new resource or location. `<button>` is for actions, like submitting a form or triggering JavaScript functionality.

Added: Nov 30, 2025

362. Explain the purpose of the `role` attribute in ARIA.

Show Answer

It defines the purpose or expected behavior of an element (e.g., `role="button"`, `role="navigation"`), crucial for screen readers.

Added: Nov 30, 2025

363. What is the importance of using `<fieldset>` and `<legend>` in forms?

Show Answer

They group related form controls and provide an accessible caption for that group, improving structure and understanding for screen reader users.

Added: Nov 30, 2025

364. How do you indicate an input error accessibly?

Show Answer

By using `aria-invalid="true"` on the input and `aria-describedby` to link the input to an element containing the error message.

Added: Nov 30, 2025

365. What is the purpose of a skip link?

Show Answer

An invisible link at the top of a page that becomes visible on focus, allowing keyboard users to bypass large navigation sections and jump directly to the main content.

Added: Nov 30, 2025

366. Explain the concept of Web Vitals and why they matter.

Show Answer

A set of unified signals (LCP, FID, CLS) that are critical to delivering a great user experience on the web. They are used by Google for search ranking.

Added: Nov 30, 2025

367. What is First Input Delay (FID)?

Show Answer

A metric that measures the time from when a user first interacts with a page (e.g., clicks a button) to the time when the browser is actually able to begin processing event handlers.

Added: Nov 30, 2025

368. What is Cumulative Layout Shift (CLS)?

Show Answer

A metric that quantifies the amount of unexpected layout shift of visible page content, measured by combining size and distance of movement, aiming for a low score (near 0).

Added: Nov 30, 2025

369. How can you reduce render-blocking resources?

Show Answer

By inlining critical CSS, using the `async` or `defer` attributes on scripts, and using the `<link rel="preload">` hint for essential resources.

Added: Nov 30, 2025

370. What is the benefit of the `loading="lazy"` attribute on images?

Show Answer

It instructs the browser to defer loading of images until they are close to the viewport, improving initial page load time and saving bandwidth.

Added: Nov 30, 2025

371. Explain the concept of preconnect resource hint.

Show Answer

A hint that tells the browser to establish an early connection (DNS lookup, TCP handshake, TLS negotiation) to a third-party domain, saving time when a resource from that origin is requested later.

Added: Nov 30, 2025

372. What is the difference between `preload` and `prefetch`?

Show Answer

`preload` fetches a resource needed for the current page and gives it high priority. `prefetch` fetches a resource needed for a future navigation and gives it low priority.

Added: Nov 30, 2025

373. What is the PRPL pattern (Push, Render, Pre-cache, Lazy-load)?

Show Answer

A pattern for structuring and serving PWAs with instant loading: Push critical resources, Render initial route, Pre-cache remaining assets, Lazy-load non-critical routes/assets.

Added: Nov 30, 2025

374. What is the purpose of the `rel="canonical"` tag?

Show Answer

It tells search engines which URL is the preferred version of a page, used to prevent duplicate content issues in SEO.

Added: Nov 30, 2025

375. How do you measure server response time (TTFB)?

Show Answer

Time to First Byte (TTFB) is measured from when the request is sent until the first byte of the response is received by the client.

Added: Nov 30, 2025

376. What is the role of an HTTP status code 429?

Show Answer

429 Too Many Requests indicates that the user has sent too many requests in a given amount of time ("rate limiting").

Added: Nov 30, 2025

377. What is the `Expect-CT` header?

Show Answer

A security header that enables Certificate Transparency enforcement, requiring browsers to check for public logging of certificates to prevent misissuance.

Added: Nov 30, 2025

378. What is the `Referrer-Policy` header?

Show Answer

An HTTP header that governs which referrer information should be included with requests made from the document, controlling privacy levels.

Added: Nov 30, 2025

379. Explain the purpose of the `sandbox` attribute in an `<iframe>`.

Show Answer

It enables a set of extra restrictions on the content hosted in the frame, such as blocking script execution or preventing form submission, to mitigate security risks.

Added: Nov 30, 2025

380. What is a JSON Web Signature (JWS)?

Show Answer

A standard (similar to JWT) that represents content secured with digital signatures or Message Authentication Codes (MACs), ensuring the integrity and authenticity of the data.

Added: Nov 30, 2025

381. What is the difference between authentication and authorization?

Show Answer

Authentication is verifying *who* the user is (e.g., login). Authorization is determining *what* the user is allowed to do (access control).

Added: Nov 30, 2025

382. How does a Content Delivery Network (CDN) mitigate DDoS attacks?

Show Answer

CDNs distribute traffic across many geographically diverse servers, absorbing attack volume and filtering malicious traffic closer to the source.

Added: Nov 30, 2025

383. What is the `Upgrade-Insecure-Requests` header?

Show Answer

An HTTP header sent by the client to signal that the browser supports and wants to upgrade non-secure HTTP requests to secure HTTPS requests.

Added: Nov 30, 2025

384. Explain the concept of Certificate Revocation Lists (CRLs).

Show Answer

A list maintained by a Certificate Authority (CA) that contains serial numbers of certificates that have been revoked and should no longer be trusted.

Added: Nov 30, 2025

385. What is the purpose of the `SameSite=None` cookie attribute?

Show Answer

It allows cross-site requests to include the cookie, but it requires the cookie to also be marked as `Secure` (only sent over HTTPS).

Added: Nov 30, 2025

386. What is `gRPC` and how does it relate to web APIs?

Show Answer

A modern, high-performance, open-source framework for remote procedure calls, using HTTP/2 and Protocol Buffers for efficient, highly structured data transfer.

Added: Nov 30, 2025

387. What is the difference between SOAP and REST?

Show Answer

SOAP is a protocol based on XML that uses formal standards for messaging. REST is an architectural style based on standard HTTP methods and is typically lighter weight, often using JSON.

Added: Nov 30, 2025

388. Explain the term `statelessness` in REST.

Show Answer

It means that the server does not store any client context between requests; every request from the client must contain all information necessary to understand the request.

Added: Nov 30, 2025

389. What is an API consumer?

Show Answer

The client application (e.g., a mobile app, website, or script) that makes requests to and utilizes the services provided by an API.

Added: Nov 30, 2025

390. How is API rate limiting implemented?

Show Answer

By restricting the number of API calls a user can make within a specific time frame, typically tracked by IP address or API key.

Added: Nov 30, 2025

391. What is an API key and how is it used?

Show Answer

A unique string passed with a request (often in the URL or header) to identify the client application, used for authentication and tracking usage.

Added: Nov 30, 2025

392. Explain the purpose of API documentation (e.g., OpenAPI/Swagger).

Show Answer

It provides a standardized, machine-readable contract for an API, defining endpoints, parameters, and response formats, essential for consumer integration.

Added: Nov 30, 2025

393. What are asynchronous functions in Node.js?

Show Answer

Functions that do not block the execution thread, typically performing I/O operations (like database access or file reading) and returning a result via a callback or Promise.

Added: Nov 30, 2025

394. What is the purpose of the `package-lock.json` file?

Show Answer

It locks the dependencies to a specific version, ensuring that anyone installing the project receives the exact same versions of all dependencies, regardless of when they run `npm install`.

Added: Nov 30, 2025

395. What is the difference between `dependencies` and `devDependencies` in `package.json`?

Show Answer

`dependencies` are required for the application to run in production. `devDependencies` are only needed for development and testing (e.g., bundlers, testing frameworks).

Added: Nov 30, 2025

396. Explain Semantic Versioning (SemVer).

Show Answer

A standard (MAJOR.MINOR.PATCH) for version numbers: MAJOR for incompatible API changes, MINOR for new backward-compatible features, and PATCH for backward-compatible bug fixes.

Added: Nov 30, 2025

397. What is Transpilation (e.g., using Babel)?

Show Answer

The process of converting source code from one version of a language (e.g., ES6+) to another (e.g., ES5) so it can run on older browser environments.

Added: Nov 30, 2025

398. What is the purpose of a Linter (e.g., ESLint)?

Show Answer

A tool that analyzes source code to flag programming errors, bugs, stylistic errors, and suspicious constructs, enforcing code quality and consistency.

Added: Nov 30, 2025

399. What is the purpose of the `husky` package in Node.js?

Show Answer

It allows you to easily run Git hooks (scripts that run automatically before or after events like commit or push) to enforce coding standards or run tests.

Added: Nov 30, 2025

400. Explain the concept of a Headless Browser.

Show Answer

A web browser without a graphical user interface, often used for automated testing, web scraping, and server-side rendering without display overhead.

Added: Nov 30, 2025