Skip to content

Module quiz: Data and state :React Basics (Meta iOS Developer Professional Certificate) Answers 2026

Question 1

In React, data flows in one way: from a parent component to a child component.

True
❌ False

Explanation:
React one-way (unidirectional) data flow follow karta hai: parent → child.


Question 2

Why is one-way data flow important in React?

It ensures that the data is flowing from top to bottom in the component hierarchy.
❌ It ensures that the data is flowing from bottom to top in the component hierarchy.

Explanation:
Isse app predictable, easy to debug aur maintainable banti hai.


Question 3

True or false? State data is the data inside a component that a component can mutate.

True
❌ False

Explanation:
State component ke andar hota hai aur use setState / useState se update kiya ja sakta hai.


Question 4

What is prop drilling?

Passing data from parent → child → grandchild → further down the tree where it’s needed
❌ Passing data upward from child to parent repeatedly

Explanation:
Prop drilling tab hoti hai jab data bahut zyada levels tak props ke through pass karna padta hai.


Question 5

The distinction between stateful and stateless components is that the latter doesn’t have its own state.

True
❌ False

Explanation:
Stateless components sirf props use karte hain, apna state nahi hota.


Question 6

Choose the correct statement.

❌ Props are mutable and should be changed in children
Props are immutable and should not be changed in children

Explanation:
Props read-only hote hain. Unhe child component me change nahi karna chahiye.


Question 7

Is this code valid?

function App() {
const handler = () => console.log('fourth example')
return (
<div>
<button onClick = {handler} >
Click Me!
</button>
</div>
)
}

Yes
❌ No

Explanation:
Function reference pass karna (onClick={handler}) best practice hai.


Question 8

Is this code valid?

<button onClick={ () => console.log('clicked') }>
Click me
</button>

Yes
❌ No

Explanation:
Inline arrow functions valid hain (though large apps me avoid karte hain).


Question 9

Select the correct statement: The useState hook…

lets you hook into React state and lifecycle features from a component.
❌ is not part of React
❌ naming function must be counterFunction
❌ should never be called at top level

Explanation:
useState React ka built-in Hook hai jo functional components me state deta hai.


Question 10

The Context API allows you to:

Avoid having to pass state down through multiple levels of components.
❌ Avoid return statements
❌ Avoid modular components

Explanation:
Context API prop drilling ka solution hai.


🧾 Summary Table

Q Correct Answer Key Concept
1 True One-way data flow
2 Top → Bottom Predictability
3 True State
4 Parent → deep child Prop drilling
5 True Stateless components
6 Props immutable Props rules
7 Yes Event handling
8 Yes Inline handlers
9 useState hook React Hooks
10 Avoid prop drilling Context API