Online Exam Quiz

questionQuestion  1 to 30

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 the useContext hook?

  • To manage state
  • To handle events
  • To pass data through component tree
  • To fetch data
Mark for review

Which hook is used for side effects in functional components?

  • useState
  • useEffect
  • useReducer
  • useContext
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 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 create a context in React?

  • Using React.createContext
  • Using React.createState
  • Using React.createEvent
  • Using React.createElement
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 forms in React?

  • Using controlled components
  • Using uncontrolled components
  • Both A and B
  • Using state only
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

How do you access state in a class component?

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

What is the purpose of useCallback hook?

  • To memoize functions
  • To handle state
  • To handle events
  • To pass props
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

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 style components in React?

  • Using CSS
  • Using inline styles
  • Using styled-components
  • All of the above
Mark for review

How do you update state in a functional component?

  • setState
  • updateState
  • changeState
  • setState
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 handle errors in a React application?

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

What is the default port for a React development server?

  • 3000
  • 8000
  • 8080
  • 5000
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 use of Fragment in React?

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

How do you implement context in a class component?

  • Using React.createContext
  • Using React.ContextType
  • Using React.createState
  • Using React.createElement
Mark for review

Which method is used to re-render a class component?

  • render
  • setState
  • forceUpdate
  • updateState
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 purpose of componentDidCatch?

  • To fetch data
  • To handle errors
  • To optimize performance
  • To update state
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

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

  • Using refs
  • Using state
  • Using props
  • Using context
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 the use of componentDidMount?

  • To handle events
  • To fetch data after component mounts
  • To initialize state
  • To bind methods
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 conditionally render a component?

  • Using if-else statements
  • Using ternary operator
  • Using && operator
  • 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