react-mcqs - Set (3)

Correct Answer: Orange && Worng Answer: Red

1. Which of the following is used to access a function fetch()  from h1 element in JSX?

  • (A). <h1>${fetch()}</h1>
  • (B). <h1>{fetch}</h1>
  • (C). <h1>${fetch}</h1>
  • (D). <h1>{fetch()}</h1>
  • View Answer

    Explanation: The correct command is <h1>{fetch()}</h1>.

    2. When setState()  is called inside render() method, which of the following events takes place?

  • (A). duplicate key error
  • (B). repetitive output happiness on the screen
  • (C). nothing happens
  • (D). stackoverflow error
  • View Answer

    Explanation: Stackoverflow error occurs when setState()  is called inside render() method.

    3. What happens if you render an input element with disabled = {false}?

  • (A). it will be rendered as enabled
  • (B). it will be rendered as disabled
  • (C). it will not be rendered at all
  • (D). None of the above
  • View Answer

    Explanation: It will be rendered as enabled if you render an input element with disabled = {false}.

    4. When is useReducer used over useState in React component?

  • (A). When we want to replace redux
  • (B). when we want to break our production app
  • (C). when we want to improve performance
  • (D). none of the above
  • View Answer

    Explanation: When we want to replace redux, useReducer is used over useState.

    5. React is a ___________

  • (A). JavaScript framework
  • (B). JavaScript library
  • (C). both  a and b
  • (D). none of the above
  • View Answer

    Explanation: React is a JavaScript library.

    6. Choose the library which is most often associated with react?

  • (A). Sinon
  • (B). Chai
  • (C). Jest
  • (D). Mocha
  • View Answer

    Explanation: Jest is most often associated with react.

    7. What is used to handle code-splitting?

  • (A). React.lazy
  • (B). React.memo
  • (C). React.fallback
  • (D). React.split
  • View Answer

    Explanation: React.lazy is used to handle code splitting.

    8. Why is useLayoutEffect used?

  • (A). To complete the update
  • (B). to optimize for all devices
  • (C). To change the layout of the screen
  • (D). when you need the browser to paint before the effectors
  • View Answer

    Explanation: When you need the browser to paint before the effect runs, useLayoutEffect used.

    9. Which of the following terms commonly described react applications?

  • (A). Imperative
  • (B). Integrated
  • (C). Declarative
  • (D). closed
  • View Answer

    Explanation: Declarative is commonly used to describe react applications.

    10. Why is ref used?

  • (A). to bind the function
  • (B). to call a function
  • (C). to directly access the DOM node
  • (D). to refer to another JS file
  • View Answer

    Explanation: Ref is used to directly access the DOM node.