Learn React Js MCQs

Prepare React Js MCQs (Multiple choice Questions) for exam and job interviews.

What is the primary difference between functional and class components?

1) Functional components do not manage state or lifecycle methods

2) Class components are more efficient

3) Functional components cannot accept props

4) Class components are stateless

Answer : Option 1

What is the purpose of the `React.Fragment`?

1) To group a list of children without adding extra nodes to the DOM

2) To create refs

3) To handle side effects

4) To manage state

Answer : Option 1

How do you manage side effects in functional components?

1) Using `useEffect`

2) Using `useState`

3) Using `useRef`

4) Using `useContext`

Answer : Option 1

What is the purpose of `setState` in class components?

1) To update the component’s state and re-render

2) To manage side effects

3) To create refs

4) To optimize performance

Answer : Option 1

How do you create a dynamic list in React?

1) By mapping over an array

2) By using a static array

3) By using context

4) By using state

Answer : Option 1

What is the purpose of `defaultProps`?

1) To set default values for props

2) To manage state

3) To handle side effects

4) To create refs

Answer : Option 1

How do you trigger a state update?

1) Using `setState` or `useState`

2) By directly modifying state

3) Using `useEffect`

4) Using `useRef`

Answer : Option 1

What is the purpose of the `onClick` event in React?

1) To handle click events

2) To manage state

3) To create refs

4) To handle side effects

Answer : Option 1

How do you implement routing in React?

1) Using `React Router`

2) By using `useState`

3) By using `useEffect`

4) By creating components

Answer : Option 1

What is the purpose of the `render` method in React?

1) To return the UI elements

2) To handle side effects

3) To manage state

4) To create refs

Answer : Option 1