MCQs
MCQs on Our To-Do List App
Let’s quickly test what you’ve understood with some simple MCQs. Answers are at the end.
1. Which React Hook is used to create and update component state?
a. useEffect
b. useState
c. useProps
d. useReducer
2. What does the virtual DOM do in React?
a. Replaces the real DOM entirely
b. Forces full page reload
c. Updates only changed parts of the UI efficiently
d. Fetches backend data
3. What happens when the Add button is clicked with empty input?
a. It crashes the app
b. It adds an empty task
c. It alerts the user
d. It does nothing
4. What method is used to remove a to-do item from the array?
a. push()
b. pop()
c. splice()
d. add()
5. Where is task data stored in this app?
a. Backend server
b. Netlify database
c. Browser local storage
d. React component state
MCQ Answer Key
Question No. | Correct Answer | Explanation |
| 1 | b. useState | useState is the built-in React Hook used for managing component-level state. |
| 2 | c. Updates only changed parts of the UI efficiently | React uses the virtual DOM for optimal re-rendering. |
| 3 | d. It does nothing | The addTodo function checks if the input is empty before updating the list. |
| 4 | c. splice() | splice() is used to remove an item from the to-do list array by index. |
| 5 | d. React component state | All tasks are stored in the todos array using useState. |


