Skip to content
tezvyn:

Top 30 Advanced Frontend Dev Concepts Quiz

30 advanced multiple-choice Frontend Dev concept questions, the corners that separate having used it from understanding it: internals, edge cases, and the reasons behind the design. They come from 30 bites in the Frontend Dev library, the hardest slice of the 588 Frontend Dev concept questions in the library. Answer them here or read straight down. Every question carries the correct option, why it is correct, and a link to the bite it came from.

Frontend web development and UI engineering

30 questions. Pick an answer, or open “Show the answer” to read it.

Answers are graded in your browser. Nothing is saved, and no XP or streak is earned here. The app keeps score.

  1. Question 1 of 30

    How does Vue's reactivity system primarily ensure UI components update automatically with data changes?

    Show the answer

    Answer: b · It wraps data objects in JavaScript Proxies to intercept property access and modification, triggering updates when changes occur.

    Vue's reactivity system uses JavaScript Proxies to wrap data, intercepting 'get' operations to track dependencies and 'set' operations to notify subscribers for updates. Option A describes a polling mechanism, which is not how Vue's event-driven reactivity works.

    Read the full bite: Vue's Reactivity: JavaScript That Acts Like a Spreadsheet

  2. Question 2 of 30

    What is a direct consequence of CSS pseudo-elements not being part of the standard Document Object Model (DOM)?

    Show the answer

    Answer: c · They cannot be directly selected or manipulated by JavaScript.

    The card states, "You cannot attach JavaScript event listeners to them, as they are not in the DOM," directly linking their non-DOM status to JavaScript manipulation limitations. Distractor C is incorrect because the card mentions their styles are dynamic, adapting to layout changes.

    Read the full bite: CSS Pseudo-elements: Styling Parts of an Element

  3. Question 3 of 30

    What is a key difference in how TypeScript's default numeric enums and string enums behave at runtime?

    Show the answer

    Answer: d · Numeric enums create a reverse mapping from their values back to their names, a feature not generated by string enums.

    The card states that numeric enums create a reverse mapping in the compiled JavaScript, allowing lookup of a member name by its value, a feature string enums do not have. Option B is incorrect because numeric enums do incur additional runtime overhead for this reverse mapping, unlike string enums which result in simpler compiled code.

    Read the full bite: TypeScript Enums: Named Constants for Clarity

  4. Question 4 of 30

    For which use case are TypeScript literal types most effectively applied?

    Show the answer

    Answer: b · Defining a set of specific, allowed string values for a function parameter.

    Literal types are designed to specify exact values, making them ideal for scenarios where a variable or parameter must accept one of a few predefined options, as described in option B. They are explicitly not for dynamic or broad values, which would make options A, C, and D incorrect.

    Read the full bite: Literal Types: Be More Specific Than `string`

  5. Question 5 of 30

    In a React component, for which scenario would using a ref be the most appropriate choice over state?

    Show the answer

    Answer: a · Holding an interval ID returned by setInterval that needs to be cleared later.

    Refs are ideal for storing mutable values that persist across renders without triggering UI updates, such as an interval ID that is never displayed. Options A, C, and D all involve data that directly affects the UI, requiring state to ensure re-renders when the values change.

    Read the full bite: React Refs: Memory Without Re-renders

  6. Question 6 of 30

    Why might an element with z-index: 9999 still appear behind another element with z-index: 10?

    Show the answer

    Answer: d · The element with z-index: 9999 is a descendant of an element that established a new stacking context, which itself is stacked below the z-index: 10 element.

    A new stacking context traps its descendants, meaning they can only stack relative to each other within that context. If the element creating this context is itself stacked below another element (like the z-index: 10 element), its children, regardless of their high z-index, cannot escape to appear above it. Option C is incorrect because while transform creates a stacking context, it doesn't automatically elevate its stacking order above all others; its position is still relative to its parent's context.

    Read the full bite: CSS Stacking Contexts: The Z-Axis Explained

  7. Question 7 of 30

    When creating a WelcomeDialog component that uses a generic Dialog component to display a fixed title and message, which approach best exemplifies React's "favor composition" principle?

    Show the answer

    Answer: b · WelcomeDialog renders the Dialog component internally, passing it specific title and message props.

    The card states that for specialization, a more specific component simply renders a more generic one and configures it with props, as exemplified by WelcomeDialog rendering Dialog. Option C uses class inheritance, which the card explicitly advises against for UI component hierarchies.

    Read the full bite: React's Rule: Favor Composition Over Inheritance

  8. Question 8 of 30

    Which common layout issue involving a parent container and its floated child elements is directly resolved by establishing a Block Formatting Context (BFC) on the parent?

    Show the answer

    Answer: d · The parent container's background or border failing to expand and enclose its floated children.

    The card explicitly states that a primary use of BFC is to 'contain floats' and gives an example where a parent's border fails to wrap a floated image, which a BFC fixes. While BFCs also prevent margin collapse (Option B), the question specifically asks about issues involving 'parent container and its floated child elements', making float containment the most direct answer.

    Read the full bite: Block Formatting Context: Taming Floats and Margins

  9. Question 9 of 30

    Which CSS property, applied to an ancestor with `position: static`, would establish it as the containing block for a `position: absolute` child?

    Show the answer

    Answer: c · transform

    The card states that for absolute elements, an ancestor with properties like `transform`, `filter`, or `perspective` will become the containing block, even if its own `position` is `static`. While `position: relative` does create a containing block, it requires the ancestor's position to be non-static, which contradicts the question's premise.

    Read the full bite: CSS Containing Block: The Box That Defines Your Box

  10. Question 10 of 30

    When is Vite's low-level SSR API the most appropriate choice for a project?

    Show the answer

    Answer: b · When building a custom SSR framework or requiring unique server-side rendering control beyond existing plugins.

    The low-level SSR API is designed for advanced scenarios like framework development or highly custom server environments, offering full control. It is explicitly advised against for standard applications using popular frameworks, which should leverage higher-level SSR plugins.

    Read the full bite: Vite's Low-Level SSR API

  11. Question 11 of 30

    Which task is the most appropriate use case for a SvelteKit server hook?

    Show the answer

    Answer: b · Initializing a database connection pool that is shared across all server-side requests.

    The card explicitly states that "startup behavior (code at the top level of a hooks file) is ideal for initializing singletons like a database connection pool." This makes initializing a shared resource like a DB pool a primary use case for server hooks. While hooks can handle custom routing (like option A), defining standard API endpoints is typically done using dedicated +server.js files, whereas hooks are more for intercepting and modifying requests or handling non-standard routing.

    Read the full bite: SvelteKit Hooks: Intercepting Requests and Events

  12. Question 12 of 30

    Which pair of issues does Vite's dependency pre-bundling primarily resolve to enhance development server performance?

    Show the answer

    Answer: a · Converting CommonJS modules to browser-native ESM and consolidating packages with many files into single requests.

    Vite's pre-bundling specifically converts CommonJS modules into browser-native ESM and merges multi-file packages into single requests, directly addressing browser limitations that slow down development. Distractors describe production optimizations or general build features not specific to pre-bundling's core purpose.

    Read the full bite: Vite's Dependency Pre-Bundling

  13. Question 13 of 30

    When a useEffect with an empty dependency array sets up a setInterval that needs to log the latest component state, what is the primary benefit of using useEffectEvent?

    Show the answer

    Answer: d · It enables the setInterval's callback to access the most current state without forcing the useEffect to re-execute.

    useEffectEvent provides a stable function that, when called, always accesses the latest props and state from the component's current render, even if the useEffect it's called from has an empty dependency array and thus doesn't re-run. This directly solves the stale closure problem. Option B describes the stale closure problem itself, not the benefit of the solution. Option A describes the behavior of an empty dependency array, not the specific benefit of useEffectEvent. Option C is incorrect as useEffectEvent is used to avoid adding functions to the dependency array.

    Read the full bite: React's Stale Closure Problem in Hooks

  14. Question 14 of 30

    A developer needs to implement a responsive design that dynamically adjusts font weight and width across various screen sizes while minimizing HTTP requests. Which approach is most effective?

    Show the answer

    Answer: d · Using a single variable font file that defines multiple variation axes.

    Variable fonts allow a single file to contain all variations along axes like weight and width, enabling fine-grained adjustments via CSS without multiple HTTP requests, which is ideal for responsive design and performance. Loading separate static files (Option C) would increase HTTP requests and download size, directly contradicting the goal of minimizing requests.

    Read the full bite: Variable Fonts: One File, Infinite Styles

  15. Question 15 of 30

    When is useLayoutEffect the most appropriate choice over useEffect?

    Show the answer

    Answer: d · To measure a DOM element's dimensions and update its position before the user sees any intermediate layout.

    useLayoutEffect is specifically designed for scenarios where you need to read DOM layout and make synchronous updates to prevent visual flickers before the browser paints. Option D directly describes this primary use case. Option C describes useEffect, which runs asynchronously after the browser has painted.

    Read the full bite: useLayoutEffect: Synchronous Effects Before Browser Paint

  16. Question 16 of 30

    How does the History API enable single-page applications to correctly respond when a user navigates with the browser's back or forward buttons?

    Show the answer

    Answer: d · It triggers a popstate event on the window, allowing the application to retrieve the associated stateObject and update its view.

    When a user clicks back or forward, the browser fires a popstate event, which the application must listen for to retrieve the stateObject and render the appropriate view. The browser does not automatically re-render the DOM; the application is responsible for updating the UI.

    Read the full bite: History API: Change URLs Without Page Reloads

  17. Question 17 of 30

    Which scenario best illustrates the primary purpose of useImperativeHandle?

    Show the answer

    Answer: c · A parent component needs to call a specific method on a child, like focus() or reset(), without exposing the child's entire DOM node.

    Option C is correct because useImperativeHandle allows a child to expose a limited, intentional API (like specific methods) to a parent via a ref, preventing the parent from accessing the child's full internal DOM or state. Option B describes an anti-pattern that useImperativeHandle is designed to prevent, as it breaks encapsulation and top-down data flow.

    Read the full bite: useImperativeHandle: Expose a Custom Ref API

  18. Question 18 of 30

    When should filter: drop-shadow() be chosen over box-shadow for applying a shadow effect?

    Show the answer

    Answer: c · To apply a shadow that conforms to the irregular shape of an element's content.

    The card states that filter: drop-shadow() is "the best way to apply a shadow to a non-rectangular shape (like a transparent PNG or an SVG)". While filter is hardware-accelerated, the card also advises that box-shadow is more direct and often more performant for simple rectangular shadows, making option B incorrect as a general preference.

    Read the full bite: CSS Filter: Photoshop-like Effects in the Browser

  19. Question 19 of 30

    Which CSS property is most appropriate for combining multiple background gradients and applying a color tint to a background image within a single element?

    Show the answer

    Answer: a · background-blend-mode

    background-blend-mode is specifically designed for blending multiple background layers (like gradients or images) within a single element, and for applying effects like color tints to background images. mix-blend-mode, while also a blend mode, blends an entire element with the content behind it in the stacking context, not its own background layers.

    Read the full bite: CSS Blend Modes: Photoshop Effects in the Browser

  20. Question 20 of 30

    When an element has a clip-path applied, how does it interact with the document flow and surrounding elements?

    Show the answer

    Answer: b · The element's original rectangular box is preserved in the document flow, and surrounding elements behave as if the clipped parts are still present.

    The card explicitly states that "clip-path only hides parts of the element visually; it does not change the element's underlying rectangular shape in the document flow. Other elements will not wrap around your custom shape." This means the element continues to occupy its original rectangular space in the layout. Option D describes a common misconception, as clip-path does not alter the element's box model for layout purposes.

    Read the full bite: CSS clip-path: Break Out of the Box

  21. Question 21 of 30

    Which statement correctly describes the primary function of backdrop-filter in CSS?

    Show the answer

    Answer: c · It applies graphical effects to the content behind an element, requiring the element itself to be semi-transparent.

    backdrop-filter is designed to apply effects to the content *behind* an element, acting like frosted glass, and requires the element to have some transparency to reveal the filtered background. It does not filter the element itself; that is the role of the standard 'filter' property.

    Read the full bite: backdrop-filter: Styling What's Behind an Element

  22. Question 22 of 30

    When would you primarily use Svelte slot props?

    Show the answer

    Answer: d · To enable a generic child component to provide data for each item, letting the parent customize the rendering of those items.

    Slot props allow a child component to pass its internal data up to the parent for custom rendering, enabling the parent to control the presentation of items managed by the child. Option A describes the inverse control flow, where the child defines rendering and the parent supplies data, which is not the primary purpose of slot props.

    Read the full bite: Svelte Slot Props: Child Informs, Parent Renders

  23. Question 23 of 30

    Which scenario represents an anti-pattern when utilizing Angular's ViewEncapsulation.None?

    Show the answer

    Answer: d · Overriding the default styles of a child component directly from its parent component.

    The card explicitly states, "Do not use ViewEncapsulation.None to override a child component's styles from a parent. This is an anti-pattern." Option C describes a valid, albeit sparing, use case for None. Options C and D relate to considerations for ShadowDom encapsulation, not None.

    Read the full bite: Angular View Encapsulation: Walling Off Your Component Styles

  24. Question 24 of 30

    Which scenario is the most appropriate use case for Angular's dynamic component loading?

    Show the answer

    Answer: a · Implementing a flexible modal dialog service capable of showing different component types.

    Dynamic component loading is ideal for highly dynamic UIs where component types are unknown until runtime, such as a generic modal service displaying various components. Options A and B describe scenarios best handled by Angular's declarative @if and @for directives, respectively, which are explicitly mentioned as cases not to use dynamic loading. Option D refers to route-based lazy loading, a different optimization technique.

    Read the full bite: Angular: Dynamic Component Loading

  25. Question 25 of 30

    How does useTransition primarily ensure a responsive UI when handling a slow state update?

    Show the answer

    Answer: d · By allowing urgent user interactions to render immediately while the slow update proceeds in a lower-priority lane.

    useTransition creates two rendering lanes: an urgent lane for immediate feedback and a non-urgent 'transition' lane for slower updates, allowing the UI to remain interactive. Option A is incorrect because useTransition manages priority on the main thread, it does not move work to a separate background thread.

    Read the full bite: useTransition: Keep Your UI Responsive During State Changes

  26. Question 26 of 30

    Which best describes how useDeferredValue maintains UI responsiveness during an expensive update?

    Show the answer

    Answer: d · It first renders with the previous deferred value at high priority, then with the new value at low priority.

    Option D correctly describes the mechanism: React performs an immediate, high-priority render with the old deferred value to keep the UI snappy, then schedules a low-priority, interruptible render with the new value. Option A describes debouncing, which the card explicitly states useDeferredValue is not a replacement for.

    Read the full bite: useDeferredValue: Keep UI Responsive During Renders

  27. Question 27 of 30

    What critical characteristic must the getSnapshot function in useSyncExternalStore possess to ensure correct behavior and prevent issues like tearing?

    Show the answer

    Answer: d · It must return an immutable, cached value for React's comparison.

    The card states that "your getSnapshot function must return an immutable, cached value." This is crucial because React uses Object.is to compare the returned value, and a stable, cached reference allows React to efficiently determine if a re-render is truly necessary. Option C is incorrect because returning a new reference unnecessarily would cause React to re-render even if the underlying data hasn't logically changed, defeating the purpose of the comparison.

    Read the full bite: useSyncExternalStore: Safely Read from External State

  28. Question 28 of 30

    What is the most significant problem that TypeScript Conditional Types are designed to solve in generic programming?

    Show the answer

    Answer: b · Enabling a single generic function to have a return type that adapts based on its input type, reducing the need for multiple overloads.

    The card highlights that conditional types are used to model the relationship between input and output types, specifically to avoid an 'explosion of function overloads' by allowing a single generic function's return type to be dynamic. Option D is incorrect because conditional types are a compile-time construct, not a runtime mechanism for type changes.

    Read the full bite: Conditional Types: Ternary Logic for Your Types

  29. Question 29 of 30

    What is the most significant advantage of using TypeScript template literal types?

    Show the answer

    Answer: a · Programmatically generating a finite set of related string literal types to enhance type safety.

    Template literal types are designed to programmatically create new string literal types at compile time, ensuring type safety for related string patterns like event names or i18n keys. They do not create dynamic string values at runtime; that's a JavaScript feature.

    Read the full bite: TypeScript: Build New String Types with Template Literals

  30. Question 30 of 30

    For which primary purpose is useDebugValue most effectively utilized in a custom React hook?

    Show the answer

    Answer: d · To display a meaningful, human-readable label for the hook's state in React DevTools, especially for complex shared library hooks.

    useDebugValue's core purpose is to provide a custom, more meaningful representation of a hook's state in React DevTools, aiding debugging for complex or shared library hooks. It does not affect application logic or runtime performance; its optional formatting function only optimizes DevTools display performance.

    Read the full bite: useDebugValue: Label Your Custom Hooks in DevTools

Could you explain these out loud?

That is what an interview actually tests. Tezvyn gives you questions like these with what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon