ch2 part8
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>🧠 Science Quiz – Human Cell: Shape and Functions</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; }
#userName {
padding: 10px;
width: 65%;
max-width: 300px;
border: 1px solid #ccc;
border-radius: 6px;
}
</style>
</head>
<body>
<div class="quiz-container">
<h2>🧠 Science Quiz – Human Cell: Shape and Functions</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. Human muscle cell ka shape generally kaisa hota hai?",
options: [
"A. Spindle-shaped",
"B. Star-shaped only",
"C. Perfectly rectangular",
"D. Cube-shaped"
],
correct: 0,
explanation: "Muscle cells generally elongated aur spindle-shaped hoti hain. Yeh contract aur relax karke body parts ki movement aur food ke movement mein help karti hain.<br><br><strong>Example:</strong> Food pipe ki muscle cells contract aur relax karke food ko stomach ki taraf push karti hain."
},
{
question: "2. Nerve cells ko aur kis naam se jaana jaata hai?",
options: [
"A. Plastids",
"B. Neurons",
"C. Vacuoles",
"D. Chloroplasts"
],
correct: 1,
explanation: "Nerve cells ko neurons kehte hain. Yeh body ke different parts tak messages ya signals transmit karti hain.<br><br><strong>Example:</strong> Jab hum kisi hot object ko touch karte hain, toh nervous system signals transmit karta hai, jisse hum haath hata sakte hain."
},
{
question: "3. Nerve cell ki long aur branched structure ka kya benefit hai?",
options: [
"A. Food ko store karna",
"B. Photosynthesis karna",
"C. Messages ko different parts tak transmit karna",
"D. Cell wall banana"
],
correct: 2,
explanation: "Neuron ki long extensions aur branches use doosri cells ke saath connections banane aur signals transmit karne mein help karti hain.<br><br><strong>Example:</strong> Brain se aane wale signals nerves ke through muscles tak pahunchte hain, jisse hum apna haath move kar paate hain."
},
{
question: "4. Human cheek cells ka main function kya hai?",
options: [
"A. Oxygen transport karna",
"B. Food ko stomach tak push karna",
"C. Nerve signals transmit karna",
"D. Cheek ki inner surface par protective lining banana"
],
correct: 3,
explanation: "Cheek cells thin aur flat hoti hain. Yeh cheek ki inner surface par lining banati hain aur underlying tissues ko protect karne mein help karti hain.<br><br><strong>Example:</strong> Mouth ke andar cheek ki surface par cells ki layer hoti hai, jo food aur other substances ke contact mein aati hai."
},
{
question: "5. Kya sabhi cells ki shape aur size same hoti hai?",
options: [
"A. Nahi, cells ki shape aur size unke type aur function ke according vary karte hain",
"B. Haan, sabhi cells round hoti hain",
"C. Haan, sabhi cells rectangular hoti hain",
"D. Sirf plant cells ki shape different hoti hai"
],
correct: 0,
explanation: "Different cells different functions perform karti hain. Isliye unki shape, size aur structure mein variation hota hai.<br><br><strong>Example:</strong> Red blood cells oxygen transport karti hain, neurons messages transmit karte hain, aur muscle cells movement mein help karti hain."
},
{
question: "6. Food pipe mein muscle cells ka kya role hota hai?",
options: [
"A. Food ko photosynthesis se banana",
"B. Food ko wave-like contractions se stomach ki taraf push karna",
"C. Blood mein oxygen carry karna",
"D. Messages ko brain tak transmit karna"
],
correct: 1,
explanation: "Food pipe ki muscles contract aur relax karti hain. Is wave-like movement ko peristalsis kehte hain, jo food ko stomach tak pahunchane mein help karta hai.<br><br><strong>Example:</strong> Jab hum roti ka bite swallow karte hain, toh food pipe ki muscular movement food ko stomach ki taraf le jaati hai."
},
{
question: "7. Stomach ki muscle cells ka main function kya hai?",
options: [
"A. Light absorb karna",
"B. Oxygen produce karna",
"C. Food ko churn aur mix karna",
"D. Body ke messages transmit karna"
],
correct: 2,
explanation: "Stomach ki wall mein muscle cells hoti hain. Yeh contract aur relax karke food ko churn karti hain aur digestive juices ke saath mix karti hain.<br><br><strong>Example:</strong> Stomach mein food digestive juices ke saath mix hokar semi-liquid mixture banata hai."
},
{
question: "8. Stomach ki inner lining mein kuch cells kya produce karti hain?",
options: [
"A. Chlorophyll aur starch",
"B. Sirf oxygen",
"C. Cell wall aur plastids",
"D. Digestive juices aur acid"
],
correct: 3,
explanation: "Stomach ki lining mein specialised cells hoti hain. Kuch cells digestive substances release karti hain, aur acid food digestion mein help karta hai.<br><br><strong>Example:</strong> Stomach ka hydrochloric acid proteins ke digestion mein help karta hai aur kai harmful microbes ko destroy karne mein bhi madad karta hai."
},
{
question: "9. Plants mein tube-like cells ka kya function ho sakta hai?",
options: [
"A. Plant mein water transport karna",
"B. Human body mein nerve signals transmit karna",
"C. Food pipe mein food push karna",
"D. Cheek ki inner lining banana"
],
correct: 0,
explanation: "Plants mein kuch specialised cells long tubes banati hain. Xylem tissue water aur dissolved minerals ko roots se plant ke other parts tak transport karta hai.<br><br><strong>Example:</strong> Roots soil se water absorb karti hain, aur xylem water ko stem aur leaves tak pahunchata hai."
},
{
question: "10. Cell ki shape aur structure uske function se kaise related hote hain?",
options: [
"A. Cell ki shape ka function se koi relation nahi hota",
"B. Cell ki shape aur structure uske specific function ko perform karne mein help karte hain",
"C. Har cell sirf ek hi shape mein hoti hai",
"D. Sirf animal cells specialised functions perform karti hain"
],
correct: 1,
explanation: "Cells ki shape aur structure unke kaam ke according adapted hote hain. Isse cells apne specific functions efficiently perform kar sakti hain.<br><br><strong>Example:</strong> Neuron ki long branches signals transmit karne mein help karti hain, jabki muscle cells ki flexible shape contraction aur relaxation ke liye suitable hoti 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 escapeHTML(str) {
return String(str).replace(/[&<>"']/g, function(char) {
return {
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'"
}[char];
});
}
function saveScore(name, score) {
let scores = JSON.parse(localStorage.getItem("quizScores")) || [];
scores.push({
name: name,
score: 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>${escapeHTML(s.name)} - ${s.score}/10 (${escapeHTML(s.date)})</li>`
).join("");
}
</script>
</body>
</html>