Online Exam Quiz

questionQuestion  1 to 30

What is the purpose of useCallback hook?

  • To memoize functions
  • To memoize values
  • To handle side effects
  • To fetch data
Mark for review

What is the purpose of PropTypes in React?

  • To specify the type of data expected in props
  • To define the initial state of a component
  • To manage component input
  • To handle component events
Mark for review

What is the purpose of render props in React?

  • To share logic between components
  • To manage state
  • To handle side effects
  • To fetch data
Mark for review

What is the purpose of the 'getDerivedStateFromProps' method in React?

  • To update the component's state based on props changes
  • To initialize the component's state
  • To perform side effects after rendering
  • To handle component errors
Mark for review

What is JSX?

  • A JavaScript syntax extension
  • A type of database
  • A CSS preprocessor
  • A testing framework
Mark for review

In React, how can you conditionally render components?

  • Using if-else statements
  • Using switch statements
  • Using ternary operators
  • All of the above
Mark for review

What is the purpose of the 'useCallback' Hook in React?

  • To memoize expensive calculations
  • To update the component's state
  • To handle component errors
  • To perform side effects in function components
Mark for review

What is the context API used for?

  • State management across components
  • DOM manipulation
  • CSS styling
  • Server-side rendering
Mark for review

How do you handle errors in React components?

  • Using componentDidCatch
  • Using useEffect
  • Using useState
  • Using render
Mark for review

Which lifecycle method is invoked immediately after updating occurs in React?

  • componentWillUpdate()
  • componentDidUpdate()
  • componentWillMount()
  • componentDidMount
Mark for review

What does JSX stand for in React.js?

  • JavaScript XML
  • JavaScript Extension
  • JavaScript XQuery
  • JavaScript External
Mark for review

What is a pure component in React?

  • A component with no side effects
  • A component that only re-renders when its props change
  • A component that always re-renders
  • A component that fetches data
Mark for review

How do you handle events in React?

  • Using addEventListener
  • Using on prefix in JSX
  • Using handleEvent method
  • Using event method
Mark for review

In React, what is the purpose of the 'useRef' Hook?

  • To reference DOM elements or React components
  • To define the initial state of a component
  • To update the component's props
  • To perform side effects in function components
Mark for review

Which of the following methods is called after the component is rendered in React?

  • componentWillMount()
  • omponentDidMount()
  • componentDidUpdate()
  • componentWillReceiveProps
Mark for review

How do you handle forms with controlled components?

  • Using value and onChange props
  • Using defaultValue prop
  • Using setState
  • Using useEffect
Mark for review

What is a portal in React?

  • A way to render children into a DOM node outside the parent component
  • A way to handle events
  • A way to manage state
  • A way to fetch data
Mark for review

What is the purpose of state in React?

  • To store props
  • To store component metadata
  • To manage component input
  • To manage component data that may change
Mark for review

In React, what is the purpose of the 'static getDerivedStateFromError' method?

  • To update the component's state based on errors
  • To initialize the component's state
  • To perform cleanup after an error occurs
  • To handle errors that occur during rendering
Mark for review

What is Redux used for?

  • State management
  • Routing
  • CSS styling
  • API calls
Mark for review

Which of the following is NOT a way to handle events in React?

  • Inline event handlers
  • Event delegation
  • Event listeners
  • Synthetic events
Mark for review

What does the useEffect hook do?

  • Manages state
  • Fetches data
  • Performs side effects in components
  • Defines components
Mark for review

What is the purpose of the 'componentWillReceiveProps' method in React?

  • To update the component's props
  • To initialize the component's state
  • To perform cleanup before the component is removed
  • To handle errors during rendering
Mark for review

What is the purpose of the 'useMemo' Hook in React?

  • To memoize expensive calculations
  • To update the component's state
  • To handle component errors
  • To perform side effects in function components
Mark for review

Which of the following methods is used to update the state based on the previous state in React?

  • this.updateState()
  • this.setState()
  • this.changeState()
  • this.modifyState
Mark for review

What is the purpose of StrictMode in React?

  • To highlight potential problems
  • To manage state
  • To fetch data
  • To handle errors
Mark for review

How do you connect a React component to the Redux store?

  • Using connect
  • Using useState
  • Using useEffect
  • Using useContext
Mark for review

Which of the following methods is used to perform side effects in React?

  • componentDidMount()
  • componentDidUpdate()
  • componentWillUnmount()
  • All of the above
Mark for review

In React, what is the purpose of the 'useReducer' Hook?

  • To handle component errors
  • To manage complex state logic
  • To define the initial state of a component
  • To perform side effects in function components
Mark for review

Which of the following is NOT a built-in Hook in React?

  • useCallback
  • useMemo
  • useState
  • useComponent
Mark for review

blinkerOnline

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • Answered
  • Not Answered
  • Marked for Review