React Questions March 16, 2023 | No Comments 0 votes, 0 avg 98 123456789101112131415 React Questions 1 / 15 1. 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}} 2 / 15 2. Which method in a React Component should you override to stop the component from updating? A. shouldComponentUpdate B. will ComponentUpdate C. componentDidUpdate D. componentDidMount 3 / 15 3. Which of the following is method is not a part of ReactDOM? A. ReactDOM.hydrate() B. ReactDOM.destroy() C. ReactDOM.createPortal() D. All of the mentioned 4 / 15 4. What is the default local host port that a React development server uses? A. 3000 B. 3500 C. 5000 D. 8080 5 / 15 5. If you want to import just the Component from the React library, what syntax do you use? A. import React.Component from ‘react’ B. import [ Component ] from ‘react’ C. import Component from ‘react’ D. import { Component } from ‘react’ 6 / 15 6. 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 7 / 15 7. 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 8 / 15 8. 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. 9 / 15 9. What will be the output of the following code? import React, { Component } from 'react'; const App = () => { return( < div > < h1 className = "hello" > {25+20}< /h1 > < /div > ); } export default App; A. 25 B. 45 C. 35 D. none of these 10 / 15 10. 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 11 / 15 11. 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>; } 12 / 15 12. React Js is ______based architecture approach A. Module B. component C. package D. class 13 / 15 13. What is the correct syntax to import a Component from React? A. import { Component } from ‘react’ B. import Component from ‘react’ C. import React.Component from ‘react’ D. import [ Component ] from ‘react’ 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. As soon as the state of react component is changed, component will A. Does nothing,you have to call render method to render the component again B. re-render the component C. be created again from scratch D. none of these Your score is The average score is 41% LinkedIn Facebook Twitter VKontakte 0% Restart quiz Questions, Quiz