MCQs on our Quiz App

MCQs

  1. What hook was used to fetch trivia data from the API when the component mounted?
    a. useRef
    b. useState
    c. useEffect
    d. useMemo

  2. What is the purpose of the shuffle() function in the quiz app?
    a. Style the questions
    b. Randomize the order of options
    c. Fetch new questions
    d. Submit the answers

  3. Where is the category list fetched from?
    a. React API
    b. Netlify
    c. Vite
    d. Open Trivia DB API

  4. What does the decodeHtml() utility function do?
    a. Runs animations
    b. Converts encoded HTML into readable text
    c. Submits user answers
    d. None of the above

  5. How does the app display whether a user's answer was correct or incorrect?
    a. Through alerts
    b. By navigating to a new page
    c. By color-coded buttons and scorecard
    d. By console logs

Answer Key:

  1. c – useEffect is used to perform side effects like fetching data after the component mounts
  2. b – shuffle() ensures the options appear in a random order for each question
  3. d – The category list is fetched from Open Trivia DB’s category endpoint
  4. b – Some API responses contain HTML entities that need to be decoded to plain text
  5. c – Answers are styled as green/red and listed clearly in a result table with correct status