MCQs on our Quiz App
MCQs
What hook was used to fetch trivia data from the API when the component mounted?
a. useRef
b. useState
c. useEffect
d. useMemoWhat 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 answersWhere is the category list fetched from?
a. React API
b. Netlify
c. Vite
d. Open Trivia DB APIWhat does the decodeHtml() utility function do?
a. Runs animations
b. Converts encoded HTML into readable text
c. Submits user answers
d. None of the aboveHow 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:
- c – useEffect is used to perform side effects like fetching data after the component mounts
- b – shuffle() ensures the options appear in a random order for each question
- d – The category list is fetched from Open Trivia DB’s category endpoint
- b – Some API responses contain HTML entities that need to be decoded to plain text
- c – Answers are styled as green/red and listed clearly in a result table with correct status


