ch6 part3
<!DOCTYPE html>
<html lang="en">
<head>
<title>🧠 Biology Quiz – Control and Coordination</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>🧠 Biology Quiz – Control and Coordination</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. Brain aur spinal cord milkar kya constitute karte hain?",
options: [
"A. Peripheral nervous system",
"B. Central nervous system",
"C. Digestive system",
"D. Muscular system"
],
correct: 1,
explanation: "<b>Brain + spinal cord = Central Nervous System (CNS).</b> Ye body ke different parts se information receive karke integrate karta hai."
},
{
question: "2. Brain ko body ka main coordinating centre kyun kaha jaata hai?",
options: [
"A. Kyunki brain blood filter karta hai",
"B. Kyunki brain food digest karta hai",
"C. Kyunki brain information ko receive aur integrate karta hai",
"D. Kyunki brain oxygen banata hai"
],
correct: 2,
explanation: "Brain body ke different parts se information receive karta hai aur us information ko <b>integrate karke appropriate actions</b> coordinate karta hai."
},
{
question: "3. Writing, talking aur chair move karna kis type ke actions hain?",
options: [
"A. Voluntary actions",
"B. Involuntary actions",
"C. Reflex arcs",
"D. Automatic digestion"
],
correct: 0,
explanation: "In actions mein hum <b>decide karte hain ki kya karna hai</b>, isliye ye voluntary actions hain."
},
{
question: "4. Peripheral nervous system mein kaun-si nerves hoti hain?",
options: [
"A. Sirf spinal nerves",
"B. Sirf cranial nerves",
"C. Cranial nerves aur spinal nerves",
"D. Sirf sensory receptors"
],
correct: 2,
explanation: "Peripheral nervous system mein <b>cranial nerves brain se</b> aur <b>spinal nerves spinal cord se</b> arise hoti hain."
},
{
question: "5. Brain ke three major parts ya regions kaun-se hain?",
options: [
"A. Fore-brain, mid-brain aur hind-brain",
"B. Cerebrum, kidney aur cerebellum",
"C. Spinal cord, medulla aur nerves",
"D. Fore-brain, heart aur hind-brain"
],
correct: 0,
explanation: "Human brain ke three major regions <b>fore-brain, mid-brain aur hind-brain</b> hain."
},
{
question: "6. Brain ka main thinking part kaunsa hai?",
options: [
"A. Hind-brain",
"B. Fore-brain",
"C. Mid-brain",
"D. Spinal cord"
],
correct: 1,
explanation: "<b>Fore-brain</b> brain ka main thinking part hai. Ismein different sensory information receive aur interpret hoti hai."
},
{
question: "7. Fore-brain ke motor areas ka main function kya hai?",
options: [
"A. Blood ko filter karna",
"B. Food digest karna",
"C. Voluntary muscles ki movement control karna",
"D. Oxygen transport karna"
],
correct: 2,
explanation: "Motor areas information ko muscles tak bhejte hain aur <b>voluntary muscles</b>, jaise leg muscles, ki movement control karte hain."
},
{
question: "8. Blood pressure, salivation aur vomiting jaise involuntary actions ko kaunsa part control karta hai?",
options: [
"A. Cerebellum",
"B. Fore-brain",
"C. Spinal cord",
"D. Medulla in hind-brain"
],
correct: 3,
explanation: "<b>Medulla</b>, jo hind-brain ka part hai, blood pressure, salivation aur vomiting jaise <b>involuntary actions</b> ko control karta hai."
},
{
question: "9. Walking in a straight line aur bicycle riding mein kaunsa brain part important hai?",
options: [
"A. Cerebellum",
"B. Fore-brain",
"C. Medulla",
"D. Spinal cord"
],
correct: 0,
explanation: "<b>Cerebellum</b> voluntary actions mein precision aur <b>body posture aur balance</b> maintain karne mein important role play karta hai."
},
{
question: "10. Cerebellum ka major function kya hai?",
options: [
"A. Sirf hearing control karna",
"B. Sirf smell detect karna",
"C. Voluntary actions ki precision aur body ka posture-balance maintain karna",
"D. Blood ko purify karna"
],
correct: 2,
explanation: "Cerebellum movements ko <b>precise</b> banata hai aur body ka <b>posture aur balance</b> maintain karne mein help karta 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>