Online Exam Quiz

questionQuestion  1 to 30

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 handle errors in a React application?

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

How do you create a React component?

  • By defining a class
  • By defining a function
  • By using HTML tags
  • Both A and B
Mark for review

Which of the following is true about React?

  • It is a framework
  • It is a library
  • It is a language
  • It is a template engine
Mark for review

What is JSX?

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

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

  • render
  • setState
  • forceUpdate
  • updateState
Mark for review

Which command is used to create a new React application?

  • create-react-app
  • npm init
  • react-init
  • npx create-react-app
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

What is Redux?

  • A library for managing state
  • A CSS framework
  • A React component
  • A testing library
Mark for review

How do you update state in a functional component?

  • setState
  • updateState
  • changeState
  • setState
Mark for review

Which hook is used for side effects in functional components?

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

  • To manage state
  • To handle events
  • To pass data through component tree
  • To fetch data
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

How do you implement context in a class component?

  • Using React.createContext
  • Using React.ContextType
  • Using React.createState
  • Using React.createElement
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 create a context in React?

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

What is the purpose of useMemo hook?

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

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 create a portal in React?

  • Using React.createPortal
  • Using React.createElement
  • Using React.createState
  • Using ReactDOM.render
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 getDerivedStateFromProps?

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

How do you implement code splitting in a React application?

  • Using dynamic import
  • Using React.lazy
  • Using Suspense
  • All of the above
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

What is the default port for a React development server?

  • 3000
  • 8000
  • 8080
  • 5000
Mark for review

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

What is the use of componentDidMount?

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