class 8 science chapter 13

ch13 part5

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>đź§  Earth, Life and Natural Resources Quiz</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; }
  input[type="text"] {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    width: 60%;
    max-width: 300px;
  }
</style>
</head>
<body>
<div class="quiz-container">
  <h2>đź§  Earth, Life and Natural Resources Quiz</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 life ko sustain karne ke liye kaun-si cheezein important hain?",
    options: [
      "A. Sirf air aur sunlight",
      "B. Sirf water aur soil",
      "C. Air, water, sunlight aur living-non-living things ke connections",
      "D. Sirf minerals"
    ],
    correct: 2,
    explanation: "Earth par life ko survive karne ke liye air, water, sunlight, soil aur minerals jaise natural resources ki zaroorat hoti hai. Living aur non-living things ek-doosre ke saath interact karti hain, jisse life sustain hoti hai.<br><br>Example: Plants ko grow karne ke liye sunlight, water, air aur soil ki zaroorat hoti hai. Animals plants se food aur oxygen prapt kar sakte hain."
  },
  {
    question: "2. Plants photosynthesis ke dauran air se kaunsi gas lete hain?",
    options: [
      "A. Oxygen",
      "B. Carbon dioxide",
      "C. Nitrogen",
      "D. Hydrogen"
    ],
    correct: 1,
    explanation: "Photosynthesis ke dauran plants air se carbon dioxide aur soil se water lete hain. Sunlight ki presence mein ve apna food banate hain aur oxygen release karte hain.<br><br>Example: Ek green plant sunlight mein carbon dioxide aur water ka use karke glucose banata hai aur oxygen release karta hai."
  },
  {
    question: "3. Photosynthesis ke dauran plants kaunsi gas release karte hain, jo respiration ke liye zaroori hai?",
    options: [
      "A. Carbon dioxide",
      "B. Nitrogen",
      "C. Oxygen",
      "D. Hydrogen"
    ],
    correct: 2,
    explanation: "Photosynthesis mein plants oxygen release karte hain. Humans aur animals respiration ke liye oxygen ka use karte hain.<br><br>Example: Ek tree photosynthesis ke dauran oxygen release karta hai, jiska use humans breathing ke liye karte hain."
  },
  {
    question: "4. Greenhouse effect Earth ke temperature ko kaise maintain karta hai?",
    options: [
      "A. Sunlight ko completely block karke",
      "B. Atmosphere mein kuch heat trap karke",
      "C. Earth ka saara water freeze karke",
      "D. Oxygen ko atmosphere se remove karke"
    ],
    correct: 1,
    explanation: "Sun ki radiation Earth ko heat karti hai. Atmosphere is heat ka kuch hissa trap karta hai, jisse Earth ka temperature liquid water aur life ke liye suitable bana rehta hai.<br><br>Example: Agar atmosphere heat ko trap karne mein help nahi karta, toh Earth zyada thandi ho sakti thi aur liquid water ko maintain karna difficult hota."
  },
  {
    question: "5. Earth ki surface ka approximately kitna percentage water se covered hai?",
    options: [
      "A. 10%",
      "B. 30%",
      "C. 50%",
      "D. 70%"
    ],
    correct: 3,
    explanation: "Earth ki surface ka lagbhag 70–71% hissa water se covered hai. Water oceans, seas, rivers, lakes aur groundwater mein milta hai.<br><br>Example: Pacific Ocean, Indian Ocean aur Atlantic Ocean Earth ke water-covered surface ke bade parts hain."
  },
  {
    question: "6. Earth par present water ke total system ko kya kaha jata hai?",
    options: [
      "A. Atmosphere",
      "B. Lithosphere",
      "C. Hydrosphere",
      "D. Biosphere"
    ],
    correct: 2,
    explanation: "Hydrosphere mein Earth ka water shamil hota hai, jaise oceans, seas, rivers, lakes, ponds aur groundwater.<br><br>Example: River ka water, ocean ka water aur underground water—ye sab hydrosphere ka part hain."
  },
  {
    question: "7. Plants mein water ka ek important function kya hai?",
    options: [
      "A. Roots ko sunlight banana",
      "B. Soil se leaves tak nutrients transport karna",
      "C. Oxygen ko destroy karna",
      "D. Photosynthesis ko permanently stop karna"
    ],
    correct: 1,
    explanation: "Water plants mein dissolved nutrients ko roots se doosre parts, including leaves, tak pahunchane mein help karta hai. Water photosynthesis ke liye bhi essential hai.<br><br>Example: Roots soil se water aur dissolved minerals absorb karti hain, jo plant ke stem ke through leaves tak pahunchte hain."
  },
  {
    question: "8. Animals ke body mein water ka kya role hai?",
    options: [
      "A. Sirf bones ko colour dena",
      "B. Digestion, hydration aur body temperature regulate karna",
      "C. Respiration ko completely stop karna",
      "D. Body se saara oxygen remove karna"
    ],
    correct: 1,
    explanation: "Animals ke body mein water digestion, nutrients ke transport aur body temperature ko regulate karne mein help karta hai. Water ki kami se dehydration ho sakta hai.<br><br>Example: Garmi mein sweating ke through human body heat release karti hai. Is process mein water important role play karta hai."
  },
  {
    question: "9. Water vapour atmosphere mein clouds banane aur rainfall laane mein kaise help karta hai?",
    options: [
      "A. Water vapour cool hokar condense hota hai aur clouds banata hai",
      "B. Water vapour soil ko directly rocks mein badal deta hai",
      "C. Water vapour oxygen ko nitrogen mein badal deta hai",
      "D. Water vapour sunlight ko permanently block kar deta hai"
    ],
    correct: 0,
    explanation: "Water vapour cool hone par tiny water droplets ya ice crystals mein condense ho sakta hai. Ye clouds banate hain. Suitable conditions mein water rain ya snow ke form mein Earth par wapas aata hai.<br><br>Example: Monsoon ke time clouds se rainfall hoti hai, jo rivers, lakes aur groundwater ko refill karne mein help karti hai."
  },
  {
    question: "10. Rainfall aur moving air ka farming aur life par kya effect hota hai?",
    options: [
      "A. Inka farming par koi effect nahi hota",
      "B. Ye weather, water supply aur plants ki growth ko influence karte hain",
      "C. Ye saare plants ko destroy karte hain",
      "D. Ye Earth ki gravity ko khatam kar dete hain"
    ],
    correct: 1,
    explanation: "Rainfall water supply ko affect karti hai, jabki moving air weather aur rainfall patterns ko influence karti hai. In conditions ke according kisi area mein plants aur animals ki types alag ho sakti hain.<br><br>Example: Rice ki farming ke liye generally zyada water ki zaroorat hoti hai, jabki kuch crops kam rainfall wale areas mein bhi grow kar sakti hain."
  }
];

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">${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: 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}/${questions.length} (${s.date})</li>`
    ).join("");
}
</script>
</body>
</html>

Leave a Comment