Loading

Quipoin Menu

Learn • Practice • Grow

react / Class Components in React
mcq
Direction: Choose the correct option

Q1.

Which class must a class component extend?
A. Either B or C
B. React.BaseComponent
C. React.Component
D. React.PureComponent
Direction: Choose the correct option

Q2.

In a class component, where do you initialize state?
A. In a separate method
B. In the render() method
C. In the constructor
D. In componentDidMount
Direction: Choose the correct option

Q3.

How do you access props inside a class component?
A. props
B. this.state
C. this.props
D. this.data
Direction: Choose the correct option

Q4.

Which method is called after a class component is rendered for the first time?
A. componentDidUpdate
B. render
C. componentWillMount
D. componentDidMount
Direction: Choose the correct option

Q5.

What is the purpose of the render() method in a class component?
A. To handle events
B. To initialize state
C. To return the JSX to be displayed
D. To update the DOM directly