React and Redux GRE Audio Quiz Quiz

  1. JSX Syntax

    Which of the following best describes JSX in React?

    1. A markup language to write CSS inside JavaScript
    2. A type of JavaScript extension that lets you write XML-like code inside JS
    3. A tool for compiling JavaScript files to HTML
    4. A language to create custom HTML elements
    5. A sytnax for writing for loops in JS
  2. Component State

    How should you update the state of a class component in React?

    1. By assigning a value directly to this.state
    2. By calling this.setState() with the new state
    3. By using setProps method
    4. By changing the state from the render method
    5. By assigning values to props
  3. Props vs State

    What is the primary difference between props and state in React components?

    1. Props are immutable, state can change inside the component
    2. State is passed from parent to child, props are local to the component
    3. Props update automatically, state doesn’t change
    4. State is used only for class components, props are for functions
    5. Props are arrays only, state is an object only
  4. PureComponent

    What special behavior does a PureComponent implement in React?

    1. It only renders functional components
    2. It does a shallow comparison of props and state to avoid unnecessary re-renders
    3. It allows direct modification of props
    4. It always re-renders on every state update
    5. It disables all lifecycle methods
  5. Event Handling

    Which is a correct way to handle an event in a React element?

    1. Using onclick attribute
    2. onClick={this.handleClick}
    3. on-click='this.handleClick'
    4. onclick='handleClick()'
    5. onClick: this.handleClick
  6. Keys in Lists

    Why is the key prop important when rendering lists of elements in React?

    1. It helps style components more easily
    2. It tells React which elements have changed, are added, or are removed
    3. It is used to encrypt props
    4. It makes the render function pure
    5. It disables automatic re-rendering
  7. Virtual DOM

    What is the Virtual DOM in React?

    1. A server-side DOM implementation
    2. An in-memory representation of the actual DOM to optimize updates
    3. A type of CSS module
    4. A deprecated feature for form validation
    5. A real dom element managed by React
  8. Redux Principles

    Which of the following is NOT a core principle of Redux?

    1. Single source of truth
    2. State is read-only
    3. Changes are made with pure functions
    4. Components can directly mutate the store
    5. Actions describe state changes
  9. Higher-Order Component

    What is a Higher-Order Component (HOC) in React?

    1. A component that renders only on-demand
    2. A function that takes a component and returns a new component
    3. A special CSS class to style multiple components
    4. A prop with a function as its value
    5. A built-in HTML component available in React
  10. Hooks Introduction

    Starting from React 16.8, what feature allows function components to use state and other features?

    1. Reducers
    2. Mixins
    3. Hooks
    4. Refs
    5. Promises