NewWork mode: your Claude Code or Codex on work calls, answering from your project's codeSkip to content

Quiz: Frontend

Frontend questions from real interviews as a quiz, with an explanation for every option.

33 questionsAll topicsFrontend

Try it: 5 questions

Loading…

Sample questions

  1. In what order does a regular DOM click event propagate if it is not stopped?

    • Bubble from the root to the target → handlers on the target → capture back to the root
    • Capture from the root to the target → handlers on the target → bubble from the target to the root
    • Capture from the root to the target → bubble from the target to the root → handlers on the target
    • Handlers on the target → capture back to the root → bubble toward the root
    Full answer
  2. What does a conditional type in TypeScript do?

    • Declares a type that can contain only values matching both specified types.
    • Chooses one of two types based on whether a type satisfies an extends condition.
    • Converts a value at runtime if it matches a type.
    • Combines two types into one using the extends operator.
    Full answer
  3. Which practices are appropriate for securely storing and passing secrets for LLMs, databases, and queues in production? Select all that apply.

    • Pass secrets to the server process through environment variables, without treating them as a replacement for a secrets manager.
    • Pass secrets through frontend build variables if the resulting code is minified and obfuscated.
    • Keep secrets in an encrypted repository file and decrypt them in the browser when needed.
    • Make LLM calls and access to databases and queues through the backend; restrict permissions, use TLS, rotate secrets, and keep them out of logs.
    • Store secrets in a secrets manager and have the backend retrieve them at startup or during runtime.
    Full answer
  4. Which statement about @StateObject in SwiftUI is correct?

    • StateObject requires an explicit type even when its initial value already specifies a concrete model.
    • StateObject is an ordinary type that determines the model automatically from the property name.
    • StateObject is a generic type; its model type must conform to ObservableObject and can be inferred from the initial value.
    • StateObject can store an object of any type because it checks the object only at runtime.
    Full answer
  5. How does short polling work: who initiates requests, and what does the server do in response?

    • The client requests data once, and the server regularly sends updates in the response.
    • The client sends HTTP requests periodically, and the server immediately returns the data currently available.
    • The server sends updates to the client over a persistent connection.
    • The client opens a request and waits for the server to send an update or for a timeout.
    Full answer
  6. Select all correct recommendations for key in React lists.

    • If there is no id, generate a new random key on every render.
    • Prefer a unique, stable identifier for each record.
    • An array index remains reliable after insertions and reordering because React updates it automatically.
    • If there is no id, you can create a key once when loading the data and store it with the record.
    • key helps React match elements between renders.
    Full answer
  7. What is characteristic of a JavaScript expression?

    • It always controls the program's execution flow.
    • It is evaluated to produce a value.
    • It always consists of a function call.
    • It always declares a new variable.
    Full answer
  8. Which statements about storing refresh tokens on the server are correct? Select all that apply.

    • If you store a token, it is better to keep its hash and metadata rather than the original value.
    • Every refresh token must be stored in a database, even when the application uses stateless JWTs.
    • To make revocation possible, the token must be stored in the database in plaintext.
    • Refresh-token rotation helps detect reuse of an old token, and the whole token family can then be revoked.
    • A session or token record is useful when you need to revoke individual sessions or detect token reuse.
    Full answer
  9. What behavior should memo(fn) provide when applied to sum?

    • Return a wrapper that caches results by arguments and reuses them when the same arguments recur.
    • Store the call arguments but recompute the result each time.
    • Modify fn to remember only the result of its most recent call, regardless of the arguments.
    • Run fn on every call, then store its result to compare with future calls.
    Full answer
  10. How do ordinary curly braces affect scope in JavaScript?

    • A standalone block scopes let, const, and class; it does not scope var.
    • A standalone block scopes var, while let and const remain visible outside it.
    • Any curly braces create a scope for every declaration inside them.
    • Curly braces create scope only for var declarations.
    Full answer