class 10 science chapter5

ch5 part9

<!DOCTYPE html>
<html lang="en">
<head>
<title>🧠 Blood Vessels and Lymph Quiz – APICAL CLASSES</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<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>🧠 Blood Vessels and Lymph Quiz – APICAL CLASSES</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. Arteries blood ko kis direction mein carry karti hain?",
    options: [
      "A. Heart se body ke organs ki taraf",
      "B. Organs se heart ki taraf",
      "C. Lungs se directly veins ki taraf",
      "D. Cells se capillaries ki taraf"
    ],
    correct: 0,
    explanation: "Arteries heart se blood ko away, yani various organs of the body ki taraf le jaati hain."
  },
  {
    question: "2. Arteries ki walls thick aur elastic kyun hoti hain?",
    options: [
      "A. Blood mein oxygen nahi hoti",
      "B. Blood heart se high pressure par nikalta hai",
      "C. Arteries blood ko filter karti hain",
      "D. Arteries mein valves hote hain"
    ],
    correct: 1,
    explanation: "Heart se blood high pressure ke saath nikalta hai, isliye arteries ki walls thick aur elastic hoti hain."
  },
  {
    question: "3. Veins ka main function kya hai?",
    options: [
      "A. Blood ko heart se organs tak le jaana",
      "B. Blood ko filter karna",
      "C. Different organs se blood ko heart tak laana",
      "D. Blood clotting karna"
    ],
    correct: 2,
    explanation: "Veins different organs se blood collect karke heart ki taraf wapas laati hain."
  },
  {
    question: "4. Veins mein valves ka kya function hota hai?",
    options: [
      "A. Blood pressure increase karna",
      "B. Blood ko oxygenate karna",
      "C. Blood ko clot karna",
      "D. Blood ko sirf ek direction mein flow karwana"
    ],
    correct: 3,
    explanation: "Veins mein valves hote hain jo ensure karte hain ki blood only one direction mein flow kare aur backward flow na ho."
  },
  {
    question: "5. Blood vessels ki sabse chhoti vessels ko kya kaha jata hai?",
    options: [
      "A. Arteries",
      "B. Veins",
      "C. Capillaries",
      "D. Lymph vessels"
    ],
    correct: 2,
    explanation: "Arteries organs tak pahunchkar smaller vessels mein divide hoti hain. Sabse small vessels ko capillaries kehte hain."
  },
  {
    question: "6. Capillaries ki walls generally kitni thick hoti hain?",
    options: [
      "A. One-cell thick",
      "B. Two-cell thick",
      "C. Three-cell thick",
      "D. Four-cell thick"
    ],
    correct: 0,
    explanation: "Capillaries ki walls one-cell thick hoti hain. Is thin wall ke through blood aur surrounding cells ke beech materials ka exchange hota hai."
  },
  {
    question: "7. Injury ke time blood loss ko minimise karne mein kaun help karta hai?",
    options: [
      "A. Plasma",
      "B. Platelets",
      "C. Red blood cells",
      "D. Lymph"
    ],
    correct: 1,
    explanation: "Platelets injury ke point par blood ko clot karne mein help karte hain aur leak ko plug kar dete hain."
  },
  {
    question: "8. Platelets blood vessels mein leak ko kaise control karte hain?",
    options: [
      "A. Oxygen release karke",
      "B. Blood pressure badhakar",
      "C. Blood ko clot karne mein help karke",
      "D. Plasma ko remove karke"
    ],
    correct: 2,
    explanation: "Platelets injury wali jagah par collect hokar blood clotting mein help karte hain, jisse blood loss minimise hota hai."
  },
  {
    question: "9. Lymph kya hai?",
    options: [
      "A. Ek type ka tissue fluid",
      "B. Ek type ka artery",
      "C. Ek type ka red blood cell",
      "D. Ek digestive enzyme"
    ],
    correct: 0,
    explanation: "Lymph ya tissue fluid capillaries se kuch plasma, proteins aur blood cells ke intercellular spaces mein escape hone se form hota hai."
  },
  {
    question: "10. Lymph intestine se mainly kya transport karta hai?",
    options: [
      "A. Oxygen",
      "B. Digested and absorbed fat",
      "C. Carbon dioxide",
      "D. Nitrogen gas"
    ],
    correct: 1,
    explanation: "Lymph intestine se digested aur absorbed fat ko carry karta hai. Ye extracellular spaces se excess fluid ko bhi blood mein wapas drain karta 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