class 8 science chapter 11

ch11 part11

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

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

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

  #scoreboard h3 {
    text-align: center;
  }

  ol {
    padding-left: 20px;
  }

  #userName {
    padding: 10px;
    width: 60%;
    max-width: 300px;
    border: 1px solid #ccc;
    border-radius: 6px;
  }
</style>
</head>

<body>

<div class="quiz-container">

  <h2>πŸŒ™ Science Quiz – Moon Phases, Earth and Satellites</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. Moon ka kaunsa part humein Earth se visible hota hai?",
    options: [
      "A. Hamesha poora Moon",
      "B. Moon ka woh part jo sunlight reflect karke hamari taraf bhejta hai",
      "C. Sirf Moon ka dark part",
      "D. Sirf Moon ka south pole"
    ],
    correct: 1,
    explanation: "Moon apni light produce nahi karta. Woh Sun ki light reflect karta hai. Humein Moon ka wahi illuminated part dikhai deta hai jiska reflected light hamari taraf aata hai.<br><br>Example: Full Moon par humein Moon ka illuminated face almost poora circular dikhai deta hai."
  },

  {
    question: "2. Moon ki phases change hone ka main reason kya hai?",
    options: [
      "A. Earth ki shadow har raat Moon par padti hai",
      "B. Moon apni light produce karta hai",
      "C. Earth ke around Moon ki movement ke kaaran humein uska illuminated part different amounts mein dikhta hai",
      "D. Sun har month apni light band kar deta hai"
    ],
    correct: 2,
    explanation: "Sun hamesha Moon ke ek half ko illuminate karta hai. Moon ke Earth ke around move karne par humein illuminated portion ka different view milta hai, jisse phases banti hain.<br><br>Example: New Moon par Moon ka illuminated portion Earth se almost invisible hota hai, jabki Full Moon par poora visible face illuminated hota hai."
  },

  {
    question: "3. Agar kisi vyakti ka birthday Full Moon ke din ho, toh kya har saal uska birthday Full Moon par hi hoga?",
    options: [
      "A. Haan, kyunki birthday ki date fixed hoti hai",
      "B. Nahi, kyunki lunar cycle aur solar calendar ka cycle same nahi hota",
      "C. Haan, kyunki Full Moon har 30 January ko hota hai",
      "D. Nahi, kyunki Moon har saal disappear ho jata hai"
    ],
    correct: 1,
    explanation: "Birthday Gregorian calendar ki fixed date par hota hai, lekin Moon ke phases lunar cycle follow karte hain. Isliye har saal birthday par same phase hona zaroori nahi hai.<br><br>Example: 6 May ko ek saal Full Moon ho sakta hai, lekin agle saal 6 May ko Moon kisi aur phase mein ho sakta hai."
  },

  {
    question: "4. Kaunsa Moon phase sunset se sunrise tak poori raat sky mein visible reh sakta hai?",
    options: [
      "A. New Moon",
      "B. Crescent Moon",
      "C. Full Moon",
      "D. First Quarter Moon"
    ],
    correct: 2,
    explanation: "Full Moon approximately sunset ke aas-paas rise karta hai aur sunrise ke aas-paas set hota hai. Isliye woh lagbhag poori raat sky mein visible ho sakta hai.<br><br>Example: Full Moon night par Moon ko evening se early morning tak observe kiya ja sakta hai, agar sky clear ho."
  },

  {
    question: "5. Waxing Moon ka kya meaning hai?",
    options: [
      "A. Moon ka illuminated visible portion badh raha hai",
      "B. Moon ka illuminated visible portion ghat raha hai",
      "C. Moon Earth ke around move nahi kar raha",
      "D. Moon par Earth ki shadow hamesha pad rahi hai"
    ],
    correct: 0,
    explanation: "New Moon ke baad Full Moon tak Moon ka illuminated visible portion gradually increase hota hai. Is phase ko waxing kehte hain.<br><br>Example: Crescent Moon se First Quarter aur phir Gibbous Moon ki taraf badhna waxing ka example hai."
  },

  {
    question: "6. Lunar aur luni-solar calendars mein intercalary month add karne ka main purpose kya hai?",
    options: [
      "A. Har month ko 40 days ka banana",
      "B. Lunar months aur solar seasons ke beech coordination maintain karna",
      "C. Earth ki rotation ko slow karna",
      "D. Moon ko Earth ke paas lana"
    ],
    correct: 1,
    explanation: "Lunar year solar year se approximately 11 days chhota hota hai. Luni-solar calendars mein kuch saalon ke baad extra month add karke is difference ko adjust kiya jata hai.<br><br>Example: Adhika Maasa Indian luni-solar calendars mein extra month ka example hai."
  },

  {
    question: "7. Earth par ek day measure karne ka basis kya hai?",
    options: [
      "A. Moon ka Earth ke around revolution",
      "B. Earth ka apni axis par ek rotation",
      "C. Earth ka Sun ke around ek revolution",
      "D. Sun ka apni axis par rotation"
    ],
    correct: 1,
    explanation: "Day-night cycle Earth ke apni axis par rotate karne ke kaaran hota hai. Ek mean solar day approximately 24 hours ka hota hai.<br><br>Example: Jab Earth ka koi part Sun ki taraf hota hai, wahan day hota hai; opposite side par night hoti hai."
  },

  {
    question: "8. Earth ko Sun ke around ek revolution complete karne mein approximately kitna time lagta hai?",
    options: [
      "A. 24 hours",
      "B. 29.5 days",
      "C. 365ΒΌ days",
      "D. 100 minutes"
    ],
    correct: 2,
    explanation: "Earth ko Sun ke around ek revolution complete karne mein approximately 365ΒΌ days lagte hain. Isi duration par year based hota hai.<br><br>Example: Extra quarter-day ko adjust karne ke liye Gregorian calendar mein generally har chaar saal mein leap year rakha jata hai, century-year exceptions ke saath."
  },

  {
    question: "9. Artificial satellites launch karne ka important purpose kya hai?",
    options: [
      "A. Communication, navigation, weather monitoring aur research",
      "B. Earth ko stop karna",
      "C. Sun ko Earth ke around revolve karwana",
      "D. Moon ki phases ko khatam karna"
    ],
    correct: 0,
    explanation: "Artificial satellites information collect aur transmit karte hain. Ye communication services, GPS navigation, weather forecasts aur scientific studies mein help karte hain.<br><br>Example: Weather satellite cyclone ko monitor karne mein help karta hai, jabki navigation satellites location determine karne mein help karte hain."
  },

  {
    question: "10. Agar 3 saalon mein 37 Full Moons hote hain, toh kya zaroori hai ki kam se kam do Full Moons ek hi Gregorian month mein aayein?",
    options: [
      "A. Haan, kyunki Gregorian calendar mein sirf 12 months hote hain",
      "B. Nahi, kyunki har month mein exactly 3 Full Moons hote hain",
      "C. Nahi, kyunki Full Moon sirf February mein hota hai",
      "D. Haan, kyunki har saal mein sirf ek Full Moon hota hai"
    ],
    correct: 0,
    explanation: "Teen saalon mein total 36 calendar-month positions hoti hain (12 months Γ— 3 years). Lekin Full Moons 37 hain. Isliye 37 Full Moons ko 36 month positions mein distribute karne par kam se kam ek month position mein do Full Moons aane hi chahiye.<br><br>Example: Agar har month mein ek hi Full Moon hota, toh maximum 36 Full Moons hote. 37th Full Moon ki wajah se kisi ek month mein doosra Full Moon bhi aayega."
  }

];

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 = `
    <p><strong>Question ${currentQuestion + 1} of ${questions.length}</strong></p>

    <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>
    <p>${score === questions.length
      ? "Excellent! All answers are correct."
      : "Keep practicing to improve your score!"}
    </p>
  `;
}

function saveScore(name, score) {

  let scores = JSON.parse(localStorage.getItem("quizScores")) || [];

  scores.push({
    name: name,
    score: 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}/${questions.length} (${s.date})</li>`
    ).join("");
}

</script>

</body>
</html>

Leave a Comment