ch5 part12
<!DOCTYPE html>
<html lang="en">
<head>
<title>Science Quiz – Human Excretory System</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 – Human Excretory System</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. Body se harmful metabolic wastes ko remove karne ki biological process ko kya kehte hain?",
options: [
"A. Nutrition",
"B. Respiration",
"C. Excretion",
"D. Transportation"
],
correct: 2,
explanation: "Harmful metabolic wastes ko body se remove karne ki biological process ko <b>excretion</b> kehte hain."
},
{
question: "2. Many unicellular organisms apne wastes ko mainly kaise remove karte hain?",
options: [
"A. Simple diffusion se body surface ke through",
"B. Kidneys ke through",
"C. Lungs ke through",
"D. Urinary bladder ke through"
],
correct: 0,
explanation: "Many unicellular organisms wastes ko <b>simple diffusion</b> ke through body surface se surrounding water mein remove karte hain."
},
{
question: "3. Human excretory system mein kidneys ki number kitni hoti hai?",
options: [
"A. One",
"B. Two",
"C. Three",
"D. Four"
],
correct: 1,
explanation: "Human excretory system mein <b>a pair of kidneys</b>, yani <b>two kidneys</b>, hoti hain."
},
{
question: "4. Kidneys human body mein kahan located hoti hain?",
options: [
"A. Chest mein",
"B. Head mein",
"C. Abdomen mein, backbone ke dono sides par",
"D. Legs mein"
],
correct: 2,
explanation: "Kidneys <b>abdomen</b> mein located hoti hain, aur backbone ke <b>one on either side</b> hoti hain."
},
{
question: "5. Kidneys mein produced urine sabse pehle kis tube ke through urinary bladder tak jaata hai?",
options: [
"A. Urethra",
"B. Ureter",
"C. Nephron",
"D. Bowman's capsule"
],
correct: 1,
explanation: "Kidney mein urine produce hone ke baad <b>ureters</b> ke through urinary bladder tak jaata hai."
},
{
question: "6. Human body mein urine ka main purpose kya hai?",
options: [
"A. Oxygen ko store karna",
"B. Food ko digest karna",
"C. Blood se waste products ko filter out karna",
"D. Blood pressure increase karna"
],
correct: 2,
explanation: "Urine formation ka main purpose <b>blood se waste products ko filter out</b> karna hai, jaise urea aur uric acid."
},
{
question: "7. Kidneys blood se kaun-se nitrogenous wastes remove karti hain?",
options: [
"A. Oxygen aur carbon dioxide",
"B. Glucose aur amino acids",
"C. Urea aur uric acid",
"D. Water aur salts"
],
correct: 2,
explanation: "Kidneys blood se <b>nitrogenous wastes</b>, jaise <b>urea aur uric acid</b>, remove karti hain."
},
{
question: "8. Kidney ki basic filtration unit ko kya kehte hain?",
options: [
"A. Alveolus",
"B. Nephron",
"C. Ureter",
"D. Urinary bladder"
],
correct: 1,
explanation: "Kidney mein large numbers mein <b>nephrons</b> hote hain. Nephron kidney ki <b>basic filtration unit</b> hai."
},
{
question: "9. Initial filtrate mein se kaun-si substances selectively re-absorb ho sakti hain?",
options: [
"A. Glucose, amino acids, salts aur major amount of water",
"B. Sirf urea",
"C. Sirf carbon dioxide",
"D. Sirf uric acid"
],
correct: 0,
explanation: "Urine tube mein flow karte waqt <b>glucose, amino acids, salts aur large amount of water</b> selectively re-absorb kiye jaate hain."
},
{
question: "10. Urine body se kis structure ke through bahar release hota hai?",
options: [
"A. Ureter",
"B. Kidney",
"C. Bowman's capsule",
"D. Urethra"
],
correct: 3,
explanation: "Urine kidneys se ureters ke through <b>urinary bladder</b> mein store hota hai aur finally <b>urethra</b> ke through body se bahar release hota 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>