ch2 part123
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Science Quiz – Microorganisms and Cells</title>
<style>
* { box-sizing: border-box; }
body {
font-family: Arial, sans-serif;
background: linear-gradient(135deg, #a1c4fd, #c2e9fb);
display: flex;
justify-content: center;
align-items: flex-start;
padding: 30px 15px;
min-height: 100vh;
margin: 0;
}
.quiz-container {
background: #fff;
padding: 25px;
border-radius: 12px;
box-shadow: 0 4px 10px rgba(0,0,0,0.2);
width: 100%;
max-width: 800px;
}
h2 { text-align: center; color: #1e3c72; }
.question {
font-weight: bold;
margin: 10px 0 15px;
line-height: 1.6;
}
.options label {
display: block;
margin: 8px 0;
padding: 12px;
border-radius: 6px;
border: 1px solid #ccc;
cursor: pointer;
transition: 0.3s;
line-height: 1.5;
}
.options label:hover { background: #f0f0f0; }
.options input { margin-right: 8px; }
.correct {
background-color: #c8f7c5 !important;
border-color: #28a745 !important;
}
.wrong {
background-color: #f8d7da !important;
border-color: #dc3545 !important;
}
.explanation {
background: #e9ecef;
padding: 12px;
margin-top: 12px;
border-left: 5px solid #2a5298;
border-radius: 5px;
line-height: 1.6;
display: none;
}
.controls { text-align: center; margin-top: 20px; }
button {
background-color: #2a5298;
color: white;
border: none;
padding: 11px 20px;
border-radius: 6px;
cursor: pointer;
margin: 5px;
font-size: 15px;
}
button:hover { background-color: #1e3c72; }
input[type="text"] {
padding: 11px;
width: 100%;
max-width: 350px;
border: 1px solid #aaa;
border-radius: 6px;
margin: 10px 0;
}
#scoreboard {
margin-top: 25px;
background: #eef3f7;
padding: 15px;
border-radius: 8px;
}
#scoreboard h3 { text-align: center; }
#scoreList { padding-left: 25px; line-height: 1.8; }
.question-progress {
color: #555;
font-weight: bold;
margin-bottom: 12px;
}
hr { border: 0; border-top: 1px solid #ddd; margin: 22px 0; }
@media (max-width: 600px) {
body { padding: 12px; }
.quiz-container { padding: 18px; }
h2 { font-size: 21px; }
}
</style>
</head>
<body>
<div class="quiz-container">
<h2>🧠 Science Quiz – Microorganisms and Cells</h2>
<div id="nameSection">
<p><strong>Enter your name to start:</strong></p>
<input type="text" id="userName" placeholder="Your Name">
<br>
<button onclick="startQuiz()">Start Quiz</button>
</div>
<div id="quizSection" style="display:none;">
<div id="questionContainer"></div>
<div class="controls" id="quizControls">
<button onclick="prevQuestion()" id="prevBtn">Previous</button>
<button onclick="nextQuestion()" id="nextBtn">Next</button>
<button onclick="submitQuiz()" id="submitBtn" style="display:none;">Submit Quiz</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. Microorganisms ko hum apni naked eyes se kyun nahi dekh sakte?",
options: [
"A. Kyunki woh non-living hote hain",
"B. Kyunki unka size bahut chhota hota hai",
"C. Kyunki unmein cells nahi hote",
"D. Kyunki woh sirf paani mein rehte hain"
],
correct: 1,
explanation: "Microorganisms bahut small-sized organisms hote hain. Unhe clearly dekhne ke liye usually microscope ki zaroorat hoti hai.<br><br><strong>Example:</strong> Bacteria ko normally naked eyes se nahi dekh sakte, lekin microscope se observe kar sakte hain."
},
{
question: "2. Unicellular organism kaun-sa hota hai?",
options: [
"A. Human",
"B. Mango tree",
"C. Bacteria",
"D. Dog"
],
correct: 2,
explanation: "Unicellular organisms sirf ek cell se bane hote hain. Ek hi cell unke essential life functions perform karta hai.<br><br><strong>Example:</strong> Bacteria aur Amoeba unicellular organisms hain, jabki humans multicellular hain."
},
{
question: "3. Cell ko life ki basic unit kyun kaha jata hai?",
options: [
"A. Kyunki sabhi cells ka colour green hota hai",
"B. Kyunki cells living organisms ki structure aur functions mein important role play karte hain",
"C. Kyunki cells sirf plants mein hote hain",
"D. Kyunki cells sirf food store karte hain"
],
correct: 1,
explanation: "Cell living organisms ki basic structural aur functional unit hai. Cells ke components organism ko survive karne aur life functions perform karne mein help karte hain.<br><br><strong>Example:</strong> Human body mein muscle cells movement aur nerve cells messages transmit karne mein help karti hain."
},
{
question: "4. Typical cell ke andar kaunsa component hota hai?",
options: [
"A. Cytoplasm",
"B. Sirf cell wall",
"C. Sirf chloroplast",
"D. Sirf nucleoid"
],
correct: 0,
explanation: "Typical cell mein cell membrane hoti hai, cytoplasm hota hai aur eukaryotic cells mein nucleus hota hai. Bacteria mein well-defined nucleus nahi hota.<br><br><strong>Example:</strong> Plant aur animal cells dono mein cytoplasm present hota hai."
},
{
question: "5. Plant, fungal aur bacterial cells mein cell membrane ke bahar kaunsi extra covering ho sakti hai?",
options: [
"A. Nuclear membrane",
"B. Cell wall",
"C. Chloroplast",
"D. Nucleoid"
],
correct: 1,
explanation: "Plant, fungal aur bacterial cells mein cell wall hoti hai, jo support aur protection provide karti hai. Animal cells mein cell wall nahi hoti.<br><br><strong>Example:</strong> Plant ki cell wall cellulose se bani hoti hai, jabki fungal cell wall mein chitin hota hai."
},
{
question: "6. Bacteria ki cells ki ek important feature kya hai?",
options: [
"A. Har bacteria mein chloroplast hota hai",
"B. Bacteria mein well-defined nucleus nahi hota",
"C. Bacteria hamesha multicellular hote hain",
"D. Bacteria mein genetic material nahi hota"
],
correct: 1,
explanation: "Bacteria prokaryotic organisms hain. Inka DNA nucleoid region mein hota hai, lekin uske around nuclear membrane nahi hoti.<br><br><strong>Example:</strong> E. coli bacteria mein DNA nucleoid region mein present hota hai."
},
{
question: "7. Cells ki shape ka relation kis cheez se hota hai?",
options: [
"A. Sirf organism ke colour se",
"B. Sirf organism ke size se",
"C. Cell ke function se",
"D. Cell ke naam se"
],
correct: 2,
explanation: "Different cells different functions perform karte hain. Isliye unki shape aur structure unke kaam ke according adapted ho sakte hain.<br><br><strong>Example:</strong> Nerve cells ki long extensions messages ko door tak transmit karne mein help karti hain."
},
{
question: "8. Viruses doosre microorganisms se kis tarah different hain?",
options: [
"A. Viruses hamesha multicellular hote hain",
"B. Viruses sirf plants mein reproduce karte hain",
"C. Viruses reproduce karne ke liye host cell par depend karte hain",
"D. Viruses mein hamesha chloroplast hota hai"
],
correct: 2,
explanation: "Viruses apne aap independently reproduce nahi kar sakte. Unhe kisi suitable host cell ki machinery ki zaroorat hoti hai.<br><br><strong>Example:</strong> Influenza virus human cells ka use karke apni copies banata hai."
},
{
question: "9. Leguminous plants ki roots mein Rhizobium bacteria ka kya role hota hai?",
options: [
"A. Soil se saara water remove karna",
"B. Nitrogen fixation karke soil fertility badhane mein help karna",
"C. Roots ko destroy karna",
"D. Photosynthesis ko stop karna"
],
correct: 1,
explanation: "Rhizobium leguminous plants ki roots ke nodules mein rehta hai aur atmospheric nitrogen ko usable nitrogen compounds mein convert karne mein help karta hai. Isse soil fertility improve hoti hai.<br><br><strong>Example:</strong> Peas, beans aur lentils ki roots mein Rhizobium bacteria mil sakte hain."
},
{
question: "10. Curd formation mein kaunsa microorganism use hota hai?",
options: [
"A. Lactobacillus",
"B. Rhizobium",
"C. Amoeba",
"D. Bread mould"
],
correct: 0,
explanation: "Lactobacillus bacteria milk mein lactose ko lactic acid mein convert karte hain. Is process se milk sour hota hai aur curd form hota hai.<br><br><strong>Example:</strong> Ghar par lukewarm milk mein thoda sa purana curd milane se Lactobacillus grow kar sakta hai aur milk ko curd mein badal deta hai."
}
];
let currentQuestion = 0;
let score = 0;
let userAnswers = [];
let userName = "";
let submitted = false;
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-progress">
Question ${currentQuestion + 1} of ${questions.length}
</div>
<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>
`;
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 saveAnswer() {
const selected = document.querySelector('input[name="option"]:checked');
userAnswers[currentQuestion] = selected
? parseInt(selected.value, 10)
: null;
}
function nextQuestion() {
saveAnswer();
if (currentQuestion < questions.length - 1) {
currentQuestion++;
showQuestion();
}
}
function prevQuestion() {
saveAnswer();
if (currentQuestion > 0) {
currentQuestion--;
showQuestion();
}
}
function submitQuiz() {
saveAnswer();
const unanswered = userAnswers.filter(answer => answer === null || answer === undefined).length;
if (unanswered > 0) {
const confirmSubmit = confirm(
`You have ${unanswered} unanswered question(s). Do you still want to submit?`
);
if (!confirmSubmit) return;
}
score = 0;
questions.forEach((q, index) => {
if (userAnswers[index] === q.correct) {
score++;
}
});
submitted = true;
showResults();
saveScore(userName, score);
loadScoreboard();
}
function showResults() {
const container = document.getElementById("questionContainer");
container.innerHTML = "";
questions.forEach((q, index) => {
const selected = userAnswers[index];
const optsHTML = q.options.map((opt, i) => {
let cls = "";
if (i === q.correct) cls = "correct";
if (selected === i && selected !== q.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;">
<strong>Explanation:</strong><br>${q.explanation}
</div>
<hr>
`;
});
document.getElementById("quizControls").style.display = "none";
document.getElementById("result").innerHTML = `
<h3>Your Score: ${score} / ${questions.length}</h3>
<p>${score === questions.length
? "Excellent! All answers are correct."
: "Good effort! Review the explanations and keep practising."}</p>
`;
}
function saveScore(name, score) {
let scores = [];
try {
scores = JSON.parse(localStorage.getItem("quizScores")) || [];
if (!Array.isArray(scores)) scores = [];
} catch (error) {
scores = [];
}
scores.push({
name: name,
score: score,
date: new Date().toLocaleString()
});
localStorage.setItem("quizScores", JSON.stringify(scores));
}
function loadScoreboard() {
let scores = [];
try {
scores = JSON.parse(localStorage.getItem("quizScores")) || [];
if (!Array.isArray(scores)) scores = [];
} catch (error) {
scores = [];
}
scores.sort((a, b) => b.score - a.score);
const scoreList = document.getElementById("scoreList");
scoreList.innerHTML = "";
scores.forEach(s => {
const li = document.createElement("li");
li.textContent = `${s.name} - ${s.score}/10 (${s.date})`;
scoreList.appendChild(li);
});
}
</script>
</body>
</html>