class 10 science chapter 11

ch11 part11

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Electricity Quiz – APICAL CLASSES</title>
<style>
  body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #a1c4fd, #c2e9fb);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 30px;
    min-height: 100vh;
    box-sizing: border-box;
  }
  .quiz-container {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 800px;
  }
  h2 { text-align: center; color: #1e3c72; }
  .question { font-weight: bold; margin: 10px 0; line-height: 1.6; }
  .options label {
    display: block;
    margin: 8px 0;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    cursor: pointer;
    transition: 0.3s;
    line-height: 1.5;
  }
  .options label:hover { background: #f0f0f0; }
  .correct { background-color: #c8f7c5 !important; border-color: #28a745 !important; }
  .wrong { background-color: #f8d7da !important; border-color: #dc3545 !important; }
  .explanation {
    background: #e9ecef;
    padding: 10px;
    margin-top: 10px;
    margin-bottom: 20px;
    border-left: 5px solid #2a5298;
    display: none;
    line-height: 1.6;
  }
  .controls { text-align: center; margin-top: 15px; }
  button {
    background-color: #2a5298;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    margin: 5px;
  }
  button:hover { background-color: #1e3c72; }
  #scoreboard {
    margin-top: 25px;
    background: #eef3f7;
    padding: 15px;
    border-radius: 8px;
  }
  #scoreboard h3 { text-align: center; }
  ol { padding-left: 20px; }
  #userName {
    padding: 10px;
    width: 95%;
    max-width: 350px;
    border: 1px solid #ccc;
    border-radius: 6px;
    margin-bottom: 10px;
  }
  @media (max-width: 600px) {
    body { padding: 10px; }
    .quiz-container { width: 100%; padding: 15px; }
  }
</style>
</head>
<body>
<div class="quiz-container">
  <h2>🧠 Electricity Quiz – APICAL CLASSES</h2>

  <div id="nameSection">
    <p><strong>Enter your name to start:</strong></p>
    <input type="text" id="userName" placeholder="Your Name">
    <button onclick="startQuiz()">Start Quiz</button>
  </div>

  <div id="quizSection" style="display:none;">
    <div id="questionContainer"></div>

    <div class="controls">
      <button onclick="prevQuestion()" id="prevBtn">Previous</button>
      <button onclick="nextQuestion()" id="nextBtn">Next</button>
      <button onclick="submitQuiz()" id="submitBtn" style="display:none;">Submit</button>
    </div>

    <div id="result" style="text-align:center; margin-top:20px;"></div>

    <div id="scoreboard">
      <h3>🏆 Scoreboard</h3>
      <ol id="scoreList"></ol>
    </div>
  </div>
</div>

<script>
const questions = [
  {
    question: "1. Electric bulb ke filament ke liye tungsten ka use kyun kiya jata hai?",
    options: [
      "A. Iska melting point bahut low hota hai",
      "B. Iska melting point bahut high hota hai",
      "C. Ye electricity conduct nahi karta",
      "D. Ye room temperature par glow karta hai"
    ],
    correct: 1,
    explanation: "Tungsten ka melting point approximately <strong>3380°C</strong> hai. Isliye filament high temperature par bhi easily melt nahi hota."
  },
  {
    question: "2. Electric bulbs mein nitrogen aur argon jaise gases ka use kyun kiya jata hai?",
    options: [
      "A. Bulb ko thanda rakhne ke liye",
      "B. Current ko increase karne ke liye",
      "C. Filament ki life prolong karne ke liye",
      "D. Bulb ka voltage increase karne ke liye"
    ],
    correct: 2,
    explanation: "Nitrogen aur argon chemically inactive gases hain. Ye filament ki life ko <strong>prolong</strong> karne mein help karti hain."
  },
  {
    question: "3. Electric fuse ka main purpose kya hai?",
    options: [
      "A. Circuit mein current ko continuously increase karna",
      "B. Excessive current se circuit aur appliances ko protect karna",
      "C. Voltage ko double karna",
      "D. Electrical energy ko light mein convert karna"
    ],
    correct: 1,
    explanation: "Agar specified limit se zyada current flow kare, fuse wire heat hokar <strong>melt</strong> ho jata hai aur circuit break kar deta hai."
  },
  {
    question: "4. Electric fuse ko appliance ke saath kaise connect kiya jata hai?",
    options: [
      "A. Parallel mein",
      "B. Series mein",
      "C. Open circuit mein",
      "D. Battery ke bahar"
    ],
    correct: 1,
    explanation: "Fuse ko appliance ke saath <strong>series</strong> mein connect kiya jata hai, taaki excessive current aane par fuse melt hokar complete circuit ko break kar de."
  },
  {
    question: "5. Ek electric iron <strong>220 V</strong> par <strong>1 kW</strong> power consume karta hai. Ismein approximately kitna current flow hoga?",
    options: [
      "A. 2.27 A",
      "B. 4.54 A",
      "C. 5.54 A",
      "D. 10 A"
    ],
    correct: 1,
    explanation: "<strong>I = P/V</strong><br>I = 1000/220 ≈ 4.54 A.<br><br>Is situation mein <strong>5 A fuse</strong> suitable hai."
  },
  {
    question: "6. Electric power ka correct formula kaunsa hai?",
    options: [
      "A. P = V/I",
      "B. P = VI",
      "C. P = I/V",
      "D. P = R/V"
    ],
    correct: 1,
    explanation: "Electric power energy consumption ki rate hoti hai aur iska formula <strong>P = VI</strong> hai. Iske other forms <strong>P = I²R</strong> aur <strong>P = V²/R</strong> bhi hain."
  },
  {
    question: "7. Electric power ka SI unit kya hai?",
    options: [
      "A. Joule",
      "B. Volt",
      "C. Watt",
      "D. Ampere"
    ],
    correct: 2,
    explanation: "Electric power ka SI unit <strong>watt (W)</strong> hai. <strong>1 W = 1 V × 1 A.</strong>"
  },
  {
    question: "8. 1 kilowatt kitne watts ke equal hota hai?",
    options: [
      "A. 10 W",
      "B. 100 W",
      "C. 1000 W",
      "D. 10,000 W"
    ],
    correct: 2,
    explanation: "<strong>1 kW = 1000 W.</strong> Kilowatt practical situations mein commonly used larger unit of power hai."
  },
  {
    question: "9. 1 watt-hour (Wh) ka kya meaning hai?",
    options: [
      "A. 1 W power ko 1 second use karne ki energy",
      "B. 1 W power ko 1 hour use karne ki energy",
      "C. 1 kW power ko 1 hour use karne ki energy",
      "D. 1 W power ko 1 minute use karne ki energy"
    ],
    correct: 1,
    explanation: "<strong>1 Wh</strong> woh electrical energy hai jo <strong>1 W</strong> power ko <strong>1 hour</strong> tak use karne par consume hoti hai."
  },
  {
    question: "10. Commercially electrical energy ko kis unit mein measure kiya jata hai?",
    options: [
      "A. Watt",
      "B. Joule",
      "C. Kilowatt-hour (kWh)",
      "D. Volt"
    ],
    correct: 2,
    explanation: "Electrical energy ka commercial unit <strong>kilowatt-hour (kWh)</strong> hai, jise commonly <strong>1 unit of electricity</strong> kaha jata hai.<br><strong>1 kWh = 3.6 × 10⁶ J.</strong>"
  }
];

let currentQuestion = 0;
let score = 0;
let userAnswers = [];
let userName = "";

function startQuiz() {
  userName = document.getElementById("userName").value.trim();

  if (!userName) {
    alert("Please enter your name.");
    return;
  }

  document.getElementById("nameSection").style.display = "none";
  document.getElementById("quizSection").style.display = "block";

  showQuestion();
  loadScoreboard();
}

function showQuestion() {
  const q = questions[currentQuestion];
  const container = document.getElementById("questionContainer");

  container.innerHTML = `
    <div class="question">
      Question ${currentQuestion + 1} of ${questions.length}<br><br>
      ${q.question}
    </div>
    <div class="options">
      ${q.options.map((opt, i) => `
        <label>
          <input type="radio" name="option" value="${i}"
            ${userAnswers[currentQuestion] === i ? "checked" : ""}>
          ${opt}
        </label>
      `).join("")}
    </div>
  `;

  document.getElementById("prevBtn").style.display =
    currentQuestion === 0 ? "none" : "inline-block";

  document.getElementById("nextBtn").style.display =
    currentQuestion === questions.length - 1 ? "none" : "inline-block";

  document.getElementById("submitBtn").style.display =
    currentQuestion === questions.length - 1 ? "inline-block" : "none";
}

function nextQuestion() {
  saveAnswer();

  if (currentQuestion < questions.length - 1) {
    currentQuestion++;
    showQuestion();
  }
}

function prevQuestion() {
  saveAnswer();

  if (currentQuestion > 0) {
    currentQuestion--;
    showQuestion();
  }
}

function saveAnswer() {
  const selected = document.querySelector('input[name="option"]:checked');
  userAnswers[currentQuestion] = selected ? parseInt(selected.value) : null;
}

function submitQuiz() {
  saveAnswer();

  score = 0;

  questions.forEach((q, index) => {
    if (userAnswers[index] === q.correct) {
      score++;
    }
  });

  showResults();
  saveScore(userName, score);
  loadScoreboard();
}

function showResults() {
  const container = document.getElementById("questionContainer");
  container.innerHTML = "";

  questions.forEach((q, index) => {
    const selected = userAnswers[index];
    const correct = q.correct;

    const optsHTML = q.options.map((opt, i) => {
      let cls = "";

      if (i === correct) {
        cls = "correct";
      }

      if (selected === i && selected !== correct) {
        cls = "wrong";
      }

      return `<label class="${cls}">${opt}</label>`;
    }).join("");

    container.innerHTML += `
      <div class="question">${q.question}</div>
      <div class="options">${optsHTML}</div>
      <div class="explanation" style="display:block;">
        <strong>Explanation:</strong><br>
        ${q.explanation}
      </div>
      <hr>
    `;
  });

  document.querySelector(".controls").style.display = "none";

  document.getElementById("result").innerHTML = `
    <h3>Your Score: ${score} / ${questions.length}</h3>
    <p>${score === questions.length ? "Excellent! Perfect Score!" : "Keep Practicing!"}</p>
  `;
}

function saveScore(name, score) {
  let scores = JSON.parse(localStorage.getItem("quizScores")) || [];

  scores.push({
    name: name,
    score: score,
    date: new Date().toLocaleString()
  });

  localStorage.setItem("quizScores", JSON.stringify(scores));
}

function loadScoreboard() {
  let scores = JSON.parse(localStorage.getItem("quizScores")) || [];

  scores.sort((a, b) => b.score - a.score);

  document.getElementById("scoreList").innerHTML = scores.map(s =>
    `<li>${s.name} - ${s.score}/10 (${s.date})</li>`
  ).join("");
}
</script>
</body>
</html>

Leave a Comment