Quiz App in React JS | Most Asked React Interview Question
Repel:
https://replit.com/@mahdifarooqui/qui...
Question:
Quiz App
Create a React app that displays a multiple-choice quiz.
Requirements:
Quiz Data:
Use a hardcoded array of questions in the component, each with:
A question string.
An array of options.
A correctAnswer index.
Example data structure:
const quizData = [
{
question: "What is the capital of France?",
options: ["Berlin", "Madrid", "Paris", "Rome"],
correctAnswer: 2,
},
{
question: "What is 2 + 2?",
options: ["3", "4", "5", "6"],
correctAnswer: 1,
},
];
Functionality:
Display one question at a time.
Allow the user to select an answer by clicking on an option.
After selecting an answer, display whether it was correct or incorrect and move to the next question.
State Management:
Use React state to track the current question, selected answer
Bonus:
Add a "Restart Quiz" button to let the user retake the quiz.
This question tests knowledge of React state, event handling, and conditional rendering!
Music from #Uppbeat (free for Creators!):
https://uppbeat.io/t/matrika/overdrive
License code: 5VQ44JC4V7BOIO0E
react interview questions,react interview,react interview questions and answers,react,react js interview questions,react js interview questions and answers,javascript interview questions,reactjs interview questions,frontend interview questions,react js interview,react js interview questions and answers for freshers,interview,react js interview questions and answers for experienced,react interview questions in hindi,react job interview
Информация по комментариям в разработке