Online Exam Quiz

questionQuestion  1 to 30

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

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

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

In React, what does the virtual DOM do?

  • It directly manipulates the real DOM
  • It optimizes CSS styling
  • It provides a way to manipulate browser cookies
  • It reconciles the changes made to the UI
Mark for review

Who developed React.js?

  • Google
  • Apple
  • Facebook
  • Microsoft
Mark for review

What is prop drilling?

  • Passing props to multiple components
  • Updating state in child components
  • Updating props in parent components
  • Passing state down multiple levels
Mark for review

What is a component in React?

  • A function that returns JSX
  • A class that fetches data
  • A library for routing
  • A method for state management
Mark for review

Which of the following statements about React Hooks is true?

  • They only work with class components
  • They allow you to use state and other React features without writing a class
  • They are used to define component lifecycle methods
  • They are deprecated in the latest version of React
Mark for review

How do you handle side effects in a functional component?

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

How do you create a context in React?

  • Using React.createContext
  • Using useContext
  • Using useEffect
  • Using useReducer
Mark for review

What is the virtual DOM in React?

  • A real DOM that is virtualized
  • A JavaScript object
  • An API for backend calls
  • A type of database
Mark for review

How do you handle errors in React components?

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

What is the purpose of the 'defaultProps' property in React?

  • To define default values for props
  • To specify the default state of a component
  • To set the default event handlers
  • To define default CSS styles
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

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

  • To handle component errors
  • To debug custom Hooks
  • To update the component's state
  • To perform side effects in function components
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

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

  • useCallback
  • useMemo
  • useState
  • useComponent
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

Which method is called when a component is first added to the DOM?

  • componentDidMount()
  • componentWillMount()
  • componentWillUpdate()
  • componentDidUpdate
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 the purpose of keys in React?

  • To identify elements uniquely
  • To set state
  • To define props
  • To handle events
Mark for review

What is the purpose of ReactDOM?

  • To define components
  • To manage state
  • To render React components to the DOM
  • To create context
Mark for review

What is React.js?

  • A programming language
  • A JavaScript library for building user interfaces
  • A database management system
  • An operating systemAnswer
Mark for review

What is the purpose of middleware in Redux?

  • To handle asynchronous actions
  • To handle synchronous actions
  • To fetch data
  • To manage state
Mark for review

How do you handle forms in React?

  • Using Redux
  • Using refs
  • Using state
  • Using Context API
Mark for review

How do you create a reference to a DOM element in React?

  • Using createRef
  • Using useState
  • Using useEffect
  • Using useReducer
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

What is the purpose of useMemo hook?

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

How can you prevent a component from rendering in React?

  • By setting the 'visible' attribute to false
  • By returning null from the render method
  • By using the 'shouldComponentUpdate' method
  • By removing the component from the component tree
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

How can you optimize performance in React?

  • By using pure components
  • By minimizing the use of inline styles
  • By avoiding unnecessary re-renders
  • All of the above
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