Quiz two_ Attempt review _ SPUMoodle.pdf

Full Transcript

10/24/24, 2:32 PM Quiz two: Attempt review | SPUMoodle Started on Thursday, 26 September 2024, 12:01 PM State Finished Completed on Thursday, 26 September 2024, 12:21 PM Time tak...

10/24/24, 2:32 PM Quiz two: Attempt review | SPUMoodle Started on Thursday, 26 September 2024, 12:01 PM State Finished Completed on Thursday, 26 September 2024, 12:21 PM Time taken 19 mins 43 secs Marks 10.00/16.00 Grade 62.50 out of 100.00 Question 1 Correct Mark 1.00 out of 1.00 In React, what is the purpose of of the spread operator(...)? a. To create new object by merging two or more objects b. To spread the properties of an object or an array into a new object or array  c. To spread the properties of an object or an array into a function's arguments d. To create new array by concatinating two or more arrays The correct answer is: To spread the properties of an object or an array into a new object or array Question 2 Correct Mark 1.00 out of 1.00 In React, what is the purpose of the key prop when working with dynamic children? a. To specifiy the order in which the child elements should be rendered b. To specify the maximum number of child elements to render c. To add unique identifier to each child element  d. To add CSS class to each child element The correct answer is: To add unique identifier to each child element https://learn.spu.ac.za/mod/quiz/review.php?attempt=298090&cmid=94611 1/6 10/24/24, 2:32 PM Quiz two: Attempt review | SPUMoodle Question 3 Incorrect Mark 0.00 out of 1.00 In React, which CSS property is used to control the spacing between elements? a. height b. border c. margin d. padding  The correct answer is: margin Question 4 Incorrect Mark 0.00 out of 1.00 In React, which CSS unit should be used for responsive designs? a. px b. % c. em  d. rem The correct answer is: % Question 5 Incorrect Mark 0.00 out of 1.00 What is the correct syntax for rendering a list of items in React using the map() function? a. {items.map((item)=> b. {item} })} c. {map(items,(item)=> {return d. {items.map((item)=> {return  The correct answer is: {items.map((item)=> https://learn.spu.ac.za/mod/quiz/review.php?attempt=298090&cmid=94611 2/6 10/24/24, 2:32 PM Quiz two: Attempt review | SPUMoodle Question 6 Correct Mark 1.00 out of 1.00 What is the property of Flux, in React a. Framework b. None of these c. Bidirectional d. Pattern  The correct answer is: Pattern Question 7 Correct Mark 1.00 out of 1.00 What is the purpose of the key prop in React? a. To identify a component b. To identify a sibling element of a component c. To identify a child element of a component  d. To identify a parent element of a component The correct answer is: To identify a child element of a component Question 8 Correct Mark 1.00 out of 1.00 Which component lifecycle method, prepopulate a form in a React form component a. componentWillMount  b. willTransitionFrom c. willTransitionTo d. componentHasMounted The correct answer is: componentWillMount https://learn.spu.ac.za/mod/quiz/review.php?attempt=298090&cmid=94611 3/6 10/24/24, 2:32 PM Quiz two: Attempt review | SPUMoodle Question 9 Correct Mark 1.00 out of 1.00 Which function in React will show child components of a provided component a. render()  b. renderComp() c. displayComponent() d. updateState() The correct answer is: render() Question 10 Incorrect Mark 0.00 out of 1.00 Which input tag attribute should be set in a React reusable text input component, and is passed for component reuse a. className b. name  c. ref d. placeHolder The correct answer is: className Question 11 Correct Mark 1.00 out of 1.00 Which item is needed for simple routing between React component but without a React Router a. The value of 'browser.url.change' b. None of these c. The hashchange event  d. The onchange event The correct answer is: The hashchange event https://learn.spu.ac.za/mod/quiz/review.php?attempt=298090&cmid=94611 4/6 10/24/24, 2:32 PM Quiz two: Attempt review | SPUMoodle Question 12 Correct Mark 1.00 out of 1.00 Which method in React Testing Library is used to check if an element is not visible on the screen? a. getByTestId b. queryByText c. getByText d. queryByTestId  The correct answer is: queryByTestId Question 13 Correct Mark 1.00 out of 1.00 Which of the following methods is used to update state in React? a. updateState() b. modifyState() c. setState()  d. changeState() The correct answer is: setState() Question 14 Correct Mark 1.00 out of 1.00 Which React component lifecycle method can be used for debugging? a. render() b. componentDidUpdate()  c. componentWillUnmount() d. component DidMount() The correct answer is: componentDidUpdate() https://learn.spu.ac.za/mod/quiz/review.php?attempt=298090&cmid=94611 5/6 10/24/24, 2:32 PM Quiz two: Attempt review | SPUMoodle Question 15 Incorrect Mark 0.00 out of 1.00 Which React DevTools feature can be used to simulate user events and interactions with a component? a. Console tab b. Profiler tab c. Network tab d. Elements tab  The correct answer is: Console tab Question 16 Incorrect Mark 0.00 out of 1.00 Which store function is not used to configure change listener in React a. None of these b. deregisterListener c. change  d. registerListener The correct answer is: None of these https://learn.spu.ac.za/mod/quiz/review.php?attempt=298090&cmid=94611 6/6

Use Quizgecko on...
Browser
Browser