ch5part9
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Apical Classes - Separation of Mixtures Quiz</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%;
border: 1px solid #ccc;
border-radius: 6px;
}
</style>
</head>
<body>
<div class="quiz-container">
<h2>๐งช APICAL CLASSES<br>Separation of Mixtures Quiz</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. Water aur mustard oil ko ek container mein mix karne par kya hota hai?",
options: [
"A. Dono completely mix ho jaate hain",
"B. Dono separate layers banaate hain",
"C. Dono gas ban jaate hain",
"D. Dono solid ban jaate hain"
],
correct: 1,
explanation: "Water aur mustard oil immiscible liquids hain, isliye ye ek-doosre mein mix nahi hote aur separate layers banaate hain."
},
{
question: "2. Immiscible liquids ka correct example kaunsa hai?",
options: [
"A. Water aur alcohol",
"B. Water aur sugar solution",
"C. Water aur mustard oil",
"D. Water aur salt"
],
correct: 2,
explanation: "Mustard oil aur water ek-doosre mein dissolve nahi hote, isliye ye immiscible liquids ka example hain."
},
{
question: "3. 5 mL mustard oil aur 20 mL water ko separating funnel mein daalne ke baad kaunsi layer upar hogi?",
options: [
"A. Water",
"B. Mustard oil",
"C. Dono same layer mein honge",
"D. Koi layer nahi banegi"
],
correct: 1,
explanation: "Mustard oil ki density water se kam hoti hai, isliye mustard oil upper layer aur water lower layer banata hai."
},
{
question: "4. Mustard oil aur water ko separate karne ke liye kaunsa apparatus suitable hai?",
options: [
"A. Separating funnel",
"B. Evaporating dish",
"C. Thermometer",
"D. Filter paper only"
],
correct: 0,
explanation: "Separating funnel ka use two immiscible liquids ko unki separate layers ke basis par separate karne ke liye kiya jaata hai."
},
{
question: "5. Separating funnel mein mustard oil aur water ki lower layer ko pehle collect karne ke liye kya kiya jaata hai?",
options: [
"A. Funnel ko heat kiya jaata hai",
"B. Stopcock slowly open kiya jaata hai",
"C. Mixture ko filter kiya jaata hai",
"D. Funnel ko shake kiya jaata hai"
],
correct: 1,
explanation: "Separating funnel ka stopcock slowly open karke lower layer, yani water, ko carefully container mein collect kiya jaata hai."
},
{
question: "6. Separating funnel mein water ko almost completely drain karne ke baad stopcock kab close karna chahiye?",
options: [
"A. Oil layer completely drain hone ke baad",
"B. Jab water almost fully drain ho jaaye",
"C. Mixture daalne se pehle",
"D. Jab funnel empty ho jaaye"
],
correct: 1,
explanation: "Water lower layer mein hota hai. Water almost drain hone par stopcock close karke oil ko alag collect kiya jaata hai."
},
{
question: "7. Hydrogen aur oxygen gases ka mixture generally homogeneous kyun hota hai?",
options: [
"A. Gas particles freely move karte hain aur uniformly mix ho jaate hain",
"B. Gas particles move nahi karte",
"C. Gases hamesha solid hoti hain",
"D. Hydrogen aur oxygen immiscible liquids hain"
],
correct: 0,
explanation: "Gas particles freely move in all directions karte hain, isliye gases easily aur uniformly mix ho jaati hain."
},
{
question: "8. Inmein se kaunsa gas-containing heterogeneous mixture hai?",
options: [
"A. Hydrogen + oxygen",
"B. Air mein smoke",
"C. Oxygen + nitrogen",
"D. Hydrogen + nitrogen"
],
correct: 1,
explanation: "Smoke mein solid particles air mein suspended hote hain, isliye smoke ek heterogeneous mixture hai."
},
{
question: "9. Fog ko heterogeneous mixture kyun kaha jaata hai?",
options: [
"A. Ismein solid salt crystals hote hain",
"B. Ismein tiny liquid water droplets air mein suspended hote hain",
"C. Ismein sirf gases hoti hain",
"D. Ismein oil aur water ki layers hoti hain"
],
correct: 1,
explanation: "Fog mein tiny liquid water droplets air mein suspended hote hain, isliye ye heterogeneous mixture hai."
},
{
question: "10. Iron nails aur sawdust ke mixture ko separate karne ke liye kaunsi property useful hoti hai?",
options: [
"A. Iron ki magnetic property",
"B. Sawdust ki sweetness",
"C. Water ki boiling point",
"D. Oil ki density"
],
correct: 0,
explanation: "Iron magnetic hota hai, isliye magnet ki help se iron nails ko sawdust se easily separate kiya ja sakta hai."
}
];
let currentQuestion = 0;
let score = 0;
let userAnswers = [];
let userName = "";
let quizSubmitted = false;
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 saveAnswer() {
const selected = document.querySelector('input[name="option"]:checked');
userAnswers[currentQuestion] = selected ? parseInt(selected.value) : null;
}
function nextQuestion() {
saveAnswer();
if (currentQuestion < questions.length - 1) {
currentQuestion++;
showQuestion();
}
}
function prevQuestion() {
saveAnswer();
if (currentQuestion > 0) {
currentQuestion--;
showQuestion();
}
}
function submitQuiz() {
if (quizSubmitted) return;
saveAnswer();
score = 0;
questions.forEach((q, index) => {
if (userAnswers[index] === q.correct) {
score++;
}
});
quizSubmitted = true;
showResults();
saveScore(userName, score);
loadScoreboard();
}
function showResults() {
const container = document.getElementById("questionContainer");
container.innerHTML = "";
questions.forEach((q, index) => {
const selected = userAnswers[index];
let optsHTML = q.options.map((opt, i) => {
let cls = "";
if (i === q.correct) {
cls = "correct";
}
if (selected === i && selected !== q.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;">
<strong>Explanation:</strong> ${q.explanation}
</div>
<hr>
`;
});
document.querySelector(".controls").style.display = "none";
document.getElementById("result").innerHTML = `
<h3>Your Score: ${score} / ${questions.length}</h3>
<p>${score === 10 ? "Excellent! Perfect Score!" :
score >= 7 ? "Very Good! Keep Practising!" :
score >= 5 ? "Good effort! Revise and try again!" :
"Keep practising. You can improve!"}</p>
`;
}
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>${s.name} - ${s.score}/10 (${s.date})</li>`
).join("");
}
</script>
</body>
</html>