Online Exam Quiz

questionQuestion  1 to 30

What is the purpose of React?

  • To manage databases
  • To build user interfaces
  • To style web pages
  • To write server-side code
Mark for review

Which lifecycle method is called when a component is removed from the DOM?

  • componentDidMount
  • componentWillUnmount
  • componentDidUpdate
  • render
Mark for review

Which of the following is a valid way to handle forms in React?

  • Using controlled components
  • Using uncontrolled components
  • Using HTML forms
  • Both A and B
Mark for review

How do you create a Higher-Order Component?

  • By wrapping a component with a function
  • By using a class component
  • By using a functional component
  • By using hooks
Mark for review

What is the virtual DOM?

  • A browser feature
  • A programming language
  • A lightweight copy of the real DOM
  • A server-side technology
Mark for review

How do you access a child component's methods in React?

  • Using refs
  • Using state
  • Using props
  • Using context
Mark for review

How do you handle errors in a React application?

  • Using error boundaries
  • Using try-catch
  • Using state
  • Using props
Mark for review

What is the purpose of getDerivedStateFromProps?

  • To fetch data
  • To update state based on props
  • To handle events
  • To optimize performance
Mark for review

How do you conditionally render a component?

  • Using if-else statements
  • Using ternary operator
  • Using && operator
  • All of the above
Mark for review

What is the purpose of React.memo?

  • To optimize performance
  • To create a memo
  • To store values
  • To manage state
Mark for review

What is the use of the key prop in lists?

  • To identify unique elements
  • To reorder elements
  • To add styles to elements
  • To handle events
Mark for review

What is the purpose of useReducer hook?

  • To manage state
  • To handle events
  • To fetch data
  • To pass props
Mark for review

What is the purpose of componentDidCatch?

  • To fetch data
  • To handle errors
  • To optimize performance
  • To update state
Mark for review

What is the purpose of ReactDOM.render?

  • To update the state
  • To create a component
  • To render a component to the DOM
  • To handle events
Mark for review

What is the purpose of prop-types?

  • To handle state
  • To enforce type checking
  • To fetch data
  • To create components
Mark for review

How do you pass data to a child component?

  • Using states
  • Using methods
  • Using props
  • Using functions
Mark for review

How do you create a portal in React?

  • Using React.createPortal
  • Using React.createElement
  • Using React.createState
  • Using ReactDOM.render
Mark for review

What is the purpose of componentDidUpdate?

  • To fetch data
  • To handle errors
  • To perform side effects after update
  • To update state
Mark for review

What is JSX?

  • A templating language
  • A JavaScript syntax extension
  • A CSS preprocessor
  • A JavaScript library
Mark for review

How do you handle user input in React?

  • Using state
  • Using props
  • Using methods
  • Using events
Mark for review

What is the purpose of lazy and Suspense in React?

  • To optimize performance
  • To create a component
  • To handle errors
  • To lazy load components
Mark for review

How do you optimize a React application?

  • Using memoization
  • Using lazy loading
  • Using code splitting
  • All of the above
Mark for review

How do you fetch data in a React component?

  • Using fetch API
  • Using Axios
  • Both A and B
  • Using state
Mark for review

How do you make a network request in React?

  • Using fetch API
  • Using Axios
  • Both A and B
  • Using state
Mark for review

What is the use of Fragment in React?

  • To group multiple elements
  • To style components
  • To manage state
  • To handle events
Mark for review

How do you handle routing in a React application?

  • Using react-router
  • Using URL paths
  • Using HTML tags
  • Using props
Mark for review

What is the purpose of useRef hook?

  • To create a reference
  • To handle state
  • To manage events
  • To pass props
Mark for review

What is the purpose of ReactDOM.hydrate?

  • To render a React application on the client side
  • To render a React application on the server side
  • To render a static site
  • To optimize performance
Mark for review

How do you access state in a class component?

  • this.state
  • this.props
  • this.setState
  • this.useState
Mark for review

How do you handle asynchronous operations in React?

  • Using async/await
  • Using Promises
  • Using callback functions
  • 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