Quiz

import React, { useState } from “react”; import { Card, CardContent } from “@/components/ui/card”; import { Button } from “@/components/ui/button”; import { Input } from “@/components/ui/input”; import * as XLSX from “xlsx”; export default function QuizUploader() { const [questions, setQuestions] = useState([]); const handleFileUpload = (e) => { const file = e.target.files[0]; const reader = new FileReader(); reader.onload = (evt) => { const bstr = evt.target.result; const wb = XLSX.read(bstr, { type: “binary” }); const wsname = wb.SheetNames[0]; const ws = wb.Sheets[wsname]; const data = XLSX.utils.sheet_to_json(ws); const newQuestions = data.map((row) => ({ question: row.Question, options: [row.OptionA, row.OptionB, row.OptionC, row.OptionD], answer: row.Answer, })); setQuestions((prev) => […prev, …newQuestions]); }; reader.readAsBinaryString(file); }; return (

🧠 Quiz Upload & Preview

📂 Admin Panel (Upload Excel File)

Only admin should access this area.

{questions.map((q, index) => (

Q{index + 1}: {q.question}

    {q.options.map((opt, idx) => (
  • {opt}
  • ))}

✔️ Correct Answer: {q.answer}

))}
); }

Stay informed about the latest government job updates with our Sarkari Job Update website. We provide timely and accurate information on upcoming government job vacancies, application deadlines, exam schedules, and more.

Categories

Category 1

Category 2

Category 3

Category 4

Category 5