ch13 part12
<!DOCTYPE html>
<html lang="en">
<head>
<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; }
.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 – 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. Air pollution ka ek major source kaunsa hai?",
options: [
"A. Planting trees",
"B. Vehicles aur factories se nikalne wala smoke",
"C. Rainwater harvesting",
"D. Recycling paper"
],
correct: 1,
explanation: "Vehicles aur factories se harmful gases aur particles air mein release hote hain. Ye air quality ko kharab karte hain aur humans, animals aur plants ko harm pahuncha sakte hain.<br><br>Example: Traffic ke smoke mein saans lene se kuch logon ko coughing aur breathing problems ho sakti hain."
},
{
question: "2. Acid rain hone ka ek important reason kya hai?",
options: [
"A. Air mein harmful gases ka release hona",
"B. Trees ko water dena",
"C. Solar energy ka use karna",
"D. Plastic ko recycle karna"
],
correct: 0,
explanation: "Factories aur power plants se release hone wali sulphur dioxide aur nitrogen oxides atmosphere mein reactions karke acids bana sakti hain. Ye acids rainwater ke saath Earth par gir sakte hain.<br><br>Example: Acid rain lakes aur soil ko damage kar sakti hai aur buildings ko bhi corrode kar sakti hai."
},
{
question: "3. Climate change ka crops par kya effect ho sakta hai?",
options: [
"A. Har crop ki growth hamesha increase hoti hai",
"B. Crops ko water ki zaroorat nahi hoti",
"C. Crop growth aur production affect ho sakte hain",
"D. Soil pollution completely stop ho jata hai"
],
correct: 2,
explanation: "Temperature, rainfall aur water availability mein changes crops ki growth ko affect kar sakte hain. Extreme heat aur drought se crop production decrease bhi ho sakta hai.<br><br>Example: Agar kisi area mein long time tak rainfall na ho, toh farmers ki wheat crop ko sufficient water nahi mil sakta."
},
{
question: "4. Montreal Protocol, 1987 ka main purpose kya tha?",
options: [
"A. Plastic production increase karna",
"B. Harmful ozone-depleting chemicals ko reduce karna",
"C. Vehicles ki speed increase karna",
"D. Forests ko cities mein convert karna"
],
correct: 1,
explanation: "Montreal Protocol ek international agreement hai jo ozone layer ko damage karne wale substances, jaise CFCs, ko phase out karne mein help karta hai. Isse ozone layer ki recovery mein madad mili hai.<br><br>Example: Refrigeration aur air-conditioning mein use hone wale kuch older CFC-based substances ko phase out kiya gaya."
},
{
question: "5. Paris Agreement, 2015 ka main objective kya hai?",
options: [
"A. Global warming ko limit karne ke liye greenhouse gas emissions reduce karna",
"B. Har country mein coal ka use increase karna",
"C. Water pollution ko ignore karna",
"D. Ozone layer ko completely remove karna"
],
correct: 0,
explanation: "Paris Agreement countries ko climate change se deal karne aur greenhouse gas emissions reduce karne ke liye encourage karta hai. Iska temperature goal global warming ko 2°C se kaafi neeche rakhna aur 1.5°C tak limit karne ki efforts pursue karna hai.<br><br>Example: Solar aur wind energy ka use badhakar fossil fuels par dependence reduce ki ja sakti hai."
},
{
question: "6. Water pollution ka aquatic animals par kya effect ho sakta hai?",
options: [
"A. Unhe hamesha extra food milta hai",
"B. Unka habitat aur survival threaten ho sakta hai",
"C. Water automatically pure ho jata hai",
"D. Unhe oxygen ki zaroorat nahi hoti"
],
correct: 1,
explanation: "Factory waste, plastic aur harmful chemicals water bodies ko pollute karte hain. Isse aquatic organisms ki health, reproduction aur survival affect ho sakti hai.<br><br>Example: River mein plastic waste aur harmful chemicals pahunchne se fish aur other aquatic animals ko harm ho sakta hai."
},
{
question: "7. Excess fertilisers aur poor waste disposal se soil pollution kaise hota hai?",
options: [
"A. Soil hamesha more fertile ho jati hai",
"B. Soil se saare harmful substances disappear ho jate hain",
"C. Harmful substances soil mein accumulate hokar crops ko affect kar sakte hain",
"D. Soil pollution ka food chain se koi relation nahi hai"
],
correct: 2,
explanation: "Fertilisers ka excessive use aur improper waste disposal soil mein harmful substances ki quantity badha sakte hain. Kuch pollutants crops mein enter karke food chain tak pahunch sakte hain.<br><br>Example: Contaminated soil mein grow hui crops kuch harmful substances absorb kar sakti hain."
},
{
question: "8. Earth ke atmosphere, hydrosphere, biosphere aur geosphere ke baare mein correct statement kaunsa hai?",
options: [
"A. Ye completely independent systems hain",
"B. Ek system ko damage hone se doosre systems affect nahi hote",
"C. Ye interconnected hain aur ek mein damage doosron ko affect kar sakta hai",
"D. Inka life on Earth se koi relation nahi hai"
],
correct: 2,
explanation: "Atmosphere air, hydrosphere water, biosphere living organisms aur geosphere Earth ke solid parts ko represent karte hain. Ye systems ek-doosre ke saath interact karte hain.<br><br>Example: Factory ka chemical waste soil se groundwater mein ja sakta hai aur plants, animals aur humans ko affect kar sakta hai."
},
{
question: "9. Reusing, repairing aur recycling items ka main benefit kya hai?",
options: [
"A. Waste aur pollution ko reduce karna",
"B. Natural resources ko unnecessarily waste karna",
"C. Air pollution increase karna",
"D. Water bodies mein plastic add karna"
],
correct: 0,
explanation: "Items ko reuse, repair aur recycle karne se new raw materials ki demand aur waste ki quantity reduce ho sakti hai. Isse natural resources conserve karne mein help milti hai.<br><br>Example: Plastic bottle ko safely reuse karna ya paper recycle karna unnecessary waste ko reduce kar sakta hai."
},
{
question: "10. Biodiversity ko protect karna ecosystems ke liye important kyun hai?",
options: [
"A. Isse saare organisms identical ho jaate hain",
"B. Isse food chains permanently stop ho jaati hain",
"C. Diverse ecosystems zyada resilient aur balanced ho sakte hain",
"D. Isse pollution automatically completely disappear ho jata hai"
],
correct: 2,
explanation: "Biodiversity ka meaning hai living organisms ki variety. Different organisms ecosystem mein different roles perform karte hain. Biodiversity ecosystem ko environmental changes aur disturbances ka saamna karne mein help kar sakti hai.<br><br>Example: Forest mein different plants, insects, birds aur animals food webs aur nutrient cycling ko support karte hain."
}
];
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>