class 10 science chapter5

ch5 part6

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>🧠 Science Quiz – Respiration in Human Beings</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;
      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;
    }
    .options label:hover {
      background: #f0f0f0;
    }
    .options input {
      margin-right: 8px;
    }
    .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;
    }
    #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 – Respiration in Human Beings</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 lungs ke alveolar surface ko spread out karne par approximately kitna area cover ho sakta hai?",
    options: ["A. 8 m²", "B. 20 m²", "C. 80 m²", "D. 800 m²"],
    correct: 2,
    explanation: "Alveoli ki large surface area, approximately <b>80 m²</b>, gases ke exchange ko highly efficient banati hai."
  },
  {
    question: "2. Alveoli ka large surface area gas exchange ke liye kya advantage deta hai?",
    options: [
      "A. Gas exchange ke liye zyada surface available hota hai",
      "B. Food digestion fast hoti hai",
      "C. Blood cells produce hote hain",
      "D. Water storage badhta hai"
    ],
    correct: 0,
    explanation: "Large surface area ki wajah se <b>oxygen aur carbon dioxide ka exchange</b> efficiently ho pata hai."
  },
  {
    question: "3. Agar oxygen sirf diffusion ke through lungs se toes tak travel kare, to approximately kitna time lag sakta hai?",
    options: ["A. 3 minutes", "B. 3 hours", "C. 3 days", "D. 3 years"],
    correct: 3,
    explanation: "NCERT ke according, diffusion alone se oxygen molecule ko lungs se toes tak pahunchne mein approximately <b>3 years</b> lag sakte hain."
  },
  {
    question: "4. Human body mein oxygen ko lungs se tissues tak efficiently transport karne mein kaunsa substance important role play karta hai?",
    options: ["A. Pepsin", "B. Haemoglobin", "C. Chlorophyll", "D. Bile"],
    correct: 1,
    explanation: "<b>Haemoglobin</b> red blood corpuscles mein present hota hai aur oxygen ko lungs se body ke different tissues tak carry karta hai."
  },
  {
    question: "5. Terrestrial organisms ko aquatic organisms ke comparison mein oxygen obtain karne mein kya advantage hota hai?",
    options: [
      "A. Air mein oxygen ki availability water mein dissolved oxygen se zyada hoti hai",
      "B. Air mein oxygen bilkul dissolved nahi hoti",
      "C. Terrestrial organisms respiration nahi karte",
      "D. Aquatic organisms oxygen use nahi karte"
    ],
    correct: 0,
    explanation: "Water mein dissolved oxygen ki amount relatively low hoti hai, jabki terrestrial organisms atmosphere se oxygen directly obtain kar sakte hain."
  },
  {
    question: "6. Respiration mein glucose ka first breakdown kis molecule mein hota hai?",
    options: ["A. Ethanol", "B. Carbon dioxide", "C. Pyruvate", "D. Lactic acid"],
    correct: 2,
    explanation: "Six-carbon <b>glucose</b> first break hokar three-carbon <b>pyruvate</b> banata hai. Yeh step cytoplasm mein hota hai."
  },
  {
    question: "7. Oxygen ki presence mein pyruvate ka breakdown kya produce karta hai?",
    options: [
      "A. Ethanol aur carbon dioxide",
      "B. Carbon dioxide aur water",
      "C. Lactic acid aur water",
      "D. Glucose aur oxygen"
    ],
    correct: 1,
    explanation: "Aerobic respiration mein pyruvate mitochondria mein oxygen ki presence mein break hota hai aur <b>carbon dioxide + water</b> bante hain."
  },
  {
    question: "8. Human beings mein oxygen blood ke through mainly kis form mein transport hota hai?",
    options: [
      "A. Haemoglobin ke saath",
      "B. Glucose ke saath",
      "C. Plasma proteins ke saath",
      "D. Bile salts ke saath"
    ],
    correct: 0,
    explanation: "Haemoglobin ki oxygen ke liye high affinity hoti hai. Yeh red blood corpuscles mein present hota hai aur oxygen ko tissues tak transport karta hai."
  },
  {
    question: "9. Human lungs mein gas exchange ke liye alveoli ki walls ke paas kya present hota hai?",
    options: [
      "A. Digestive glands",
      "B. Extensive network of blood vessels",
      "C. Bone tissue",
      "D. Large fat deposits"
    ],
    correct: 1,
    explanation: "Alveoli ki walls mein <b>extensive blood-vessel network</b> hota hai, jo oxygen ko blood mein lene aur carbon dioxide ko alveoli mein release karne mein help karta hai."
  },
  {
    question: "10. Human lungs mein large number of alveoli hone ka main purpose kya hai?",
    options: [
      "A. Lungs ka weight increase karna",
      "B. Body temperature maintain karna",
      "C. Gas exchange ke liye maximum surface area provide karna",
      "D. Food ko store karna"
    ],
    correct: 2,
    explanation: "Bahut saare alveoli milkar <b>large surface area</b> create karte hain. Isse oxygen aur carbon dioxide ka exchange efficiently hota hai."
  }
];

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,
    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