Loading

Quipoin Menu

Learn • Practice • Grow

react / Controlled Components
mcq
Direction: Choose the correct option

Q1.

What defines a controlled component in React?
A. The component uses refs
B. The component has its own internal state
C. The form data is handled by the DOM itself
D. The component's input value is controlled by React state
Direction: Choose the correct option

Q2.

How do you set the initial value of a controlled input?
A. Setting the state in constructor or useState
B. Using defaultValue attribute
C. Using value attribute without onChange
D. Using placeholder
Direction: Choose the correct option

Q3.

What is required for a controlled input to be editable?
A. A value attribute
B. A ref
C. An onChange handler that updates state
D. A name attribute
Direction: Choose the correct option

Q4.

Given , what type of component is this?
A. Uncontrolled
B. Controlled
C. Ref-based
D. Stateless
Direction: Choose the correct option

Q5.

What happens if you set value but no onChange on an input?
A. It ignores value
B. It becomes editable
C. It becomes read-only
D. It throws an error