React Questions March 16, 2023 | No Comments 0 votes, 0 avg 83 123456789101112131415 React Questions 1 / 15 1. How do you destructure the properties that are sent to the Dish component? function Dish(props) { return ( {props.name} {props.cookingTime} ); A. function Dish([name, cookingTime]) { return <h1>{name} {cookingTime}</h1>; } B. function Dish({name, cookingTime}) { return <h1>{name} {cookingTime}</h1>; } C. function Dish(props) { return <h1>{name} {cookingTime}</h1>; } D. function Dish(…props) { return <h1>{name} {cookingTime}</h1>; } 2 / 15 2. Using object literal enhancement, you can put values back into an object. When you log person to the console, what is the output? const name = 'Rachel'; const age = 31; const person = { name, age }; console.log(person); A. {{name: "Rachel", age: 31}} B. {name: "Rachel", age: 31} C. {person: "Rachel", person: 31}} D. {person: {name: "Rachel", age: 31}} 3 / 15 3. What do you call a React component that catches JavaScript errors anywhere in the child component tree? A. error bosses B. error catchers C. error helper D. error boundaries 4 / 15 4. What is the children prop? A. A property that lets you pass data to child components B. A property that lets you set an object as a property C. A property that lets you nest components in other components D. A property that adds child values to state 5 / 15 5. How can you access the state of a component from inside of a member function? A. this.state B. this.values C. this.getState() D. this.prototype.stateValue 6 / 15 6. What changes would appear in the component as soon as the state of the React component is changed? A. It will re-render the component B. It can be created again from scratch C. It will do nothing; you have to call render method to render the component again D. none 7 / 15 7. Which method in a React Component should you override to stop the component from updating? A. shouldComponentUpdate B. will ComponentUpdate C. componentDidUpdate D. componentDidMount 8 / 15 8. What is the output of the following code? const make = 'Ford'; const model = 'Mustang'; const car = { make, model }; console.log(car); A. {car: ‘Ford’, car: ‘Mustang’}} B. {{make: ‘Ford’, model: ‘Mustang’}} C. {make: ‘Ford’, model: ‘Mustang’} D. {car: {make: ‘Ford’, model: ‘Mustang’}} 9 / 15 9. In which of the following directory React Components are saved? A. Inside js/components/ B. Inside components/js/ C. Inside vendor/js/components/ D. Inside vendor/components/ 10 / 15 10. Which of the following is true about the below syntax ?disabled = {false} A. rendered as disabled B. rendered at all C. rendered as enabled D. none of these 11 / 15 11. Which of the following is NOT a rule for React Hooks? A. Hooks can be called in Class or Function components B. Hooks cannot be conditional C. Hooks can only be called inside React Function components D. Hooks can only be called at the top level of a component 12 / 15 12. What is the default local host port that a React development server uses? A. 3000 B. 3500 C. 5000 D. 8080 13 / 15 13. How can you optimize performance for a function component that always renders the same way? A. Use the shouldComponentUpdate lifecycle method. B. Use the useMemo Hook. C. Wrap it in the React.memo higher-order component. D. Use the useReducer Hook. 14 / 15 14. JSX is acronym for A. java server extension B. javascript extension C. java script extender D. none of these 15 / 15 15. What is the difference between the click behaviors of these two buttons (assuming that this.handleClick is bound correctly)? A. < button onClick={this.handleClick} > Click Me < /button > < /code> < /pre > B. < button onClick={event => this.handleClick(event)}> Click Me < /button > A. Button A will not have access to the event object on click of the button. B. Button B will not fire the handler this.handleClick successfully. C. Button A will not fire the handler this.handleClick successfully. D. There is no difference Your score is The average score is 40% LinkedIn Facebook Twitter VKontakte 0% Restart quiz Questions, Quiz