ch11 part9
<!DOCTYPE html>
<html lang="en">
<head>
<title>🧠 Science Quiz – Indian National Calendar and Festivals</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 – Indian National Calendar and Festivals</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. Indian National Calendar ko kaun use karta hai?",
options: [
"A. Sirf private companies",
"B. Government of India",
"C. Sirf schools",
"D. Sirf banks"
],
correct: 1,
explanation: "Indian National Calendar ko Government of India, Gregorian calendar ke saath, multiple official purposes ke liye use karti hai.<br><br>Example: Official records mein Gregorian calendar ke saath Indian National Calendar ka bhi use ho sakta hai."
},
{
question: "2. Indian National Calendar kis type ka calendar hai?",
options: [
"A. Lunar calendar",
"B. Luni-solar calendar",
"C. Solar calendar",
"D. Weekly calendar"
],
correct: 2,
explanation: "Indian National Calendar solar calendar hai. Yeh Sun aur solar year par based hai aur regular year mein 365 days hote hain.<br><br>Example: Is calendar mein year ki length seasons ke cycle ke saath aligned rehti hai."
},
{
question: "3. Indian National Calendar ka New Year regular year mein kab start hota hai?",
options: [
"A. 1 January",
"B. 22 March",
"C. 15 August",
"D. 21 June"
],
correct: 1,
explanation: "Indian National Calendar ka year 22 March ko start hota hai, jo spring equinox ke agle din hota hai.<br><br>Example: Regular year mein Chaitra month ka first day 22 March ko hota hai."
},
{
question: "4. Indian National Calendar mein months mein kitne days hote hain?",
options: [
"A. Har month mein 28 days",
"B. Har month mein 29 days",
"C. Har month mein 30 ya 31 days",
"D. Har month mein 35 days"
],
correct: 2,
explanation: "Gregorian calendar se alag, Indian National Calendar mein months 30 ya 31 days ke hote hain.<br><br>Example: Regular year mein second se sixth month tak 31 days hote hain, jabki baaki months mein 30 days hote hain."
},
{
question: "5. Indian National Calendar ke leap year mein extra day kis month mein add kiya jata hai?",
options: [
"A. Vaishakha",
"B. Chaitra",
"C. Kartika",
"D. Phalguna"
],
correct: 1,
explanation: "Leap year mein Chaitra, jo Indian National Calendar ka first month hai, usmein ek extra day add kiya jata hai.<br><br>Example: Regular year mein New Year 22 March ko start hota hai, jabki leap year mein 21 March ko start hota hai."
},
{
question: "6. Diwali Moon ke kis phase par celebrate ki jati hai?",
options: [
"A. Full Moon",
"B. Crescent Moon",
"C. New Moon",
"D. First Quarter Moon"
],
correct: 2,
explanation: "Diwali, Kartika month ke New Moon day par celebrate ki jati hai. New Moon ko Amavasya bhi kehte hain.<br><br>Example: Diwali ki date Gregorian calendar mein har saal change hoti hai, kyunki yeh lunar phase par based hai."
},
{
question: "7. Holi kis lunar phase par celebrate ki jati hai?",
options: [
"A. New Moon",
"B. Full Moon",
"C. Crescent Moon",
"D. Last Quarter Moon"
],
correct: 1,
explanation: "Holi, Phalguna month ke Full Moon par celebrate ki jati hai. Full Moon ko Purnima kehte hain.<br><br>Example: Holi ki Gregorian date har saal same nahi hoti, kyunki festival lunar calendar se related hai."
},
{
question: "8. Eid-ul-Fitr kab celebrate ki jati hai?",
options: [
"A. New Moon ke din",
"B. Full Moon ke din",
"C. Ramazan ke end mein crescent Moon sighting ke baad",
"D. Summer solstice ke din"
],
correct: 2,
explanation: "Eid-ul-Fitr Ramazan ke month ke end par crescent Moon dikhne ke baad celebrate ki jati hai. Yeh Islamic lunar calendar se related hai.<br><br>Example: Moon sighting aur lunar dates ke kaaran Eid-ul-Fitr ki Gregorian date har saal change hoti hai."
},
{
question: "9. Luni-solar calendar par based festivals ki Gregorian dates mein change usually ek month se kam kyun hota hai?",
options: [
"A. Kyunki har month mein 40 days hote hain",
"B. Kyunki extra month add karke lunar aur solar year ka difference adjust kiya jata hai",
"C. Kyunki Earth rotate nahi karti",
"D. Kyunki Moon ke phases change nahi hote"
],
correct: 1,
explanation: "Luni-solar calendar mein kuch saalon ke baad Adhika Maasa ya extra month add hota hai. Isse lunar months aur solar seasons ke beech coordination bana rehta hai.<br><br>Example: Is adjustment ke kaaran Diwali jaise festivals ki Gregorian dates change hoti hain, lekin unka seasonal position generally bana rehta hai."
},
{
question: "10. Purely lunar calendar par based festival Gregorian calendar ke different months mein kyun aa sakta hai?",
options: [
"A. Lunar year solar year se chhota hota hai aur difference adjust nahi kiya jata",
"B. Solar year sirf 200 days ka hota hai",
"C. Moon har saal same phase mein rehta hai",
"D. Gregorian calendar mein leap year nahi hota"
],
correct: 0,
explanation: "Lunar year approximately 354 days ka hota hai, jabki solar year approximately 365 days ka hota hai. Purely lunar calendar seasons ke saath aligned rehne ke liye is difference ko adjust nahi karta.<br><br>Example: Eid-ul-Fitr lunar calendar follow karti hai, isliye woh alag-alag Gregorian months mein aa 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>
<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>