ch5 part4
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>🧠 Science Quiz – Life Processes</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 – Dental Caries & Life Processes</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. Dental caries ya tooth decay mein mainly kya hota hai?",
options: [
"A. Enamel aur dentine gradually soften hote hain",
"B. Teeth ka colour hamesha white ho jaata hai",
"C. Sirf tongue damage hoti hai",
"D. Saliva completely stop ho jaata hai"
],
correct: 0,
explanation: "Dental caries mein <b>enamel aur dentine gradually soften</b> hote hain. Untreated condition mein infection tooth ke pulp tak pahunch sakta hai."
},
{
question: "2. Teeth par bacteria sugars par act karke kya produce karte hain?",
options: [
"A. Oxygen",
"B. Acids",
"C. Proteins",
"D. Vitamins"
],
correct: 1,
explanation: "Bacteria sugars par act karke <b>acids produce</b> karte hain. Ye acids enamel ko soften aur demineralise kar sakte hain."
},
{
question: "3. Dental plaque kya hota hai?",
options: [
"A. Sirf saliva ka layer",
"B. Sirf food particles",
"C. Bacterial cells aur food particles ka mass",
"D. Tooth ka hard inner part"
],
correct: 2,
explanation: "<b>Dental plaque</b> bacterial cells aur food particles ka mass hota hai jo teeth par stick ho jaata hai."
},
{
question: "4. Dental plaque teeth par cover hone ke baad saliva acid ko neutralise kyun nahi kar paata?",
options: [
"A. Saliva mein water nahi hota",
"B. Plaque tooth surface ko cover kar deta hai",
"C. Saliva sirf stomach mein hota hai",
"D. Bacteria saliva ko completely absorb kar lete hain"
],
correct: 1,
explanation: "Plaque teeth ki surface ko cover kar deta hai, isliye <b>saliva tooth surface tak easily nahi pahunch pata</b> aur acid ko neutralise nahi kar pata."
},
{
question: "5. Dental caries ko prevent karne ke liye eating ke baad brushing kaise help karti hai?",
options: [
"A. Plaque remove karke",
"B. Stomach acid ko remove karke",
"C. Food ko protein mein convert karke",
"D. Saliva production stop karke"
],
correct: 0,
explanation: "Eating ke baad brushing se <b>dental plaque remove</b> hota hai, before bacteria sugars par act karke acids produce karein."
},
{
question: "6. Autotrophic nutrition mein organisms food banane ke liye mainly kya use karte hain?",
options: [
"A. Ready-made complex food",
"B. Carbon dioxide aur water",
"C. Proteins aur fats",
"D. Sirf oxygen"
],
correct: 1,
explanation: "Autotrophs, jaise green plants, <b>carbon dioxide aur water</b> ko use karke photosynthesis ke through carbohydrates prepare karte hain."
},
{
question: "7. Heterotrophic nutrition aur autotrophic nutrition mein main difference kya hai?",
options: [
"A. Heterotrophs apna food simple inorganic substances se banate hain",
"B. Autotrophs sirf animals hote hain",
"C. Heterotrophs nutrition ke liye other organisms se obtained complex food par depend karte hain",
"D. Dono mein koi difference nahi hai"
],
correct: 2,
explanation: "<b>Autotrophs</b> apna food khud prepare kar sakte hain, jabki <b>heterotrophs</b> food ke liye directly ya indirectly other organisms par depend karte hain."
},
{
question: "8. Plants photosynthesis ke liye water kahan se obtain karte hain?",
options: [
"A. Atmosphere se leaves ke through",
"B. Soil se roots ke through",
"C. Fruits se",
"D. Flowers se"
],
correct: 1,
explanation: "Terrestrial plants <b>soil se roots ke through water</b> absorb karte hain. Water photosynthesis ke liye required raw material hai."
},
{
question: "9. Digestive enzymes ka main function kya hai?",
options: [
"A. Complex food molecules ko simpler molecules mein break down karna",
"B. Food ko body se bahar nikalna",
"C. Oxygen ko blood mein carry karna",
"D. Teeth ko hard banana"
],
correct: 0,
explanation: "Digestive enzymes biological catalysts hain jo <b>complex food substances ko simpler molecules</b> mein break down karte hain, taaki unka absorption ho sake."
},
{
question: "10. Small intestine digested food ko efficiently absorb karne ke liye kaise designed hai?",
options: [
"A. Iski inner lining par numerous villi hote hain",
"B. Ismein teeth present hote hain",
"C. Ismein sirf mucus present hota hai",
"D. Iska surface completely smooth hota hai"
],
correct: 0,
explanation: "Small intestine ki inner lining par <b>finger-like villi</b> hote hain jo surface area increase karte hain. Villi mein blood vessels bhi hoti hain jo absorbed nutrients ko body ke cells tak le jaati hain."
}
];
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}/${questions.length} (${s.date})</li>`
).join('');
}
</script>
</body>
</html>