Question#1 Before React 16.8, only _____ could track the state and lifecycle of a React component. a) pure components b) class components ✅- Answer c) function components d) stateless components Question#2 With the advent of hooks, _____ components became almost equivalent to class components. a) stateless b) function ✅- Answer c) container d) pure Question#3 The _____ method is used to render dynamic data using props inside a class component. a) getInitialState b) render ✅- Answer c) componentDidUpdate d) useEffect Question#4 In React, _____ are immutable objects used to pass data from one component to another. a) events b) props ✅- Answer c) methods d) state Question#5 Props can be accessed in a class component using the syntax _____. a) props.this b) props() c) this.props ✅- Answer d) state.props Question#6 A component with a state is otherwise known as a _____ component. a) presentational b) stateless c) pure d) stateful ✅- Answer Question#7 You can set the initial state of a React component by assigning values to _____ inside the constructor. a) this.state ✅- Answer b) getInitialState c) state d) this.props Question#8 To update the state in a class component, the _____ method must be called. a) render b) getInitialState c) setState ✅- Answer d) componentWillUpdate Question#9 React's event handling system is called _____. a) Native Events b) React DOM Events c) Virtual Events d) Synthetic Events ✅- Answer Question#10 React events must be named in _____ rather than all lowercase like in HTML. a) PascalCase b) camelCase ✅- Answer c) kebab-case d) snake_case Question#11 To prevent the default action in a React event handler, you must call _____. a) setDefault b) stopPropagation c) preventDefault ✅- Answer d) return false Question#12 A functional component in React is essentially a _____ that returns a React element. a) JavaScript function ✅- Answer b) class instance c) React hook d) React object Question#13 Props in React are similar to _____ in regular JavaScript functions. a) function arguments ✅- Answer b) global variables c) return values d) state Question#14 To pass props to a component, you add attributes to the JSX element as you would in _____. a) HTML attributes ✅- Answer b) Java annotations c) Python decorators d) CSS selectors Question#15 The 'this.state' property can be used inside the _____ method to render state values. a) render ✅- Answer b) constructor c) componentDidMount d) useState Question#16 Modifying props from inside a component in React is _____. a) recommended b) sometimes allowed c) required d) not allowed ✅- Answer Question#17 The function used to define initial state values in legacy React components is _____. a) setState b) setInitialState c) resetState d) getInitialState ✅- Answer Question#18 With hooks, writing functional components has become the _____ way in advanced React applications. a) legacy b) optional c) deprecated d) preferred ✅- Answer Question#19 A button's click event in JSX attaches the handler as _____, not as a string. a) a function reference ✅- Answer b) a method name in quotes c) an event object d) HTML attribute Question#20 In React, to make a component interactive and dynamic, you primarily use the _____ property. a) render b) props c) state ✅- Answer d) context