Loading

Quipoin Menu

Learn • Practice • Grow

react / useEffect Dependency Array
mcq
Direction: Choose the correct option

Q1.

What does the dependency array in useEffect control?
A. The cleanup timing
B. The return value of useEffect
C. The order of effects
D. When the effect should re-run
Direction: Choose the correct option

Q2.

If you omit the dependency array, how often does the effect run?
A. Never
B. After every render
C. Only when a specific prop changes
D. Only once
Direction: Choose the correct option

Q3.

What happens if you pass an empty array []?
A. The effect runs only when state changes
B. The effect never runs
C. The effect runs only on mount and unmount
D. The effect runs after every render
Direction: Choose the correct option

Q4.

Which values should be included in the dependency array?
A. Only functions
B. All props and state used inside the effect
C. Only primitive values
D. Only objects
Direction: Choose the correct option

Q5.

What is a common mistake when using dependencies?
A. Including too many values
B. Not using an array
C. Using an empty array
D. Missing dependencies, causing stale closures