What will the following code output?
-
A.
Clicking the button increments the count by 1.
-
B.
Clicking the button increments the count by 2.
-
C.
Clicking the button does nothing.
-
D.
The code throws an error.
-
What will the following code output?
-
A.
An unordered list with three items: 1: React, 2: JavaScript, 3: CSS.
-
B.
The code throws an error because key should be unique.
-
C.
The code outputs an unordered list but without item indices.
-
D.
The code outputs only the last item in the list.
-
Which of the following hooks can be used to optimize performance in React?
-
A.
useMemo and useCallback.
-
B.
useState and useReducer.
-
C.
useEffect and useLayoutEffect.
-
D.
useContext and useRef.
-
What will the following code output?
-
A.
10
-
B.
15
-
C.
20
-
D.
It results in an infinite loop.
-
What happens when React.StrictMode is used?
-
A.
It prevents rendering of the application in production mode.
-
B.
It activates additional checks and warnings in development mode.
-
C.
It improves performance in both development and production.
-
D.
It enables the usage of experimental features.
-
What will the following code output?
-
A.
Button displays 0 initially and increments by 1 on each click.
-
B.
Button displays 1 initially and increments by 2 on each click.
-
C.
Button displays 0 initially but does not increment.
-
D.
The code throws an error.
-
What does React.Fragment do?
-
A.
Renders a placeholder for components.
-
B.
Groups multiple elements without adding extra DOM nodes.
-
C.
Improves performance by caching components.
-
D.
Ensures components re-render on state changes.
-
What will the following code output?
-
A.
An error because multiple root elements are not allowed.
-
B.
Two div elements rendered inside a single parent.
-
C.
Two div elements rendered without a parent.
-
D.
Two div elements rendered inside a React.Fragment parent.
-
How is React different from Angular?
-
A.
React is a full-fledged framework, while Angular is a library.
-
B.
React uses a one-way data flow, and Angular uses two-way data binding.
-
C.
React and Angular both rely on JSX for templating.
-
D.
React requires TypeScript, while Angular does not.
-
What will the following code output?
-
A.
An empty .
-
B.
A with This will not render.
-
C.
A syntax error.
-
D.
The text "This will not render" displayed as a string.
-