ch2 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 – APICAL CLASSES</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;
margin: 0;
}
.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;
line-height: 1.6;
}
.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;
line-height: 1.6;
}
.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: 90%;
max-width: 350px;
border: 1px solid #ccc;
border-radius: 6px;
}
</style>
</head>
<body>
<div class="quiz-container">
<h2>🧠 Science Quiz – APICAL CLASSES</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. Cells ko apne surroundings aur other cells ke saath interact karne ke liye mainly kis boundary par substances ka exchange hota hai?",
options: [
"A. Nucleus",
"B. Cell membrane",
"C. Cytoplasm",
"D. Vacuole"
],
correct: 1,
explanation: "<b>Cell membrane</b> cell ke contents ko surround karti hai aur cell aur external environment ke beech substances ke movement ko control karti hai."
},
{
question: "2. Cell membrane ko aur kis naam se jaana jaata hai?",
options: [
"A. Nuclear membrane",
"B. Plasma membrane",
"C. Cell wall",
"D. Tissue membrane"
],
correct: 1,
explanation: "<b>Cell membrane ko plasma membrane</b> bhi kaha jaata hai. Yeh cell ke contents ko protect karti hai."
},
{
question: "3. Cell membrane ko selectively permeable kyun kaha jaata hai?",
options: [
"A. Yeh kisi bhi substance ko pass nahi hone deti",
"B. Yeh sabhi substances ko freely pass hone deti hai",
"C. Yeh kuch substances ko pass hone deti hai aur kuch ko block karti hai",
"D. Yeh sirf water ko permanently block karti hai"
],
correct: 2,
explanation: "<b>Selectively permeable membrane</b> kuch selected substances ko pass hone deti hai, jabki doosre substances ko rok sakti hai."
},
{
question: "4. Potato piece ko plain water mein rakhne par generally kya hota hai?",
options: [
"A. Potato piece swell karta hai",
"B. Potato piece shrink karta hai",
"C. Potato piece dissolve ho jaata hai",
"D. Potato piece ka colour completely change hota hai"
],
correct: 0,
explanation: "Plain water relatively dilute hota hai. Water potato cells ke andar move karta hai, isliye potato piece <b>swell</b> karta hai aur uska weight increase hota hai."
},
{
question: "5. Potato piece ko 20% salt ya sugar solution mein rakhne par kya hota hai?",
options: [
"A. Woh swell karta hai",
"B. Woh shrink karta hai",
"C. Uska weight double ho jaata hai",
"D. Koi change nahi hota"
],
correct: 1,
explanation: "20% salt/sugar solution concentrated hota hai. Water potato cells se bahar move karta hai, isliye potato piece <b>shrink</b> karta hai aur weight decrease hota hai."
},
{
question: "6. Osmosis mein water kis direction mein move karta hai?",
options: [
"A. More water, less solute → less water, more solute",
"B. Less water, more solute → more water, less solute",
"C. High solute → high solute only",
"D. Water sirf cell ke andar move karta hai"
],
correct: 0,
explanation: "Osmosis mein water <b>dilute solution se concentrated solution</b> ki taraf selectively permeable membrane ke through move karta hai."
},
{
question: "7. Osmosis ke according potato ke plain water wale piece ka weight kyun increase hota hai?",
options: [
"A. Salt cells ke andar enter karta hai",
"B. Water cells ke andar move karta hai",
"C. Sugar cells ke andar enter karti hai",
"D. Potato new cells banata hai"
],
correct: 1,
explanation: "Plain water mein water concentration relatively high hoti hai, isliye water potato cells ke andar enter karta hai aur <b>weight increase</b> hota hai."
},
{
question: "8. Diffusion ka correct meaning kya hai?",
options: [
"A. Water ka membrane ke through movement only",
"B. Particles ka higher concentration se lower concentration ki taraf net movement",
"C. Particles ka lower concentration se higher concentration ki taraf movement",
"D. Cell division ka process"
],
correct: 1,
explanation: "<b>Diffusion</b> mein particles concentration gradient ki wajah se <b>higher concentration se lower concentration</b> ki taraf move karte hain. Iske liye membrane zaroori nahi hai."
},
{
question: "9. Osmosis aur diffusion mein main difference kya hai?",
options: [
"A. Osmosis sirf gases mein hota hai",
"B. Diffusion sirf plants mein hota hai",
"C. Osmosis water ka selectively permeable membrane ke across diffusion hai",
"D. Diffusion mein particles move nahi karte"
],
correct: 2,
explanation: "<b>Osmosis specifically water ka movement</b> hai jo selectively permeable membrane ke through hota hai, jabki diffusion different particles ka higher se lower concentration ki taraf movement hai."
},
{
question: "10. Plants mein soil se water root cells mein kis process ke through enter karta hai?",
options: [
"A. Diffusion only",
"B. Osmosis",
"C. Respiration",
"D. Photosynthesis"
],
correct: 1,
explanation: "Plants mein soil se water <b>root cells mein osmosis</b> ke process ke through enter karta 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>
<p><strong>${userName}</strong>, ${
score >= 8 ? "Excellent Performance! 🎉" :
score >= 5 ? "Good Attempt! 👍" :
"Keep Practicing! 📚"
}</p>
`;
}
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>