Skip to content
tezvyn:

Top 30 Forms Interview Questions and Answers

30 multiple-choice questions on Forms, drawn from 30 bites out of the 56 tagged Forms on Tezvyn. 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.

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

    Why is Angular v22's stabilization of Signal Forms, Angular Aria, and Asynchronous Reactivity APIs considered more significant than a routine version bump for large teams?

    Show the answer

    Answer: a · It provides production-ready primitives that reduce custom accessibility work and create clear migration targets away from legacy reactive forms

    Stabilization means these APIs are now maintained long-term and safe to adopt, giving teams a clear path away from legacy reactive forms while reducing custom accessibility boilerplate. Distractor B is tempting because stable APIs imply safety, but the card emphasizes future maintenance and reduced risk, not that every preview API remained unchanged.

    Read the full bite: Angular v22 stabilizes Signal Forms, Aria, Asynchronous Reactivity APIs

  2. Question 2 of 30

    Which pattern correctly wires a text input as a controlled component using useState?

    Show the answer

    Answer: a · Initialize useState with an empty string at the top level, bind the input value to the state variable, and update it via onChange by calling the setter with event.target.value.

    The correct pattern requires calling useState at the top level with an empty string, binding the input value to state, and updating via the setter in onChange. Option C is tempting because it mentions binding value, but calling useState conditionally violates the Rules of Hooks and direct mutation prevents React from re-rendering.

    Read the full bite: How do you use useState to track user input?

  3. Question 3 of 30

    A developer sets the value prop on a TextInput but forgets to handle onChangeText. What happens when the user types?

    Show the answer

    Answer: c · The field appears frozen because state never updates, so value keeps overriding each keystroke

    With value bound to unchanging state and no onChangeText to update it, every keystroke is immediately overwritten by the stale state, so the input looks frozen. This is the classic controlled-input mistake, not a thrown error.

    Read the full bite: Controlled TextInput with value and onChangeText

  4. Question 4 of 30

    Using a single state object for a form, what is the correct way to update just the email field on change?

    Show the answer

    Answer: a · Call setForm(prev => spreading prev and overriding email) to preserve other fields immutably

    Spreading the previous state and overriding only email keeps the other fields intact while updating immutably. Mutating directly skips proper re-renders, and replacing state with just the email key discards name and password.

    Read the full bite: Single useState object for multi-input forms

  5. Question 5 of 30

    What is the recommended approach for managing user input in a React Native TextInput?

    Show the answer

    Answer: c · Set the value prop to a state variable and update it via the onChangeText callback.

    The card emphasizes treating TextInput as a controlled component, where the app's state is the single source of truth, updated by onChangeText and reflected by the value prop. Option B describes an uncontrolled component, which is not the recommended mental model for TextInput.

    Read the full bite: React Native TextInput: Handling User Input

  6. Question 6 of 30

    Why is keyboardShouldPersistTaps set to handled often preferred for a form inside a ScrollView?

    Show the answer

    Answer: d · It keeps the keyboard up when a child handles the tap, so buttons respond on the first tap, but dismisses it on background taps

    The handled value passes taps to children that handle them while still dismissing the keyboard on empty taps, fixing the two-tap button problem. keyboardDismissMode is a separate prop for dismissal during scrolling, not the same thing.

    Read the full bite: keyboardShouldPersistTaps in ScrollView

  7. Question 7 of 30

    To keep a composed SearchForm reusable, where should the actual search/fetch logic live?

    Show the answer

    Answer: c · In the parent, triggered by an onSearch event SearchForm emits on submit

    Keeping SearchForm presentational and emitting onSearch lets each parent decide what to do with the query, maximizing reuse. Hardcoding the fetch inside the form or button couples it to one use case.

    Read the full bite: Composing Input and Button into a SearchForm

  8. Question 8 of 30

    Which scenario best illustrates a situation where a React controlled component is the most appropriate choice?

    Show the answer

    Answer: b · Creating a search bar that provides real-time suggestions as the user types.

    A search bar with live suggestions requires the input's value to be constantly monitored and updated in React state to trigger suggestion fetching and rendering, which is a key characteristic of controlled components. A basic form only needing values on submission is a prime use case for uncontrolled components, as React doesn't need to manage the input's state continuously.

    Read the full bite: React's Controlled vs. Uncontrolled Components

  9. Question 9 of 30

    How does a self-registering Field pattern keep the Form decoupled from the specific fields used inside it?

    Show the answer

    Answer: b · Fields register themselves by name into shared context, so the Form never enumerates them

    Self-registration lets the Form coordinate validation and submission over whatever fields registered, with no hardcoded list. Enumerating fields or centralizing all rules in the Form recreates the coupling you want to avoid.

    Read the full bite: Decoupling Form state from its Field components

  10. Question 10 of 30

    How does a React Native Slider typically update and display its current selected value?

    Show the answer

    Answer: d · The onValueChange callback updates a state variable, and this state variable is then passed back to the slider's value prop.

    The card explicitly states that the onValueChange callback must be used to update your component's state, which then re-renders the slider with its new value, making it a controlled component. Option A is a common misconception, as forgetting to update state is described as a 'footgun' and the slider does not manage its own state automatically.

    Read the full bite: React Native Slider: Selecting a Value from a Range

  11. Question 11 of 30

    For which type of user interaction is a wizard/stepper pattern most appropriate?

    Show the answer

    Answer: b · A complex online application where later steps depend on information from earlier steps.

    The card specifies that steppers are best used when a task has several logically distinct steps, especially when input from one step is required for the next. Option C describes a long form, which steppers aim to break down, but specifies "on one page" and "independent," which doesn't fully align with the primary use case of sequential dependency.

    Read the full bite: Wizard/Stepper Pattern: Guide Users Through Complex Tasks

  12. Question 12 of 30

    For a standard text input element, which underlying property binding and event listener pair does Vue's v-model typically abstract?

    Show the answer

    Answer: c · v-bind:value and @input

    The card states that for text inputs, v-model becomes :value and @input, binding the input's value and listening for immediate changes. Option D is a common distractor because @change is used for some form elements, but @input is specific to text inputs for real-time updates.

    Read the full bite: Vue's v-model: Two-Way Binding Made Simple

  13. Question 13 of 30

    Which Angular approach is best for quickly synchronizing a simple form input with a component property, ensuring immediate updates in both directions?

    Show the answer

    Answer: b · Applying two-way data binding with [(ngModel)].

    The card states that [(ngModel)] is "perfect for things like settings toggles, search bars, or basic data entry fields in a prototype or a small, self-contained component" because it automates the synchronization. While separate property and event binding (Option A) can achieve two-way flow, [(ngModel)] is the concise, direct solution for simple scenarios.

    Read the full bite: Angular Two-Way Binding: [(ngModel)]

  14. Question 14 of 30

    What is a critical prerequisite for FastAPI to correctly parse incoming `Form` data?

    Show the answer

    Answer: d · Installing the python-multipart library.

    The card explicitly states that 'you must pip install python-multipart' and that forgetting it 'will break form parsing.' While Pydantic models are central to FastAPI, for Form data, you declare individual fields with `Form()`, not a top-level Pydantic model for the body. The client must send `application/x-www-form-urlencoded`, not `application/json`.

    Read the full bite: FastAPI: Handling Form Data, Not Just JSON

  15. Question 15 of 30

    Which statement correctly describes a trade-off of uncontrolled React inputs?

    Show the answer

    Answer: b · They avoid re-renders but hide the value from React until explicitly read

    Uncontrolled inputs store value in the DOM, so React cannot react to changes until the value is explicitly read from a ref, which sacrifices live validation for less boilerplate. Distractor B is tempting because refs are indeed used with uncontrolled inputs, but live validation is impossible because React has no visibility into the keystrokes.

    Read the full bite: Explain controlled vs uncontrolled React form inputs and trade-offs

  16. Question 16 of 30

    In Flutter, when will a TextFormField inside a Form display the error text returned by its validator?

    Show the answer

    Answer: b · Only after formKey.currentState.validate() is explicitly called

    Calling validate() on the FormState walks the form tree and executes each registered validator, rendering any returned string as inline error text. A is tempting because beginners often assume onChanged triggers validation, but keystrokes alone do not run the validator.

    Read the full bite: Explain the validator property in TextFormField and what triggers error display

  17. Question 17 of 30

    Which set of practices best represents the idiomatic React approach when building a basic controlled form that submits without reloading the page?

    Show the answer

    Answer: c · Attach onSubmit to the form, call preventDefault, bind each input to useState, and read the values from state in the handler.

    Option C is correct because it combines semantic onSubmit for accessibility, preventDefault to stop page reload, and controlled state as the single source of truth. Option A is tempting because useRef offers direct DOM access, but that signals an imperative jQuery-like mindset that bypasses React's rendering cycle.

    Read the full bite: How do you handle a basic form submission in React?

  18. Question 18 of 30

    When implementing a login form with Flutter's Form widget, which statement accurately describes the validation flow?

    Show the answer

    Answer: d · Wrap TextFormField widgets in a Form assigned a GlobalKey<FormState>, then call key.currentState.validate() in the submit handler to aggregate all validator results.

    Option D is correct because GlobalKey<FormState> exposes the validate() method that aggregates every descendant TextFormField validator and rebuilds error labels, and it is meant to be called on submission. Option C is tempting because it names the right widgets and method, but GlobalKey<Form> is the wrong generic type and does not provide access to validate().

    Read the full bite: Build and validate a login form with Form and GlobalKey

  19. Question 19 of 30

    Which scenario most clearly justifies using useReducer instead of useState for React form state?

    Show the answer

    Answer: c · A multi-step wizard where country selection changes provinces, enables VAT, and triggers async tax lookups

    The wizard's cascading interdependencies and async transitions are best centralized in a pure reducer; option D describes coupled fields appropriately managed by a single object with useState, not useReducer.

    Read the full bite: Prefer multiple useState or useReducer for multi-field forms?

  20. Question 20 of 30

    Why is documenting focus order in Figma important even when the visual layout already looks logical?

    Show the answer

    Answer: c · CSS positioning can desync visual order from DOM order, so source order must be specified

    Because CSS can reorder elements visually without changing DOM order, designers must document the intended source order so keyboard and screen-reader traversal stays logical. Focus order serves keyboard and assistive-tech users, not mouse users.

    Read the full bite: Designing and documenting focus order in Figma

  21. Question 21 of 30

    When programmatically shifting focus between form fields from a parent StatefulWidget, which practice correctly handles FocusNode lifecycle and prevents focus loss?

    Show the answer

    Answer: a · Initialize the FocusNode as a state field in initState, attach it to a TextField, and call dispose in State.dispose.

    Initializing the FocusNode in initState and disposing it in State.dispose keeps the persistent object stable across rebuilds, preventing dropped focus and ChangeNotifier leaks. Creating it in build is a common error because it recreates the node on every rebuild, instantly destroying keyboard focus.

    Read the full bite: What is a FocusNode and why is it useful in forms?

  22. Question 22 of 30

    When building real-time email validation in React, which state strategy best follows declarative, state-driven patterns?

    Show the answer

    Answer: d · Store the raw input in useState, use a single status enum such as typing or error, and derive validation during render.

    The correct approach uses a single status enum and derives validation during render, avoiding redundant state. Option A is wrong because multiple boolean flags require manual synchronization and invite stale state bugs.

    Read the full bite: How would you implement real-time client-side validation in React?

  23. Question 23 of 30

    How does React Hook Form primarily avoid re-rendering an entire form on every keystroke, compared to manual useState management?

    Show the answer

    Answer: d · It registers inputs via refs and treats them as uncontrolled, reading values only when needed.

    React Hook Form attaches refs to inputs and keeps them uncontrolled so React does not render on every keystroke; values are read at validation or submission. The first option describes Formik's context-and-subscription strategy, which is a common point of confusion between the two libraries.

    Read the full bite: Advantages of dedicated React form libraries over manual state

  24. Question 24 of 30

    You are building a Next.js newsletter form that must work without JavaScript and show server validation errors. Which pattern correctly wires the Server Action to the form?

    Show the answer

    Answer: b · Pass the Server Action to useFormState, place the bound action on the form's action prop, and read validation errors from the returned state

    useFormState is designed for progressive enhancement by binding the returned action directly to the form's action attribute and surfacing server-returned state, whereas calling the action in onSubmit with useState breaks JavaScript-free submission and defeats the purpose of the hook.

    Read the full bite: How do you use a Server Action for form submission and useFormState?

  25. Question 25 of 30

    A 50-field React form drops frames because top-level state updates reconcile all fields on every keystroke. Which strategy best addresses the root architectural cause?

    Show the answer

    Answer: c · Extract fields into isolated components with localized state, applying useMemo only to expensive derived calculations

    Extracting fields into isolated components with localized state ensures only the edited field re-renders, fixing the root architectural cause. Wrapping JSX nodes in useMemo inside the parent render violates Hook rules and does not prevent React from reconciling all children when top-level state changes.

    Read the full bite: Optimize a large form with frequent state updates

  26. Question 26 of 30

    Which pattern best prevents data loss and supports accurate per-step validation when users move non-linearly through a React wizard?

    Show the answer

    Answer: c · Maintain a single root form instance, validate only the current step's Zod slice before advancing, and hydrate defaultValues from localStorage on mount.

    A single root form with per-step Zod slices ensures only touched fields are validated before navigation, while localStorage hydration prevents data loss on refresh. Option A is tempting because it correctly centralizes the form, but validating the entire schema prematurely surfaces errors for untouched future fields and skipping persistence leaves users vulnerable to data loss.

    Read the full bite: Design a multi-step wizard form pattern in React

  27. Question 27 of 30

    What is the main advantage of using the FormData API when submitting an HTML form via JavaScript?

    Show the answer

    Answer: d · It automatically handles the correct encoding and Content-Type header for complex data, including file uploads.

    The FormData API was created to automate the tedious and error-prone process of collecting, encoding (especially multipart/form-data for files), and setting the correct Content-Type headers for AJAX form submissions. While it is often used with asynchronous requests that prevent page reloads, FormData itself doesn't enable the no-reload aspect; it simplifies the data preparation for such requests.

    Read the full bite: FormData: Package Form Data for HTTP Requests

  28. Question 28 of 30

    For which scenario would a setup wizard be the most effective user interface choice?

    Show the answer

    Answer: a · An infrequent, critical process where users lack expertise and need guided, step-by-step assistance.

    Setup wizards are ideal for complex, critical tasks performed infrequently, especially when users lack the expertise to navigate options independently, as the system guides them step-by-step. Option B describes a scenario where a wizard would be frustrating for expert users, contradicting its intended use.

    Read the full bite: Setup Wizard: Guiding Users Through Complexity

  29. Question 29 of 30

    What is the primary mechanism by which React Hook Form improves performance compared to traditional controlled components?

    Show the answer

    Answer: c · It leverages uncontrolled inputs, allowing the DOM to manage input values directly and thus reducing component re-renders.

    React Hook Form's core performance advantage comes from using uncontrolled inputs, which means the DOM directly manages input values, drastically reducing component re-renders. This differs from controlled components, which re-render on every keystroke. While memoization (Option A) can aid performance, it's not the primary mechanism RHF employs; RHF avoids the need for many re-renders by not controlling the inputs with React state in the first place.

    Read the full bite: React Hook Form: Faster Forms with Less Code

  30. Question 30 of 30

    Which statement best characterizes Formik's role in a React application?

    Show the answer

    Answer: b · It functions as a dedicated state machine for form data and logic, independent of UI presentation.

    Formik is described as a "dedicated state manager just for your form" that handles "data and logic" but "not the presentation." It explicitly avoids providing UI components and is designed to keep form state local, not integrated with global state managers.

    Read the full bite: Formik: Taming React Form State

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