class 8 science chapter 11

ch11 part8

<!DOCTYPE html>
<html lang="en">
<head>
<title>🧠 Science Quiz – Luni-solar Calendar</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; }
  .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>🧠 Science Quiz – Luni-solar Calendar</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. Luni-solar calendar kya hota hai?",
    options: [
      "A. Jo sirf Sun par based hota hai",
      "B. Jo sirf Moon par based hota hai",
      "C. Jo Moon ke phases aur seasons dono ko consider karta hai",
      "D. Jo sirf stars par based hota hai"
    ],
    correct: 2,
    explanation: "Luni-solar calendar Moon ke phases se days aur months count karta hai, lekin seasons ke saath synchronisation banaye rakhne ke liye adjustments bhi karta hai.<br><br>Example: Indian calendars mein zaroorat padne par ek extra month add kiya ja sakta hai."
  },
  {
    question: "2. 12 lunar months milkar approximately kitne days ke hote hain?",
    options: [
      "A. 300 days",
      "B. 354 days",
      "C. 365 days",
      "D. 400 days"
    ],
    correct: 1,
    explanation: "Ek lunar year mein 12 lunar months hote hain. Inki total duration approximately 354 days hoti hai.<br><br>Example: Agar har lunar year 354 days ka ho, toh 12 lunar months milkar lagbhag 354 days honge."
  },
  {
    question: "3. Lunar year, solar year se approximately kitne days chhota hota hai?",
    options: [
      "A. 5 days",
      "B. 7 days",
      "C. 11 days",
      "D. 20 days"
    ],
    correct: 2,
    explanation: "Lunar year approximately 354 days ka hota hai, jabki solar year approximately 365 days ka hota hai. Isliye difference lagbhag 11 days hai.<br><br>Example: 365 − 354 = 11 days."
  },
  {
    question: "4. Luni-solar calendars mein extra month kyun add kiya jata hai?",
    options: [
      "A. Year ko 400 days ka banane ke liye",
      "B. Lunar cycle aur solar year ko synchronised rakhne ke liye",
      "C. Moon ki speed badhane ke liye",
      "D. Har month ko 40 days ka banane ke liye"
    ],
    correct: 1,
    explanation: "Lunar year, solar year se chhota hota hai. Is difference ko adjust karne ke liye kuch saalon ke baad extra month add kiya jata hai.<br><br>Example: Extra month add karne se calendar lunar months aur seasons ke beech ka difference kam karta hai."
  },
  {
    question: "5. Luni-solar calendar mein extra month ko kya kehte hain?",
    options: [
      "A. Adhika Maasa",
      "B. Uttarayan",
      "C. Dakshinayan",
      "D. Equinox"
    ],
    correct: 0,
    explanation: "Adhika Maasa ek additional lunar month hai, jise kuch luni-solar calendars mein time adjustment ke liye add kiya jata hai.<br><br>Example: Jab lunar months aur solar year ke beech difference accumulate ho jata hai, toh calendar mein Adhika Maasa include kiya ja sakta hai."
  },
  {
    question: "6. Adhika Maasa approximately kitne saal ke interval par add kiya jata hai?",
    options: [
      "A. Har saal",
      "B. Har 2–3 saal",
      "C. Har 10 saal",
      "D. Har 20 saal"
    ],
    correct: 1,
    explanation: "Har lunar year mein approximately 11 days ka difference hota hai. Do se teen saal mein yeh difference lagbhag ek lunar month ke aas-paas ho sakta hai.<br><br>Example: 11 days × 3 years = approximately 33 days. Is accumulated difference ko adjust karne ke liye extra month add kiya ja sakta hai."
  },
  {
    question: "7. Uttarayan kis period mein Sun ki apparent movement ko kehte hain?",
    options: [
      "A. June se December",
      "B. December se June",
      "C. March se September",
      "D. January se February"
    ],
    correct: 1,
    explanation: "Sun ki apparent northward movement ko Uttarayan kaha jata hai. Textbook ke according, yeh December se June tak hoti hai.<br><br>Example: December solstice ke baad Sun sunrise ke point par dheere-dheere northward shift hota hua dikhta hai."
  },
  {
    question: "8. Dakshinayan ka kya meaning hai?",
    options: [
      "A. Sun ki apparent northward movement",
      "B. Moon ka Earth ke around revolution",
      "C. Sun ki apparent southward movement",
      "D. Earth ka apni axis par rotation"
    ],
    correct: 2,
    explanation: "June se December tak Sun ka sunrise point dheere-dheere southward shift hota hua dikhta hai. Is apparent movement ko Dakshinayan kehte hain.<br><br>Example: June solstice ke baad sunrise ka point horizon par dheere-dheere south ki taraf move karta hua nazar aata hai."
  },
  {
    question: "9. Summer solstice aur winter solstice approximately kab hote hain?",
    options: [
      "A. 21 March aur 23 September",
      "B. 21 June aur 21 December",
      "C. 1 January aur 1 July",
      "D. 15 April aur 15 October"
    ],
    correct: 1,
    explanation: "Northern Hemisphere mein summer solstice approximately 21 June aur winter solstice approximately 21 December ko hota hai. Exact date year ke according thodi vary kar sakti hai.<br><br>Example: June solstice ke aas-paas Northern Hemisphere mein daytime duration saal ke maximum ke kareeb hoti hai."
  },
  {
    question: "10. Luni-solar calendar mein kaun-se do calendar systems ke elements combine hote hain?",
    options: [
      "A. Solar aur lunar calendars",
      "B. Gregorian aur digital calendars",
      "C. Weekly aur daily calendars",
      "D. Seasonal aur clock calendars"
    ],
    correct: 0,
    explanation: "Luni-solar calendar Moon ke phases ko months count karne ke liye use karta hai aur solar year ke saath seasons ka connection banaye rakhne ke liye adjustments karta hai.<br><br>Example: Lunar months ko follow karte hue extra month add karna, luni-solar calendar ka ek important feature 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}/${questions.length} (${s.date})</li>`
    ).join("");
}
</script>
</body>
</html>

Leave a Comment