class 8 science chapter 13

ch13 part13

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Science Quiz – Earth and Reproduction</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;
    margin: 0;
    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;
    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;
  }

  input[type="text"] {
    padding: 10px;
    width: 60%;
    max-width: 300px;
    border: 1px solid #ccc;
    border-radius: 6px;
  }

  #scoreboard {
    margin-top: 25px;
    background: #eef3f7;
    padding: 15px;
    border-radius: 8px;
  }

  #scoreboard h3 {
    text-align: center;
  }

  ol {
    padding-left: 20px;
  }

  @media (max-width: 600px) {
    body {
      padding: 12px;
    }

    .quiz-container {
      width: 100%;
      padding: 16px;
    }

    input[type="text"] {
      width: 90%;
    }
  }
</style>
</head>

<body>

<div class="quiz-container">

  <h2>🧠 Science Quiz – Earth and Reproduction</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. Earth par liquid water exist karne ke liye kaunsa factor important hai?",
    options: [
      "A. Earth ka Sun se suitable distance",
      "B. Earth ka bilkul stationary hona",
      "C. Earth par gravity ka na hona",
      "D. Earth par atmosphere ka na hona"
    ],
    correct: 0,
    explanation: "Earth Sun se aisi distance par hai jahan temperature suitable conditions mein water ko liquid form mein exist karne deta hai. Is region ko habitable zone ya Goldilocks zone kehte hain.<br><br><strong>Example:</strong> Earth par rivers aur lakes mein liquid water milta hai, jo living organisms ke liye essential hai."
  },

  {
    question: "2. Earth ke atmosphere ko space mein escape hone se kaun rokne mein help karta hai?",
    options: [
      "A. Sunlight",
      "B. Gravity",
      "C. Ozone",
      "D. Pollination"
    ],
    correct: 1,
    explanation: "Earth ki gravity gases ko apne aas-paas hold karne mein help karti hai. Atmosphere life ke liye important gases provide karta hai aur Earth ko protect karne mein bhi help karta hai.<br><br><strong>Example:</strong> Earth ka atmosphere nitrogen aur oxygen jaise gases contain karta hai, jo Earth par life ke liye important hain."
  },

  {
    question: "3. Ozone layer ka main protective function kya hai?",
    options: [
      "A. Harmful ultraviolet rays ko absorb karna",
      "B. Earth ki gravity ko remove karna",
      "C. Oceans ka water produce karna",
      "D. Plants ki roots ko grow karna"
    ],
    correct: 0,
    explanation: "Atmosphere mein present ozone layer harmful ultraviolet (UV) radiation ke ek large part ko absorb karti hai, jisse Earth's surface par life ko protection milti hai.<br><br><strong>Example:</strong> Excessive UV exposure human skin aur eyes ko damage kar sakta hai. Ozone layer is risk ko reduce karne mein help karti hai."
  },

  {
    question: "4. Earth ka magnetic field life ko protect karne mein kaise help karta hai?",
    options: [
      "A. Saari sunlight ko block karke",
      "B. Ocean water ko freeze karke",
      "C. Charged particles ke against protection provide karke",
      "D. Earth ki rotation ko stop karke"
    ],
    correct: 2,
    explanation: "Earth ka magnetic field Sun aur space se aane wale many charged particles ko deflect karta hai. Isse Earth ke aas-paas protective environment maintain karne mein help milti hai.<br><br><strong>Example:</strong> Solar wind ke charged particles Earth ke magnetic field se interact karke aurora lights produce kar sakte hain."
  },

  {
    question: "5. Earth ke solid part ko kaunsa sphere represent karta hai?",
    options: [
      "A. Biosphere",
      "B. Hydrosphere",
      "C. Atmosphere",
      "D. Geosphere"
    ],
    correct: 3,
    explanation: "Geosphere mein Earth ka solid part include hota hai, jaise rocks, soil aur Earth's internal layers. Earth ke different systems interact karke life ko support karte hain.<br><br><strong>Example:</strong> Plants apni roots ke through soil se water aur minerals absorb karte hain."
  },

  {
    question: "6. Reproduction living organisms ke liye essential kyun hai?",
    options: [
      "A. Individual organisms ko hamesha alive rakhne ke liye",
      "B. Life ki continuity maintain karne ke liye",
      "C. Sabhi organisms ko same size ka banane ke liye",
      "D. Organisms ko food ki zaroorat se free karne ke liye"
    ],
    correct: 1,
    explanation: "Reproduction se new individuals produce hote hain aur species ki continuity generations tak maintain reh sakti hai.<br><br><strong>Example:</strong> A plant seeds produce karta hai. Suitable conditions mein ye seeds germinate hokar new plants bana sakte hain."
  },

  {
    question: "7. Asexual reproduction mein generally kitne parents new individual produce karte hain?",
    options: [
      "A. One parent",
      "B. Two parents",
      "C. Three parents",
      "D. Koi parent nahi"
    ],
    correct: 0,
    explanation: "Asexual reproduction mein generally ek parent se new individual produce hota hai. Offspring usually parent ke genetically almost identical hote hain, although mutations se differences aa sakte hain.<br><br><strong>Example:</strong> Amoeba binary fission ke through divide hokar two daughter cells produce karta hai."
  },

  {
    question: "8. Sexual reproduction ka ek important result kya ho sakta hai?",
    options: [
      "A. Har generation mein reproduction stop ho jata hai",
      "B. Offspring mein genetic material nahi hota",
      "C. Offspring mein new combinations of features aa sakte hain",
      "D. Sabhi offspring completely identical hote hain"
    ],
    correct: 2,
    explanation: "Sexual reproduction mein male aur female gametes ka genetic material combine hota hai. Isse offspring mein genetic variation aa sakti hai.<br><br><strong>Example:</strong> Human children apne parents se different combinations of features inherit kar sakte hain."
  },

  {
    question: "9. Fertilisation ke baad zygote ka kya develop ho sakta hai?",
    options: [
      "A. Ozone layer",
      "B. Embryo",
      "C. Atmosphere",
      "D. Magnetic field"
    ],
    correct: 1,
    explanation: "Male aur female gametes ke fusion se zygote banta hai. Zygote cell division karta hai aur development ke through embryo form kar sakta hai. Different animals mein embryo body ke inside ya outside develop kar sakta hai.<br><br><strong>Example:</strong> Hen ke fertilised egg mein embryo develop karta hai, jabki humans mein embryo uterus ke andar develop karta hai."
  },

  {
    question: "10. Climate change, biodiversity loss aur pollution ko collectively kya kaha jata hai?",
    options: [
      "A. Water cycle",
      "B. Food chain",
      "C. Triple planetary crisis",
      "D. Goldilocks zone"
    ],
    correct: 2,
    explanation: "Climate change, biodiversity loss aur pollution interconnected environmental problems hain. Ye ecosystems, human health aur life on Earth ko threaten karte hain.<br><br><strong>Example:</strong> Forest destruction biodiversity ko reduce kar sakta hai, stored carbon release kar sakta hai aur soil erosion ko increase kar sakta 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>
    <h3>${score >= 7 ? "🎉 Well Done!" : "📚 Keep Practising!"}</h3>
  `;
}

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