--:--









Quiz for State in Class vs Functional Components

Course: REACT | Subject: React | Topic: Props and State Management



Logo

Q1: How is state defined in a React class component?

Logo

Q2: Which hook is used to manage state in functional components?

Logo

Q3: How is state updated in class components?

Logo

Q4: What does useState() return?

Logo

Q5: Which is true about class component state?

Logo

Q6: Where is the state initialized in class components?

Logo

Q7: Is it possible to use useState in class components?

Logo

Q8: What lifecycle method is used for setting initial state in class components?

Logo

Q9: Can functional components have state without hooks?

Logo

Q10: Which is the correct syntax for useState?

Logo

Q11: Which of the following is a class component?

Logo

Q12: What is the initial argument passed to useState()?

Logo

Q13: Which method is triggered after setState updates the state in class components?

Logo

Q14: Which method is deprecated in class components?

Logo

Q15: How do you conditionally update state based on previous state in class components?

Logo

Q16: Is state mutable in React?

Logo

Q17: What happens if setState is called with the same value?

Logo

Q18: What hook combines reducer logic with state?

Logo

Q19: When to use useEffect in functional components?

Logo

Q20: Which one provides cleaner code for small components?

Are you ready to start test? Set your time limit