class 10 science chapter5

ch5 part15

<!DOCTYPE html>
<html lang="en">
<head>
<title>🧠 Biology Quiz – Life Processes</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>🧠 Biology Quiz – Life Processes</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. Human beings mein kidneys kis system ka part hain?",
    options: [
      "A. Nutrition",
      "B. Respiration",
      "C. Excretion",
      "D. Transportation"
    ],
    correct: 2,
    explanation: "Kidneys blood se nitrogenous waste ko filter karke urine ke form mein body se remove karti hain. Isliye kidneys excretory system ka part hain."
  },

  {
    question: "2. Plants mein xylem ka main function kya hai?",
    options: [
      "A. Food transport karna",
      "B. Water transport karna",
      "C. Amino acids transport karna",
      "D. Oxygen transport karna"
    ],
    correct: 1,
    explanation: "Xylem roots se absorbed water aur minerals ko plant ke different parts, especially leaves, tak transport karta hai."
  },

  {
    question: "3. Autotrophic nutrition ke liye kaun-si conditions/materials required hain?",
    options: [
      "A. Carbon dioxide aur water",
      "B. Chlorophyll",
      "C. Sunlight",
      "D. All of the above"
    ],
    correct: 3,
    explanation: "Photosynthesis ke liye plants ko CO₂, water, chlorophyll aur sunlight ki requirement hoti hai. Is process mein food prepare hota hai."
  },

  {
    question: "4. Pyruvate ka breakdown karke carbon dioxide, water aur energy kis organelle mein produce hote hain?",
    options: [
      "A. Cytoplasm",
      "B. Mitochondria",
      "C. Chloroplast",
      "D. Nucleus"
    ],
    correct: 1,
    explanation: "Aerobic respiration mein pyruvate ka further breakdown mitochondria mein hota hai, jisse CO₂, water aur energy release hoti hai."
  },

  {
    question: "5. Human body mein fats ka digestion mainly kaise hota hai?",
    options: [
      "A. Bile fats ko small globules mein break karti hai aur lipase unhe digest karta hai",
      "B. Saliva fats ko completely digest karta hai",
      "C. HCl fats ko amino acids mein convert karta hai",
      "D. Fats directly blood mein absorb ho jaate hain"
    ],
    correct: 0,
    explanation: "Small intestine mein bile salts large fat globules ko small globules mein break karte hain, jise emulsification kehte hain. Phir lipase fats ko fatty acids aur glycerol mein digest karta hai."
  },

  {
    question: "6. Digestion mein saliva ka main role kya hai?",
    options: [
      "A. Proteins ko amino acids mein convert karna",
      "B. Starch ko simple sugar mein break karna",
      "C. Fats ko glycerol mein convert karna",
      "D. Blood ko filter karna"
    ],
    correct: 1,
    explanation: "Saliva mein salivary amylase enzyme hota hai, jo starch ko simple sugar mein break karne mein help karta hai."
  },

  {
    question: "7. Autotrophic nutrition ke liye necessary conditions ka correct combination kya hai?",
    options: [
      "A. Sunlight, chlorophyll, carbon dioxide aur water",
      "B. Oxygen, glucose aur protein",
      "C. Nitrogen, oxygen aur glucose",
      "D. Only sunlight and oxygen"
    ],
    correct: 0,
    explanation: "Autotrophic nutrition mein plants CO₂ aur water ko sunlight aur chlorophyll ki presence mein use karke carbohydrates banate hain. Oxygen photosynthesis ka important by-product hai."
  },

  {
    question: "8. Aerobic aur anaerobic respiration mein main difference kya hai?",
    options: [
      "A. Aerobic mein oxygen use hoti hai, anaerobic mein oxygen ki absence mein respiration ho sakti hai",
      "B. Dono mein oxygen compulsory hoti hai",
      "C. Anaerobic respiration hamesha more energy produce karti hai",
      "D. Aerobic respiration sirf plants mein hoti hai"
    ],
    correct: 0,
    explanation: "Aerobic respiration oxygen ki presence mein hoti hai aur generally more energy release karti hai. Anaerobic respiration oxygen ke bina ho sakti hai, jaise yeast mein fermentation."
  },

  {
    question: "9. Alveoli gas exchange ke liye specially designed kyun hote hain?",
    options: [
      "A. Unki walls thick hoti hain",
      "B. Unki walls one-cell thick hoti hain aur unke around extensive blood vessels hote hain",
      "C. Unmein food store hota hai",
      "D. Unmein bones present hoti hain"
    ],
    correct: 1,
    explanation: "Alveoli ki thin walls aur extensive blood-vessel network gas exchange ko efficient banate hain. Large number of alveoli large surface area provide karte hain."
  },

  {
    question: "10. Haemoglobin ki deficiency ka body par kya effect ho sakta hai?",
    options: [
      "A. Oxygen-carrying capacity reduce ho sakti hai",
      "B. Food digestion completely stop ho jaata hai",
      "C. Urine formation completely stop ho jaati hai",
      "D. Photosynthesis start ho jaati hai"
    ],
    correct: 0,
    explanation: "Haemoglobin red blood corpuscles mein present respiratory pigment hai jo oxygen ko carry karta hai. Iski deficiency se body tissues tak oxygen transport ki capacity reduce 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