πŸ“Š React Js
Q. Which of the following is NOT a React hook?
  • (A) useContext
  • (B) useFetch
  • (C) useReducer
  • (D) useEffect
πŸ’¬ Discuss
βœ… Correct Answer: (B) useFetch

Explanation: useFetch is not a built-in hook in React, though it's commonly implemented by developers.

πŸ“Š React Js
Q. What is the purpose of useContext in React?
  • (A) To manage routing
  • (B) To fetch data
  • (C) To access context values
  • (D) To handle forms
πŸ’¬ Discuss
βœ… Correct Answer: (C) To access context values

Explanation: useContext allows functional components to access values from a React Context.

πŸ“Š React Js
Q. What is the default behavior of React when state changes?
  • (A) It re-renders only the changed component
  • (B) It re-renders the whole application
  • (C) It manually updates the DOM
  • (D) It blocks rendering
πŸ’¬ Discuss
βœ… Correct Answer: (A) It re-renders only the changed component

Explanation: React efficiently re-renders only the component whose state changed.

πŸ“Š React Js
Q. What is a controlled component in React?
  • (A) A component that controls another
  • (B) A component with its own state
  • (C) A form element controlled by React state
  • (D) A static component
πŸ’¬ Discuss
βœ… Correct Answer: (C) A form element controlled by React state

Explanation: Controlled components have form elements where the value is tied to state.

πŸ“Š React Js
Q. Which of the following is true about React keys in a list?
  • (A) They can be duplicated
  • (B) They should be the index of the array always
  • (C) They must be unique among siblings
  • (D) They are optional
πŸ’¬ Discuss
βœ… Correct Answer: (C) They must be unique among siblings

Explanation: React keys must be unique among sibling elements for optimal rendering.

πŸ“Š React Js
Q. What does JSX stand for?
  • (A) JavaScript Xtreme
  • (B) JavaScript XML
  • (C) Java Simple Extension
  • (D) Java Syntax Extension
πŸ’¬ Discuss
βœ… Correct Answer: (B) JavaScript XML

Explanation: JSX stands for JavaScript XML, allowing HTML-like syntax in JavaScript.

πŸ“Š React Js
Q. How do you pass a function as a prop in React?
  • (A) <Comp func='handleClick' />
  • (B) <Comp func={handleClick} />
  • (C) <Comp>handleClick</Comp>
  • (D) <Comp.handleClick />
πŸ’¬ Discuss
βœ… Correct Answer: (B) <Comp func={handleClick} />

Explanation: Functions are passed as props using curly braces in JSX.

πŸ“Š React Js
Q. When using useEffect with an empty dependency array, how often does it run?
  • (A) On every render
  • (B) Only on unmount
  • (C) Once after the initial render
  • (D) Every 5 seconds
πŸ’¬ Discuss
βœ… Correct Answer: (C) Once after the initial render

Explanation: An empty dependency array causes useEffect to run only once on mount.

πŸ“Š React Js
Q. What is React Router used for?
  • (A) Fetching data
  • (B) State management
  • (C) Client-side routing
  • (D) Form validation
πŸ’¬ Discuss
βœ… Correct Answer: (C) Client-side routing

Explanation: React Router handles navigation and routing in React single-page applications.

πŸ“Š React Js
Q. Which package is commonly used for form handling in React?
  • (A) formik
  • (B) redux
  • (C) react-dom
  • (D) axios
πŸ’¬ Discuss
βœ… Correct Answer: (A) formik

Explanation: Formik is a popular library for handling forms in React.