frontend development using react coursera week 3 quiz answers
React Basics - Practice Quiz
1. What is React.js?
- A database management system.
- A JavaScript library for building user interfaces.
- A programming language for building mobile applications.
- A server-side scripting language.
2. What is the Virtual DOM in React.js?
- A physical device that interacts with the computer’s memory.
- A lightweight representation of the actual DOM (Document Object Model) in the browser memory.
- A server-side technology used for creating dynamic web pages.
- A tool for debugging web applications.
3. What is JSX in React.js?
- A programming language for creating mobile applications.
- A syntax extension to JavaScript for writing React components.
- A database management system used in React applications.
- A tool for compiling JavaScript code into machine code.
4. What is the purpose of "props" in React.js?
- To define the structure of a React component.
- To pass data from a parent component to a child component.
- To modify the styling of a React component.
- To store data within a React component.
5. What is the purpose of state in React.js?
- To define the structure of a React component.
- To pass data from a parent component to a child component.
- To modify the styling of a React component.
To store and manage data that affects how a component is rendered and behaves.
React Intermediate - Practice Quiz
6. What is JSX in React JS?
- A markup language used for styling web pages.
- A syntax extension for JavaScript that allows HTML-like syntax to be used to describe UI components.
- A programming language used to build server-side applications.
- A database management system for storing and retrieving data.
7. What are React Props?
- A way of specifying the styles for a React Component.
- Short for “properties”, they are used to pass data from a parent component to a child component.
- A way of managing the state of a React Component.
- A way of defining the behavior of a React Component.
8. What is the React State?
- A way of passing data from a parent component to a child component.
- A way of defining the behavior of a React Component.
- A way of specifying the styles for a React Component.
- An internal data structure that allows a React Component to keep track of its data and re-render when that data changes.
9. What is the purpose of the React Directory structure?
- To provide a visual representation of the components in a React application.
- To define the layout and styles of a React application.
- To manage the data flow between the components of a React application.
- To organize and structure the code of a React application into logical units.
React - Graded Quiz
10. What is the purpose of the useEffect Hook in React?
- To handle events in a component.
- To manage state in a component.
- To run side effects in a component.
- To render a component to the DOM.
11. Which lifecycle method in React is equivalent to the useEffect Hook?
- componentDidMount
- componentDidUpdate
- componentWillUnmount
- Both componentDidMount and componentDidUpdate
12. What is the purpose of the dependency array in the useEffect Hook?
- To specify the state variables that should trigger the effect.
- To specify the state variables that the effect depends on.
- To specify the props that the effect depends on.
- Both B and C.
13. What is the purpose of the "querySelector()" method in JavaScript?
- To select and remove an HTML element from the DOM.
- To create a new HTML element based on a CSS selector.
- To select and retrieve the value of an attribute from an HTML element.
- To select and retrieve the first matching HTML element from the DOM based on a CSS selector.
14. Which method is used to add an HTML element to the DOM in JavaScript?
- removeChild()
- createElement()
- replaceChild()
- appendChild()
15. What is the purpose of the useContext hook in React?
- To manage the state of a component.
- To perform side effects in a component, such as fetching data or updating the DOM.
- To provide data to a component from a global state.
- To connect a component to a Redux store.
16. Which hook is used to handle side effects in a React component?
- useState
- useEffect
- useContext
- useReducer
17. Which argument is passed to the useEffect hook to specify when the effect should be run?
- A function to run before the effect is run.
- An object representing the dependencies of the effect.
- A function to run after the effect is run.
- An array of values to be passed to the effect.
18. Which hook is used to connect a React component to a Redux store?
- useState
- useEffect
- useContext
- useDispatch
19. What is the purpose of the "map()" method in JavaScript?
- To iterate over the keys of an object.
- To filter elements of an array based on a condition.
- To sort elements of an array in ascending order.
- To transform each element of an array and create a new array based on the returned values.
20. What is Redux in the context of a React application?
- A third-party routing library for React applications.
- A state management library for React applications.
- A testing library for React applications.
- A component library for React applications.
21. What is the purpose of the "useEffect" hook in React?
- To manage state in a React component.
- To create a context object in a React application.
- To consume data from a context object in a React component.
- To perform side effects in a React component, such as making API calls or manipulating the DOM.
22. What is the purpose of the "dispatch" function in Redux?
- To update the state of a React component.
- To update the state of a Redux store.
- To create a new Redux store.
- To subscribe to changes in a Redux store.
23. What is an action in the context of Redux?
- An event that triggers a side effect in a React component.
- A function that updates the state of a Redux store.
- A configuration object that defines the behavior of a Redux store.
- An object that describes a state change in a Redux store, including a type and payload.