Skip to content
tezvyn:

Top 30 Frontend Dev Concepts Quiz

30 multiple-choice questions on the Frontend Dev fundamentals, drawn from 30 bites in the Frontend Dev 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

    What is the primary advantage of Vue's progressive philosophy for a project starting small but potentially growing into a full SPA?

    Show the answer

    Answer: b · It enables developers to integrate only the necessary parts of its ecosystem, scaling functionality as needed.

    The progressive philosophy allows Vue to be adopted incrementally, starting with its core library for small enhancements and gradually integrating more of its ecosystem as the project's complexity grows. Option A is incorrect because Vue is designed to be less opinionated, offering flexibility rather than strict guidance from the outset.

    Read the full bite: Vue: The Progressive Framework Philosophy

  2. Question 2 of 30

    What is the main advantage of using type annotations in TypeScript?

    Show the answer

    Answer: d · They allow the TypeScript compiler to identify type errors during development.

    The card emphasizes that type annotations enable TypeScript to catch type mismatches during development, preventing bugs before runtime. They are erased during compilation and add no runtime overhead, meaning they do not perform runtime validation.

    Read the full bite: TypeScript Type Annotations: Defining Your Data's Shape

  3. Question 3 of 30

    What is the fundamental nature of a React Component?

    Show the answer

    Answer: d · A JavaScript function that returns a description of UI using JSX.

    The card explicitly states, "A React component is a JavaScript function that returns a piece of UI" and that it returns "JSX" to describe the UI. While components are analogous to custom HTML tags, their core implementation is a JavaScript function.

    Read the full bite: React Components: Your UI Building Blocks

  4. Question 4 of 30

    Which sequence correctly describes the CSS Cascade's tie-breaking process for style conflicts?

    Show the answer

    Answer: c · Origin and Importance, then Specificity, then Source Order

    The cascade first considers the rule's origin and importance (e.g., !important declarations). If still a tie, it then compares the specificity of the selectors. Finally, if all else is equal, the rule defined later in the code (source order) wins.

    Read the full bite: CSS Cascade: How Browsers Resolve Style Conflicts

  5. Question 5 of 30

    What is the fundamental nature of JSX in a React application?

    Show the answer

    Answer: d · It is a syntax extension that a build tool converts into standard JavaScript function calls.

    The card explains that JSX is a "syntax extension" that "gets compiled into plain JavaScript objects" by a "compiler (like Babel)" into "React.createElement() function calls." Option C is incorrect because the card explicitly states JSX is "not a string, nor is it HTML."

    Read the full bite: JSX: Putting HTML Inside Your JavaScript Components

  6. Question 6 of 30

    What is a key characteristic of Angular's 'batteries-included' philosophy?

    Show the answer

    Answer: b · It provides a complete, integrated toolkit, promoting consistency and reducing decision fatigue.

    Angular's 'batteries-included' approach means it provides a comprehensive, integrated toolkit for common needs like routing and forms, which promotes consistency and reduces decision fatigue. Option C is incorrect because Angular's opinionated nature limits flexibility in favor of integration and consistency.

    Read the full bite: Angular: The 'Batteries-Included' Framework

  7. Question 7 of 30

    When would a TypeScript tuple be the most appropriate choice compared to an array?

    Show the answer

    Answer: d · To represent a single point in 2D space, like [x-coordinate, y-coordinate].

    A tuple is ideal for fixed-length structures where the position and type of each element are important, such as a coordinate pair. An array is used for variable-length lists of elements of the same type, making options A, C, and D incorrect.

    Read the full bite: TypeScript's Basic Types: The Building Blocks

  8. Question 8 of 30

    An HTML div element has id="main" and class="active". Which CSS rule will apply its color?

    Show the answer

    Answer: c · div#main { color: red; }

    The rule div#main has a specificity score of 1-0-1 (one ID, one type selector), which is higher than #main (1-0-0), .active (0-1-0), and div.active (0-1-1) when comparing the scores from left to right. The ID column takes precedence over the class and type columns.

    Read the full bite: CSS Specificity: The Browser's Tie-Breaking Rule

  9. Question 9 of 30

    What is the primary benefit of Svelte's architecture as a compiler, rather than a traditional runtime framework?

    Show the answer

    Answer: a · It generates highly optimized, vanilla JavaScript during the build process, eliminating the need for a runtime library in the browser.

    The card emphasizes that Svelte shifts work from runtime to compile time, generating efficient vanilla JavaScript and avoiding a large runtime library, which leads to smaller bundles and improved performance. While Svelte does offer a declarative syntax (option C), this is a feature of many frameworks and not the primary benefit of its *compiler* architecture.

    Read the full bite: Svelte: A Compiler, Not Just a Framework

  10. Question 10 of 30

    Which statement accurately describes a core principle of how React components should handle props?

    Show the answer

    Answer: b · Props facilitate a one-way data flow, allowing data to be passed from parent to child components.

    The card states that props establish a 'clear, one-way data flow from parent components to child components.' This ensures predictability and reusability. Option A is incorrect because a component should never modify the props it receives; that's what state is for.

    Read the full bite: React Props: Arguments for Your Components

  11. Question 11 of 30

    An element has width: 200px, padding: 20px, and border: 5px. What is its final rendered width with box-sizing: content-box?

    Show the answer

    Answer: d · 250px

    With box-sizing: content-box, the specified width (200px) applies only to the content area. The padding (20px on each side) and border (5px on each side) are then added outside this content, resulting in a total width of 200 + (2*20) + (2*5) = 250px. Option A (200px) would be the result if box-sizing: border-box were used.

    Read the full bite: CSS Box Model: Every Element is a Box

  12. Question 12 of 30

    What is the primary advantage Angular gains by building upon TypeScript?

    Show the answer

    Answer: a · It provides static type checking and structural contracts, crucial for building large, maintainable, and error-resistant applications.

    The card states that TypeScript provides static type checking and structural guarantees, which are essential for Angular to build large, scalable, and maintainable applications by catching errors early. Option C is incorrect because while TS compiles to optimized JS, its primary benefit for Angular is not just runtime speed but compile-time safety and structure.

    Read the full bite: Why Angular Relies on TypeScript

  13. Question 13 of 30

    What is the main advantage of using a React Fragment (e.g., <></>) over a <div> when a component needs to return multiple elements?

    Show the answer

    Answer: d · Fragments prevent the addition of an unnecessary wrapper DOM node, maintaining cleaner HTML structure.

    React Fragments are designed to group multiple elements for React's internal processing without adding an extra DOM node to the final HTML, which is essential for valid HTML structures and avoiding unwanted styling issues. Fragments themselves do not add a DOM node, so they cannot have CSS classes or event listeners applied to them directly.

    Read the full bite: React Fragments: Group Elements Without a Wrapper

  14. Question 14 of 30

    Why do properties like width, margin, and padding typically not inherit in CSS?

    Show the answer

    Answer: a · Because inheriting them would often lead to broken layouts and unusable pages.

    The card explicitly states that properties like width, height, padding, margin, and border do not inherit because it would usually be undesirable, leading to unusable pages. The other options present plausible but incorrect reasons not mentioned in the card.

    Read the full bite: CSS Inheritance: Styles Flow Downhill

  15. Question 15 of 30

    What is the immediate effect when a useState setter function, like setCount(count + 1), is invoked?

    Show the answer

    Answer: c · React schedules a re-render of the component with the new state value.

    Calling a useState setter function tells React to schedule a re-render with the new state value, as stated by 'React schedules a re-render.' The 'count' variable in the current render's scope does not update immediately; this is a common 'footgun' where the new value is only available on the next render.

    Read the full bite: useState: Giving Components Memory

  16. Question 16 of 30

    A developer chooses Vue Single-File Components (SFCs) for a new application. What is the most significant implication regarding how their code will be processed for the browser?

    Show the answer

    Answer: c · A build tool will be necessary to compile the .vue files into standard JavaScript and CSS that browsers can execute.

    The card explicitly states that .vue files are not directly understood by browsers and require a build tool to compile them into standard JavaScript and CSS. Option D is incorrect because SFCs cannot be directly interpreted by browsers.

    Read the full bite: Vue Single-File Components (SFCs)

  17. Question 17 of 30

    According to the card, what is a key reason to prefer class selectors over ID selectors when styling reusable UI components?

    Show the answer

    Answer: a · Class selectors have lower specificity, making their styles easier to override and promoting reusability.

    The card explicitly states that ID selectors' "high specificity makes them difficult to override and reduces reusability," while recommending class selectors for "reusable components." Option C is true but does not explain the core reason for preference in terms of styling management.

    Read the full bite: CSS Selectors: How to Target HTML for Styling

  18. Question 18 of 30

    Why might you explicitly annotate the type of an array like "let items: Animal[] = [new Rhino(), new Elephant()];" instead of letting TypeScript infer it?

    Show the answer

    Answer: b · To allow the array to store any Animal subtype, not just the specific types present at initialization.

    The card explains that TypeScript infers a 'best common type' like (Rhino | Elephant)[] for such an array. Explicitly annotating as Animal[] allows the array to hold any Animal subtype, which is a more general type than the inferred union. Option C is incorrect because the inferred type would already restrict it to Rhino or Elephant, while explicit annotation to Animal[] broadens it.

    Read the full bite: TypeScript Type Inference: How It Knows Without Being Told

  19. Question 19 of 30

    What is the primary issue with using `onClick={myFunction()}` instead of `onClick={myFunction}` in a React component?

    Show the answer

    Answer: c · It executes `myFunction` immediately during the component's render phase, not when the user clicks.

    The card explicitly states that `onClick={handleClick()}` is incorrect because "The parentheses () execute the function immediately during the component's render phase." This means the function runs when the component is drawn, not when the user interacts with it. Option D is incorrect because it's a logical error, not a syntax error.

    Read the full bite: React Events: Pass, Don't Call

  20. Question 20 of 30

    Which CSS display value allows an element to flow horizontally with surrounding text while still permitting explicit control over its width and height?

    Show the answer

    Answer: d · inline-block

    Inline-block elements combine the characteristics of inline elements by flowing horizontally with text, and block elements by allowing explicit width, height, and vertical margin/padding. Inline elements flow horizontally but ignore width/height, while block elements take a new line.

    Read the full bite: CSS 'display': How Elements Occupy Space

  21. Question 21 of 30

    Before narrowing, what operations are permitted on a variable declared with a Union Type (e.g., string | number)?

    Show the answer

    Answer: a · Only operations that are common to both the string and number types.

    The card states, "When you have a value of this union type, TypeScript only allows you to perform operations that are valid for every member type." This means you can only use properties or methods common to all types in the union until you explicitly narrow the type using runtime checks. Option C is incorrect because TypeScript prevents operations specific to one type (e.g., string methods on a string | number) without narrowing, as the value might be the other type.

    Read the full bite: Union Types: When a Value Can Be One of Several Things

  22. Question 22 of 30

    When a service is provided within a specific component's providers array, what is the primary outcome?

    Show the answer

    Answer: d · A new instance of the service is created for that component and its descendants, isolated to that part of the UI.

    Providing a service at the component level creates a new instance of that service, scoped to that component and its children, allowing for isolated state within a UI branch. This differs from `providedIn: 'root'`, which creates an application-wide singleton.

    Read the full bite: Angular's Hierarchical Dependency Injection

  23. Question 23 of 30

    You set two elements to "width: 50%" and add "padding: 10px". To guarantee they fit side-by-side without wrapping, which box-sizing value is best?

    Show the answer

    Answer: c · border-box, as it includes padding within the element's declared width.

    With border-box, the element's declared width (50%) includes its padding, ensuring it occupies exactly 50% of the parent's space. content-box, the default, would add the padding outside the 50% width, making each element wider than 50% and causing them to wrap.

    Read the full bite: CSS box-sizing: Predictable Element Sizing

  24. Question 24 of 30

    How does Svelte fundamentally differ from Virtual DOM-based frameworks in its approach to updating the user interface?

    Show the answer

    Answer: d · Svelte compiles components into vanilla JavaScript that directly modifies the DOM based on state changes, eliminating runtime diffing.

    Svelte is a compiler that generates highly optimized JavaScript to directly update the DOM when state changes, completely bypassing the Virtual DOM and its runtime diffing process. Option B is incorrect because Svelte eliminates the VDOM entirely, it doesn't optimize it.

    Read the full bite: Why Svelte Skips the Virtual DOM

  25. Question 25 of 30

    When using the logical AND operator (condition && <Component />) for conditional rendering in React, what is a crucial behavior to be aware of?

    Show the answer

    Answer: d · If 'condition' evaluates to 0, the number 0 might be displayed in the UI.

    The card explicitly mentions this as a 'footgun': if 'condition' is the number 0, the expression '0 && <Component />' evaluates to 0, which React will render. Option C is incorrect because JavaScript's logical AND operator works with any truthy or falsy value, not just strict booleans.

    Read the full bite: Conditional Rendering: Show UI Based on State

  26. Question 26 of 30

    When an object is assigned to a TypeScript interface, what happens if the object contains properties not defined in the interface?

    Show the answer

    Answer: d · The assignment is valid, provided all properties required by the interface are present.

    TypeScript interfaces use structural typing, meaning an object only needs to have the properties specified by the interface to be considered compatible. Extra properties are allowed and do not cause a type error, as long as the required contract is fulfilled. Option A is incorrect because TypeScript does not enforce an exact match; it only checks for the presence of required properties.

    Read the full bite: TypeScript Interfaces: Naming the Shape of Your Data

  27. Question 27 of 30

    When developing a complex Vue component with intertwined logic for a single feature (e.g., data fetching and its related states), which API is generally preferred and why?

    Show the answer

    Answer: a · Composition API, because it enables grouping all related logic for a feature together, enhancing co-location and reusability.

    The Composition API is preferred for complex components because it allows grouping all related logic for a specific feature, like data fetching and its states, in one place, improving co-location and reusability. The Options API, conversely, tends to scatter such related logic across different sections (data, methods, mounted), making complex components harder to manage and debug.

    Read the full bite: Vue: Options API vs. Composition API

  28. Question 28 of 30

    When rendering a dynamic list, what problem does the key prop solve if items are later reordered or filtered?

    Show the answer

    Answer: b · It provides a stable identifier so React can distinguish individual elements as the collection changes

    The key acts as a stable name tag so React can tell one output from another when items shift, disappear, or join the line. Preventing console warnings is only a side effect of adding keys, not their core purpose.

    Read the full bite: Lists and Keys in React

  29. Question 29 of 30

    What is the primary role of a CSS pseudo-class?

    Show the answer

    Answer: d · To define styles that activate when an element is in a particular state or position, like being hovered over.

    Pseudo-classes are designed to style elements based on their temporary state or structural position, such as when a user hovers over them or when an input is invalid. Option B describes pseudo-elements, which style specific parts of an element, a key distinction mentioned in the card.

    Read the full bite: CSS Pseudo-classes: Style Elements Based on State

  30. Question 30 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

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