class 9 science chapter 3

ch3 part2

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>🧠 Science Quiz – Plant and Animal Tissues</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;
  }

  .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;
  }

  input[type="text"] {
    padding: 10px;
    width: 60%;
    max-width: 300px;
    border: 1px solid #ccc;
    border-radius: 6px;
  }

  #scoreboard {
    margin-top: 25px;
    background: #eef3f7;
    padding: 15px;
    border-radius: 8px;
  }

  #scoreboard h3 {
    text-align: center;
  }

  ol {
    padding-left: 20px;
  }

  .question-block {
    margin-bottom: 20px;
  }
</style>
</head>

<body>

<div class="quiz-container">

  <h2>🧠 Science Quiz – Plant and Animal Tissues</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. Plants aur animals ke tissues mein major difference ka ek reason kya hai?",
    options: [
      "A. Plants generally fixed hote hain, animals generally move kar sakte hain",
      "B. Plants ke cells mein DNA nahi hota",
      "C. Animals mein cells nahi hote",
      "D. Plants respiration nahi karte"
    ],
    correct: 0,
    explanation: "Most plants ek place par fixed hote hain, jabki animals generally locomotion kar sakte hain. Isliye dono ke tissues ki structure aur function different hote hain."
  },

  {
    question: "2. Plant cells ki cell wall plants ko kya provide karti hai?",
    options: [
      "A. Movement",
      "B. Rigidity aur strength",
      "C. Digestion",
      "D. Nervous control"
    ],
    correct: 1,
    explanation: "Plant cell wall rigidity aur strength provide karti hai, jisse plants firm aur upright reh sakte hain."
  },

  {
    question: "3. Animal cells mein rigid cell wall absent hone ka kya advantage hai?",
    options: [
      "A. Cells easily shape change kar sakti hain",
      "B. Cells photosynthesis kar sakti hain",
      "C. Cells food manufacture kar sakti hain",
      "D. Cells rigid ho jaati hain"
    ],
    correct: 0,
    explanation: "Rigid cell wall na hone ki wajah se animal cells mein flexibility hoti hai, jo body movement aur locomotion ke liye useful hai."
  },

  {
    question: "4. Plants sunlight ka use karke food kis process se synthesise karte hain?",
    options: [
      "A. Respiration",
      "B. Digestion",
      "C. Photosynthesis",
      "D. Excretion"
    ],
    correct: 2,
    explanation: "Plants solar energy ka use karke photosynthesis ke through food components synthesise karte hain."
  },

  {
    question: "5. Plants mein roots ka soil ke andar deeper grow karna kis type ki growth hai?",
    options: [
      "A. Increase in girth",
      "B. Increase in length",
      "C. Decrease in length",
      "D. No growth"
    ],
    correct: 1,
    explanation: "Roots ka deeper soil mein jaana length mein increase ko show karta hai, jaise stem ki height ka increase."
  },

  {
    question: "6. Stem ka time ke saath thicker hona kis type ki growth ko represent karta hai?",
    options: [
      "A. Increase in length",
      "B. Increase in girth",
      "C. Decrease in girth",
      "D. Cell death"
    ],
    correct: 1,
    explanation: "Stem ki thickness increase hona increase in girth kehlata hai."
  },

  {
    question: "7. Grass ke grazing ke baad dobara grow karne ke liye kis type ke tissue ki zarurat hoti hai?",
    options: [
      "A. Meristematic tissue",
      "B. Nervous tissue",
      "C. Muscle tissue",
      "D. Conducting tissue"
    ],
    correct: 0,
    explanation: "Meristematic tissue mein actively dividing cells hoti hain, jo plant ki growth aur cutting/grazing ke baad regrowth mein help karti hain."
  },

  {
    question: "8. Plants mein actively dividing cells milkar kaunsa tissue form karti hain?",
    options: [
      "A. Permanent tissue",
      "B. Meristematic tissue",
      "C. Nervous tissue",
      "D. Muscle tissue"
    ],
    correct: 1,
    explanation: "Plant growth ke liye responsible actively dividing cells ek tissue banati hain jise meristematic tissue kehte hain."
  },

  {
    question: "9. Plants ki growth ke liye meristematic tissue important kyun hai?",
    options: [
      "A. Ismein cells actively divide karti hain",
      "B. Ismein cells kabhi divide nahi karti",
      "C. Ye sirf food digest karta hai",
      "D. Ye animal movement control karta hai"
    ],
    correct: 0,
    explanation: "Meristematic tissue ki cells actively divide karti hain aur new cells produce karti hain, jisse plant ki growth possible hoti hai."
  },

  {
    question: "10. Plants mein growth ke kaunse three patterns passage mein describe kiye gaye hain?",
    options: [
      "A. Increase in length, increase in girth aur regrowth",
      "B. Digestion, respiration aur excretion",
      "C. Movement, digestion aur reproduction",
      "D. Photosynthesis, respiration aur transpiration"
    ],
    correct: 0,
    explanation: "Plants mein growth length increase, girth increase, aur cutting ya grazing ke baad regrowth ke form mein 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>

  `;

  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-block">

        <div class="question">${q.question}</div>

        <div class="options">${optsHTML}</div>

        <div class="explanation" style="display:block;">
          <strong>Explanation:</strong> ${q.explanation}
        </div>

      </div>

      <hr>

    `;

  });

  document.querySelector(".controls").style.display = "none";

  const percentage = (score / questions.length) * 100;

  document.getElementById("result").innerHTML = `
    <h3>Your Score: ${score} / ${questions.length}</h3>
    <h3>Percentage: ${percentage}%</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>${escapeHTML(s.name)} - ${s.score}/10 (${escapeHTML(s.date)})</li>`
    ).join('');
}

function escapeHTML(value) {

  return String(value).replace(/[&<>"']/g, function(char) {
    return {
      "&": "&amp;",
      "<": "&lt;",
      ">": "&gt;",
      '"': "&quot;",
      "'": "&#039;"
    }[char];
  });
}

</script>

</body>
</html>

Leave a Comment