Module Quiz: Project Functionality

Module Quiz: Project Functionality

  1. You are implementing a stateful component in your React project which will display the number of people living in your town. Which of the following React hooks should be used to update the state of the component?

    • setEffect()

    • useEffect()

    • setState()

    • useState()

  2. What is the benefit of useState over useReducer?

    • There is no benefit.

    • useReducer is more performant.

    • useState is more performant.

  3. What is the type of data which is passed from a parent component to a child component?

    • props data

    • state data

    • mutable data

    • variable data

  4. True or False: Uncontrolled components are components that do not maintain their own state.

    • True

    • False

  5. Which React hook must be utilized when calling an API using the fetch() method?

    • useEffect

    • useState

    • useReducer

  6. Which data transfer format is most commonly used with APIs?

    • Text

    • XML

    • JSON

  7. Which one of the following code snippets is a valid unit test?

    •   unitTest("Validate title", () => {
          render(<App />); 
      
          const actualTitle = screen.getByTestId("pageTitle"); 
          const expectedTitle = "My Web Page";
      
         expect(actualTitle).toBe(expectedTitle);
        });
      
    •   test("Validate title", () => {
          render(<App />); 
      
          const actualTitle = screen.getByTestId("pageTitle"); 
          const expectedTitle = "My Web Page";
      
          expect(actualTitle).toBe(expectedTitle);
        });
      
    •   function("Validate title", () => {
          render(<App />); 
      
          const actualTitle = screen.getByTestId("pageTitle"); 
          const expectedTitle = "My Web Page";
      
          expect(actualTitle).toBe(expectedTitle);
        });
      
  8. What is this code in JavaScript:

    /Make Your Reservation/?

    • RegExp object literal

    • A string literal

    • An array literal

  9. How many major elements are outlined by the WCAG (Web Content Accessibility Guidelines) for designing accessible websites?

    • three

    • six

    • four

    • five

  10. True or False: You can use arrow functions to update the state of a component.

    • True

    • False

    • Only in some cases.

    • Only in certain types of state.