class 9 science chapter 2

ch2 part3

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>🧠 Science Quiz – APICAL CLASSES</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; 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;
  line-height: 1.5;
}
.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; }

@media(max-width:600px) {
  body { padding: 10px; }
  .quiz-container { width: 100%; padding: 15px; }
}
</style>
</head>

<body>
<div class="quiz-container">

<h2>🧠 Science 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. Microscope ke field of view ka diameter measure karne ke liye kaunsa instrument use kiya jaata hai?",
options: [
"A. Thermometer",
"B. Transparent ruler with mm markings",
"C. Measuring cylinder",
"D. Stopwatch"
],
correct: 1,
explanation: "Microscope ke stage par <b>transparent ruler with millimetre markings</b> rakhkar field of view ka diameter measure kiya jaata hai."
},

{
question: "2. 1 millimetre (mm) mein kitne micrometres (µm) hote hain?",
options: [
"A. 10 µm",
"B. 100 µm",
"C. 1000 µm",
"D. 10,000 µm"
],
correct: 2,
explanation: "Unit conversion hai: <b>1 mm = 1000 µm</b>."
},

{
question: "3. Agar microscope ke visible field ka diameter 5 mm hai, toh woh micrometre mein kitna hoga?",
options: [
"A. 500 µm",
"B. 5000 µm",
"C. 50,000 µm",
"D. 50 µm"
],
correct: 1,
explanation: "5 mm × 1000 = 5000 µm, isliye diameter <b>5000 µm</b> hoga."
},

{
question: "4. Onion peel cell ka estimated real size find karne ke liye kaunsa formula use kiya jaata hai?",
options: [
"A. Diameter × Number of cells",
"B. Diameter ÷ Number of cells",
"C. Number of cells ÷ Diameter",
"D. Diameter + Number of cells"
],
correct: 1,
explanation: "Cell size estimate karne ke liye <b>visible field ka diameter (µm) ko diameter ke along cells ki number se divide</b> karte hain."
},

{
question: "5. Agar visible field ka diameter 5000 µm hai aur uske across 25 onion cells dikh rahe hain, toh ek cell ka estimated size kya hoga?",
options: [
"A. 100 µm",
"B. 150 µm",
"C. 200 µm",
"D. 250 µm"
],
correct: 2,
explanation: "5000 µm ÷ 25 = 200 µm. Isliye ek onion peel cell ka estimated size <b>200 µm</b> hai."
},

{
question: "6. Microscope ki total magnification kin do parts ki magnifying power par depend karti hai?",
options: [
"A. Stage aur mirror",
"B. Eyepiece aur objective lens",
"C. Base aur handle",
"D. Body tube aur stage"
],
correct: 1,
explanation: "Total magnification <b>eyepiece ki magnification × objective lens ki magnification</b> se determine hoti hai."
},

{
question: "7. Agar eyepiece 10X aur objective lens 10X magnification dete hain, toh total magnification kitni hogi?",
options: [
"A. 20X",
"B. 50X",
"C. 100X",
"D. 1000X"
],
correct: 2,
explanation: "10X × 10X = 100X. Isliye microscope ki total magnification <b>100X</b> hogi."
},

{
question: "8. Agar onion peel cell ka real size 200 µm hai aur microscope ki total magnification 100X hai, toh microscope mein cell kitna magnified appear karega?",
options: [
"A. 20 times",
"B. 100 times",
"C. 200 times",
"D. 20,000 times"
],
correct: 1,
explanation: "<b>100X magnification</b> ka matlab hai ki 200 µm ka cell microscope mein approximately <b>100 times larger</b> appear karega."
},

{
question: "9. Scientists ne microscopes ko improve karte hue mainly kaun-se three features improve kiye hain?",
options: [
"A. Weight, colour aur size",
"B. Resolution, contrast aur magnification",
"C. Temperature, pressure aur volume",
"D. Speed, mass aur density"
],
correct: 1,
explanation: "Modern microscopes mein <b>resolution (clarity), contrast (brightness difference)</b> aur <b>magnification</b> ko improve kiya gaya hai."
},

{
question: "10. Electron microscope mein highly magnified images produce karne ke liye light ki jagah kya use hota hai?",
options: [
"A. Sound waves",
"B. X-rays",
"C. Beam of electrons",
"D. Water waves"
],
correct: 2,
explanation: "<b>Electron microscope</b> light ke instead <b>electrons ki beam</b> use karta hai aur cell structures ko nanometre scale par remarkable clarity ke saath observe karne mein help 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