Online Exam Quiz

questionQuestion  1 to 30

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

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

What is the purpose of shouldComponentUpdate?

  • To fetch data
  • To optimize performance
  • To handle events
  • To manage state
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 prop-types?

  • To handle state
  • To enforce type checking
  • To fetch data
  • To create components
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 update state in a functional component?

  • setState
  • updateState
  • changeState
  • setState
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

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

What is a Higher-Order Component (HOC)?

  • A component that fetches data
  • A component that manages state
  • A function that returns a component
  • A component that handles events
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 fetch data in a React component?

  • Using fetch API
  • Using Axios
  • Both A and B
  • Using state
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

How do you pass data to a child component?

  • Using states
  • Using methods
  • Using props
  • Using functions
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

Which method is used to handle state in functional components?

  • setState
  • useState
  • componentDidMount
  • render
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

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 implement context in a class component?

  • Using React.createContext
  • Using React.ContextType
  • Using React.createState
  • Using React.createElement
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 conditionally render a component?

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

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

  • componentDidMount
  • componentWillUnmount
  • componentDidUpdate
  • render
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 use of componentDidMount?

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

What is JSX?

  • A templating language
  • A JavaScript syntax extension
  • A CSS preprocessor
  • A JavaScript library
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 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