Loading

Quipoin Menu

Learn • Practice • Grow

react / React Components
mcq
Direction: Choose the correct option

Q1.

What are React components?
A. Functions that return HTML strings
B. Third-party libraries
C. Reusable pieces of UI that return React elements
D. Classes that directly manipulate the DOM
Direction: Choose the correct option

Q2.

Which of the following is a valid way to define a React component?
A. All of the above
B. class MyComponent extends React.Component { render() { return <div>Hi</div>; } }
C. function MyComponent() { return <div>Hi</div>; }
D. const MyComponent = () => { return <div>Hi</div>; }
Direction: Choose the correct option

Q3.

What must every React component return?
A. A string
C. A single root React element
D. An array of elements
Direction: Choose the correct option

Q4.

What is the difference between a React element and a React component?
A. A component is a function/class; an element is the object returned from it
B. An element is a component instance
C. They are the same
D. Components are written in JSX, elements in HTML
Direction: Choose the correct option

Q5.

Which lifecycle method is mandatory in a class component?
A. render()
B. componentDidMount()
C. constructor()
D. componentWillUnmount()