All Coursera Quiz Answers

Module quiz: Data and state Quiz Answers

In this article i am gone to share Coursera Course: React Basics by Meta Week 2 | Module quiz: Data and state Quiz Answers with you..

Enroll Link: React Basics


Also visit this link:  Module Quiz Answers


 

Module quiz: Data and state Quiz Answers

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

  • True
  • False

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.

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

  • True
  • False

Question 4)
What is prop drilling?

  • Prop drilling is a situation where you are passing data from a parent to a child component, then to a grandchild component, and so on, until it reaches a more distant component further down the component tree, where this data is required
  • Prop drilling is a situation where you are passing data from a child, to a parent component, then to a grandparent component, and so on, until it reaches a more distant component further up the component tree, where this data is required.

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

  • True
  • False

Question 6)
Choose the correct statement.

  • Remember that you should always change the values of props in children components; you should never work with them as they are. In other words, props are mutable.
  • Remember that you should never change the values of props in children components; you should only work with them as they are. In other words, props are immutable.

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

Question 8)
Is this code valid?

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

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; you must import it from a third-party package.
  • … has a convention that if the state variable is named, for example, counter, the function to update this counter variable should be named counterFunction.
  • … should never be called at the top level of a React component.

Question 10)
The Context API allows you to:

  • Avoid having to pass state down through multiple levels of components.
  • Avoid having to use the return statement in a child component.
  • Avoid having to keep your components modular.