class 10 science chapter 13

ch13 part3

<!DOCTYPE html>
<html lang="en">
<head>
<title>🧠 Science Quiz – Trophic Levels and Biological Magnification</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 – Trophic Levels and Biological Magnification</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. Trophic level kya hota hai?",
    options: [
      "A. Ecosystem mein organisms ki total population",
      "B. Food chain ka har feeding step ya level",
      "C. Sirf producers ka group",
      "D. Sirf decomposers ka level"
    ],
    correct: 1,
    explanation: "Food chain mein each step or feeding level ko trophic level kaha jata hai. Producers first trophic level par hote hain."
  },
  {
    question: "2. Food chain mein humans usually kis trophic level par hote hain?",
    options: [
      "A. First level",
      "B. Second level",
      "C. Third level",
      "D. Top trophic level"
    ],
    correct: 3,
    explanation: "Humans kai food chains mein top-level consumers ho sakte hain. Isliye unke body mein non-degradable chemicals ki concentration maximum ho sakti hai."
  },
  {
    question: "3. Biological magnification kya hai?",
    options: [
      "A. Plants ki growth ka increase",
      "B. Har trophic level par non-degradable harmful chemicals ki concentration ka increase",
      "C. Food chain mein energy ka increase",
      "D. Decomposers ki population ka increase"
    ],
    correct: 1,
    explanation: "Non-degradable chemicals food chain mein progressively higher trophic levels par accumulate hote hain. Is process ko biological magnification kehte hain."
  },
  {
    question: "4. Biological magnification ka maximum effect kis organism mein ho sakta hai?",
    options: [
      "A. Producer",
      "B. Herbivore",
      "C. Secondary consumer",
      "D. Top consumer"
    ],
    correct: 3,
    explanation: "Harmful non-degradable chemicals har trophic level par progressively accumulate hote hain. Isliye top consumer mein concentration maximum ho sakti hai."
  },
  {
    question: "5. Pesticides food chain mein enter karne ka ek important way kya hai?",
    options: [
      "A. Plants pesticides ko soil aur water se absorb kar sakte hain",
      "B. Plants pesticides ko hamesha completely destroy kar dete hain",
      "C. Animals sunlight se pesticides banate hain",
      "D. Decomposers pesticides ko food mein convert karte hain"
    ],
    correct: 0,
    explanation: "Pesticides soil ya water bodies mein pahunch sakte hain. Plants unhe water aur minerals ke saath absorb kar sakte hain, aur phir food chain mein transfer ho sakte hain."
  },
  {
    question: "6. Biological magnification mainly kin chemicals ke case mein hota hai?",
    options: [
      "A. Easily degradable substances",
      "B. Non-degradable substances",
      "C. Pure water",
      "D. Oxygen"
    ],
    correct: 1,
    explanation: "Jo harmful chemicals easily degrade nahi hote, wo organisms ke body mein accumulate hote rehte hain aur higher trophic levels par concentration badh sakti hai."
  },
  {
    question: "7. Agar food chain hai: Grass → Grasshopper → Frog → Snake, to frog ka trophic level kya hoga?",
    options: [
      "A. First",
      "B. Second",
      "C. Third",
      "D. Fourth"
    ],
    correct: 2,
    explanation: "Grass → Producer → 1st trophic level<br>Grasshopper → Primary consumer → 2nd trophic level<br>Frog → Secondary consumer → 3rd trophic level<br>Snake → Tertiary consumer → 4th trophic level"
  },
  {
    question: "8. Food grains, vegetables, fruits aur meat mein pesticide residues kyun mil sakte hain?",
    options: [
      "A. Pesticides food chain mein enter karke organisms mein accumulate ho sakte hain",
      "B. Plants pesticides ko naturally produce karte hain",
      "C. Animals pesticides ko food mein convert karte hain",
      "D. Sunlight pesticides ko create karti hai"
    ],
    correct: 0,
    explanation: "Pesticides environment se plants aur animals mein enter kar sakte hain. Non-degradable chemicals ke residues food chain ke through present reh sakte hain."
  },
  {
    question: "9. Decomposers ecosystem mein kya important role perform karte hain?",
    options: [
      "A. Sirf sunlight capture karte hain",
      "B. Dead organisms aur waste ko break down karte hain",
      "C. Sirf primary consumers ko eat karte hain",
      "D. Food chain mein energy create karte hain"
    ],
    correct: 1,
    explanation: "Bacteria aur fungi dead remains aur waste products ko simple substances mein break down karte hain. Isse nutrients environment mein recycle hote hain."
  },
  {
    question: "10. Food chain mein chemicals ki concentration higher trophic levels par kyun badhti hai?",
    options: [
      "A. Higher organisms zyada sunlight absorb karte hain",
      "B. Non-degradable chemicals successive trophic levels par accumulate hote rehte hain",
      "C. Producers chemicals ko destroy kar dete hain",
      "D. Energy higher trophic levels par increase hoti hai"
    ],
    correct: 1,
    explanation: "Non-degradable chemicals body se easily remove nahi hote. Jab ek organism doosre ko consume karta hai, chemicals bhi transfer hote hain. Isliye higher trophic levels par concentration progressively increase ho sakti 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