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

How do you unmount a component in React?

  • Using componentWillUnmount
  • Using componentDidMount
  • Using useEffect
  • Using setState
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 memo in React?

  • To memoize functions
  • To prevent unnecessary re-renders
  • To handle state
  • To fetch data
Mark for review

What hook is used to manage state in a functional component?

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

Which of the following is NOT a valid way to style components in React?

  • Inline styles
  • External CSS files
  • Styled-components library
  • Internal style tags
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

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 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

Which of the following is NOT a valid lifecycle method in React?

  • componentWillMount()
  • componentWillUpdate()
  • componentDidReceiveProps()
  • componentWillUnmount
Mark for review

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

  • useCallback
  • useMemo
  • useState
  • useComponent
Mark for review

How do you share state between components?

  • Using props
  • Using state
  • Using context
  • Using events
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

In React, what is the purpose of keys in arrays of elements?

  • To uniquely identify each element in the array
  • To provide styling information
  • To store component data
  • To specify element hierarchy
Mark for review

Which of the following Hooks can be used to subscribe to document title changes in React?

  • useEffect
  • useMemo
  • useContext
  • useDocumentTitle
Mark for review

What is the purpose of the 'ref' attribute in React?

  • To reference external JavaScript files
  • To create a reference to a DOM element or a React component
  • To define component dependencies
  • To specify component props
Mark for review

How do you lazy load components in React?

  • Using React.lazy
  • Using useEffect
  • Using useContext
  • Using useState
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 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

Who developed React.js?

  • Google
  • Apple
  • Facebook
  • Microsoft
Mark for review

What is Redux used for?

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

Which of the following statements about React Suspense is true?

  • It is used to handle errors in React components
  • It is used to suspend rendering while waiting for data to load
  • It is deprecated in the latest version of React
  • It is used to manage component state
Mark for review

What is the purpose of the 'key' prop in React lists?

  • To specify the index of each item in the list
  • To uniquely identify each item in the list
  • To provide styling information for list items
  • To define the initial state of list items
Mark for review

How can you prevent a component from re-rendering in React?

  • By using shouldComponentUpdate method
  • By returning false from the render method
  • By setting the 'shouldUpdate' attribute to false
  • By removing the component from the component tree
Mark for review

In React, what is the purpose of the 'shouldComponentUpdate' method?

  • To determine if a component should be rendered
  • To define component lifecycle
  • To handle component events
  • To manage component input
Mark for review

What is the purpose of useCallback hook?

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

Which of the following is NOT a valid way to define a component in React?

  • Function Component
  • Class Component
  • Component Component
  • Higher-Order Component
Mark for review

What is the purpose of the 'key' prop in React?

  • It specifies the CSS class of an element
  • It provides a unique identifier for a component in an array
  • It defines the initial state of a component
  • It sets the default props of a component
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