ch12 part9
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>🧠 Ecosystem Interactions Quiz</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>🧠 Ecosystem Interactions Quiz – Competition & Relationships</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. Organisms ecosystem mein common resources ke liye compete kyun karte hain?",
options: [
"A. Food, water, space aur sunlight paane ke liye",
"B. Apna food photosynthesis se banane ke liye",
"C. Environment ko completely destroy karne ke liye",
"D. Doosre organisms ko hamesha benefit dene ke liye"
],
correct: 0,
explanation: "Organisms ko survival aur growth ke liye resources chahiye. Jab same resources limited hote hain, toh organisms ke beech competition ho sakta hai.<br><br><strong>Example:</strong> Ek forest mein different plants sunlight aur soil ke water ke liye compete kar sakte hain."
},
{
question: "2. Ecosystem mein competition ka ek important role kya hai?",
options: [
"A. Har species ko extinct karna",
"B. Population size ko control karne mein help karna",
"C. Sabhi organisms ko producers banana",
"D. Water aur sunlight ko khatam karna"
],
correct: 1,
explanation: "Limited resources ke liye competition organisms ki growth aur reproduction ko affect kar sakta hai. Isse populations regulate hone aur ecosystem ka balance maintain karne mein help mil sakti hai.<br><br><strong>Example:</strong> Agar ek area mein grass limited hai, toh zyada deer ko sufficient food nahi milega aur unki population growth limit ho sakti hai."
},
{
question: "3. Mutualism kya hota hai?",
options: [
"A. Dono organisms ko harm hota hai.",
"B. Ek organism benefit hota hai aur doosra harm hota hai.",
"C. Dono organisms benefit hote hain.",
"D. Ek organism benefit hota hai aur doosra unaffected rehta hai."
],
correct: 2,
explanation: "Mutualism mein dono organisms ko interaction se benefit milta hai.<br><br><strong>Example:</strong> Honeybee flower se nectar leti hai aur flower ki pollination mein help karti hai. Bee ko food milta hai aur flower ko reproduction mein help milti hai."
},
{
question: "4. Orchid ka tree par grow karna kis type ke interaction ka example hai?",
options: [
"A. Mutualism",
"B. Commensalism",
"C. Parasitism",
"D. Competition"
],
correct: 1,
explanation: "Commensalism mein ek organism benefit hota hai, jabki doosre organism ko na significant benefit hota hai aur na harm.<br><br><strong>Example:</strong> Orchid tree ki branch par grow karke physical support aur sunlight tak access paata hai, jabki tree generally unaffected rehta hai."
},
{
question: "5. Dog ke body par tick ka hona kis type ka interaction hai?",
options: [
"A. Mutualism",
"B. Commensalism",
"C. Parasitism",
"D. Competition"
],
correct: 2,
explanation: "Parasitism mein parasite benefit hota hai aur host ko harm hota hai. Tick dog ka blood suck karta hai, jisse dog ko skin irritation ya doosri problems ho sakti hain.<br><br><strong>Example:</strong> Tick dog ke blood se nutrition leta hai, lekin dog ko harm ho sakta hai."
},
{
question: "6. Honeybee aur flower ke relationship mein honeybee ko kya benefit milta hai?",
options: [
"A. Physical support",
"B. Nectar ke roop mein food",
"C. Dog ka blood",
"D. Soil se minerals directly"
],
correct: 1,
explanation: "Honeybee flower se nectar collect karti hai, jise woh food source ke roop mein use karti hai. Flower ko bhi pollination se benefit mil sakta hai.<br><br><strong>Example:</strong> Bee jab ek flower se doosre flower par jaati hai, toh pollen transfer ho sakta hai."
},
{
question: "7. Inmein se kaunsa commensalism ka correct example hai?",
options: [
"A. Tick aur dog",
"B. Honeybee aur flower",
"C. Orchid aur tree",
"D. Tiger aur deer"
],
correct: 2,
explanation: "Orchid tree par grow karke support paata hai, lekin tree ko generally koi significant benefit ya harm nahi hota. Isliye yeh commensalism ka example hai.<br><br><strong>Example:</strong> Kuch orchids tree ki branches par grow karte hain aur tree ko sirf support ke liye use karte hain."
},
{
question: "8. Tiger aur deer ke beech kaunsa ecological interaction hota hai?",
options: [
"A. Mutualism",
"B. Commensalism",
"C. Predation",
"D. Parasitism"
],
correct: 2,
explanation: "Predation mein ek organism, predator, doosre organism, prey, ko hunt karke khaata hai. Isse predator ko food milta hai aur prey ko harm hota hai.<br><br><strong>Example:</strong> Tiger deer ka shikaar karke apni food requirement poori kar sakta hai."
},
{
question: "9. Wildlife biologist A. J. T. Johnsingh ke research ke according, predators ki survival ke liye prey population important kyun hai?",
options: [
"A. Predators prey se food aur energy obtain karte hain.",
"B. Predators apna food photosynthesis se banate hain.",
"C. Prey population ka predators se koi relation nahi hai.",
"D. Predators ko survival ke liye water ki zaroorat nahi hoti."
],
correct: 0,
explanation: "Tigers aur leopards jaise predators deer aur wild boar jaise prey animals ko khaate hain. Agar prey population bahut kam ho jaaye, toh predators ko sufficient food milna difficult ho sakta hai.<br><br><strong>Example:</strong> Agar forest mein deer ki population bahut kam ho jaaye, toh tigers ko food dhoondhne mein difficulty ho sakti hai."
},
{
question: "10. Agar ecosystem mein ek species ki population bahut zyada badh jaaye, toh kya ho sakta hai?",
options: [
"A. Ecosystem ka balance disturb ho sakta hai.",
"B. Sabhi organisms ko equal benefit hoga.",
"C. Competition completely khatam ho jaayega.",
"D. Food aur water unlimited ho jaayenge."
],
correct: 0,
explanation: "Kisi species ki population bahut badhne par woh zyada food, water aur space use kar sakti hai. Isse doosri species ki populations aur ecosystem ke resources affect ho sakte hain.<br><br><strong>Example:</strong> Agar herbivores ki population bahut badh jaaye, toh woh grass ko zyada consume kar sakte hain, jisse doosre herbivores ke liye food kam ho sakta hai."
}
];
let currentQuestion = 0;
let score = 0;
let userAnswers = [];
let userName = "";
function startQuiz() {
userName = document.getElementById("userName").value.trim();
if (!userName) {
alert("Please enter your name.");
return;
}
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>