class 8 science chapter 9

ch9 part1

<!DOCTYPE html>
<html lang="en">
<head>
<title>🧠 Science Quiz – Solutions and Mixtures</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;
  }

  .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; }

  .options label {
    display: block;
    margin: 8px 0;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    cursor: pointer;
    transition: 0.3s;
  }

  .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;
    border-left: 5px solid #2a5298;
    display: none;
  }

  .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; }
</style>
</head>

<body>

<div class="quiz-container">

  <h2>🧠 Science Quiz – Solutions and Mixtures</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. ORS mein sugar aur salt water mein evenly distribute kyun hote hain?",
    options: [
      "A. Kyunki sugar aur salt elements hain",
      "B. Kyunki sugar aur salt water mein dissolve hokar uniform mixture banate hain",
      "C. Kyunki water ek solid hai",
      "D. Kyunki salt water mein dissolve nahi hota"
    ],
    correct: 1,
    explanation: "Jab salt aur sugar water mein dissolve ho jaate hain, toh mixture ke different parts mein unka distribution approximately same hota hai. Isliye har sip ka taste similar hota hai, agar solution achhi tarah mix kiya gaya ho.<br><br>Example: Homemade ORS mein sugar aur salt ko recommended quantity mein water ke saath mix kiya jata hai."
  },

  {
    question: "2. Salt aur water ko mix karne par generally kaun-sa mixture banta hai?",
    options: [
      "A. Non-uniform mixture",
      "B. Uniform mixture",
      "C. Pure element",
      "D. Pure metal"
    ],
    correct: 1,
    explanation: "Salt water mein dissolve hokar evenly distribute ho jata hai. Isliye salt solution ek uniform mixture hota hai.<br><br>Example: Ek glass water mein salt dissolve karne par, achhi tarah mix karne ke baad, solution ke har part mein salt present hota hai."
  },

  {
    question: "3. Chalk powder ko water mein mix karne par generally kya banta hai?",
    options: [
      "A. Uniform solution",
      "B. Pure substance",
      "C. Non-uniform mixture",
      "D. Compound"
    ],
    correct: 2,
    explanation: "Chalk powder water mein properly dissolve nahi hota. Iske particles water mein suspended reh sakte hain aur baad mein neeche settle ho sakte hain. Isliye mixture non-uniform hota hai.<br><br>Example: Water mein mitti milane par bhi particles settle ho sakte hain."
  },

  {
    question: "4. Solution kise kehte hain?",
    options: [
      "A. Sirf solids ke mixture ko",
      "B. Ek uniform mixture ko",
      "C. Sirf gases ko",
      "D. Ek non-uniform mixture ko"
    ],
    correct: 1,
    explanation: "Solution ek uniform mixture hota hai, jisme solute solvent mein dissolve hokar evenly distribute hota hai.<br><br>Example: Sugar water ek solution hai, kyunki sugar water mein dissolve hokar uniform mixture banati hai."
  },

  {
    question: "5. Jab salt ko water mein dissolve kiya jata hai, toh salt kya kehlata hai?",
    options: [
      "A. Solvent",
      "B. Solute",
      "C. Solution",
      "D. Suspension"
    ],
    correct: 1,
    explanation: "Solute woh substance hota hai jo solvent mein dissolve hota hai. Salt water mein dissolve hota hai, isliye salt solute hai.<br><br>Example: Sugar water mein sugar solute hoti hai."
  },

  {
    question: "6. Salt solution mein water ka role kya hota hai?",
    options: [
      "A. Solute",
      "B. Solvent",
      "C. Element",
      "D. Non-uniform mixture"
    ],
    correct: 1,
    explanation: "Solvent woh substance hota hai jisme solute dissolve hota hai. Salt solution mein water salt ko dissolve karta hai, isliye water solvent hai.<br><br>Example: Sugar solution mein bhi water solvent hota hai."
  },

  {
    question: "7. Salt + Water milkar kya banate hain?",
    options: [
      "A. Salt aur oxygen",
      "B. Solute aur element",
      "C. Solution",
      "D. Sirf solvent"
    ],
    correct: 2,
    explanation: "Jab solute solvent mein dissolve hota hai, toh solution form hota hai.<br><br>Example: Salt (solute) + Water (solvent) = Salt solution."
  },

  {
    question: "8. Sand ko water mein mix karne par mixture non-uniform kyun hota hai?",
    options: [
      "A. Sand water mein completely dissolve ho jati hai",
      "B. Sand ke particles evenly dissolved nahi hote",
      "C. Water ek element hai",
      "D. Sand liquid ban jati hai"
    ],
    correct: 1,
    explanation: "Sand water mein dissolve nahi hoti. Iske particles alag dikh sakte hain aur kuch time baad neeche settle ho sakte hain.<br><br>Example: Beach ki sand ko water mein daalne par sand aur water ke separate parts dekhe ja sakte hain."
  },

  {
    question: "9. Jab do liquids ko mix kiya jata hai aur ek liquid doosre ke comparison mein kam quantity mein hota hai, toh generally kam quantity wala liquid kya kehlata hai?",
    options: [
      "A. Solvent",
      "B. Solute",
      "C. Element",
      "D. Mineral"
    ],
    correct: 1,
    explanation: "Jab do liquids mein yeh clearly identify karna difficult ho ki kaun kis mein dissolve ho raha hai, toh is chapter ke rule ke according smaller amount mein present substance ko solute aur larger amount wale substance ko solvent kaha jata hai.<br><br>Example: Agar ek solution mein 10 mL substance A aur 90 mL substance B ho, toh is rule ke according A solute aur B solvent hoga."
  },

  {
    question: "10. Inmein se kaun-sa uniform mixture ka example hai?",
    options: [
      "A. Sawdust + Water",
      "B. Chalk powder + Water",
      "C. Sugar + Water",
      "D. Sand + Water"
    ],
    correct: 2,
    explanation: "Sugar water mein dissolve hokar evenly distribute hoti hai, isliye sugar solution uniform mixture hai. Sawdust, chalk powder aur sand water mein properly dissolve nahi hote.<br><br>Example: Ek glass water mein sugar ko achhi tarah dissolve karne par solution ke different sips ka sweetness approximately same hota hai."
  }

];

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

function startQuiz() {

  userName = document.getElementById("userName").value.trim();

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

  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">${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>

    <div class="explanation" id="explain${currentQuestion}">
      ${q.explanation}
    </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;

    let 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;">
        ${q.explanation}
      </div>

      <hr>

    `;
  });

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

  document.getElementById("result").innerHTML =
    `<h3>Your Score: ${score} / ${questions.length}</h3>`;
}

function saveScore(name, score) {

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

  scores.push({
    name,
    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