React Questions March 16, 2023 | No Comments 0 votes, 0 avg 108 123456789101112131415 React Questions 1 / 15 1. How many ways of defining your variables in ES6? A. 3 B. 1 C. 4 D. 2 2 / 15 2. React.js was Initially released in ……………. A. May 29, 2013 B. April 29, 2013 C. june 29,2013 D. May 29,2014 3 / 15 3. 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. 4 / 15 4. React.js is written in which of the following language? A. c B. c++ C. java D. javascript 5 / 15 5. What happens when the following render() method executes? render(){ let langs = ["PHP","ES6","JAVA"] return ( < div> {langs.map(it => < p > {it} < /p > )} < /div > ) } A. Error:cannot use direct javascript code in jsx B. error:should be replaced with a for..loop fo correct output C. display the list of language in the array D. displays nothing 6 / 15 6. How can you combine the following arrays using the spread operator? A. const combined = [array1, array2]; B. const combined = …array1 + …array2; C. const combined = […array1, …array2]; D. const combined = array1 + array2; 7 / 15 7. 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>; } 8 / 15 8. How do you fix the syntax error that results from running this code? const person =(firstName, lastName) => { first: firstName, last: lastName } console.log(person("Jill", "Wilson")) A. Wrap the object in parentheses. B. Call the function from another file. C. Add a return statement before the first curly brace. D. Replace the object with an array. 9 / 15 9. 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'}} 10 / 15 10. 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 11 / 15 11. What is the declarative way to render a dynamic list of components based on values in an array? A. Using the reduce array method B. Using the <Each /> component C. Using the Array.map() method D. With a for/while loop 12 / 15 12. 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 13 / 15 13. For controlled components in react A. Source of truth is DOM B. Source of truth can be anything C. Source of truth is component D. none of these 14 / 15 14. Why React is faster then normal websites? A. it does not use any DOM B. It uses Original DOM C. it uses Virtual DOM D. none of these 15 / 15 15. What is the default local host port that a React development server uses? A. 3000 B. 3500 C. 5000 D. 8080 Your score isThe average score is 43% LinkedIn Facebook VKontakte 0% Restart quiz By WordPress Quiz plugin Questions, Quiz