ch8 part 1
<!DOCTYPE html>
<html lang="en">
<head>
<title>🧠 Science Quiz – Mixtures</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 – Mixtures</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. Mixture kise kehte hain?",
options: [
"A. Jab sirf ek substance present ho",
"B. Jab two or more substances mix hon aur apni properties retain karein",
"C. Jab har substance chemically destroy ho jaaye",
"D. Jab substance sirf solid ho"
],
correct: 1,
explanation: "Jab do ya do se zyada substances mix hote hain aur har substance apni properties retain karta hai, toh use mixture kehte hain.<br><br>Example: Lemonade mein water, sugar aur lemon juice mix hote hain. Ye mixture hai."
},
{
question: "2. Mixture banane wale individual substances ko kya kehte hain?",
options: [
"A. Products",
"B. Components",
"C. Elements only",
"D. Compounds only"
],
correct: 1,
explanation: "Mixture mein jo individual substances present hote hain, unhe components kaha jaata hai.<br><br>Example: Sprout salad mein green gram, chickpeas, onion aur tomato uske components hain."
},
{
question: "3. Mixture ke components ke beech generally kya hota hai?",
options: [
"A. Hamesha chemical reaction hota hai",
"B. Components apni properties lose kar dete hain",
"C. Components chemically react nahi karte",
"D. Mixture mein sirf ek component hota hai"
],
correct: 2,
explanation: "Mixture mein substances physically mix hote hain aur generally apni original properties retain karte hain. Mixture banane ke liye chemical reaction hona zaroori nahi hai.<br><br>Example: Sand aur iron filings ko mix karne par dono apni properties retain karte hain."
},
{
question: "4. Sprout salad kis type ke mixture ka example hai?",
options: [
"A. Uniform mixture",
"B. Non-uniform mixture",
"C. Pure substance",
"D. Single component substance"
],
correct: 1,
explanation: "Sprout salad mein green gram, chickpeas, onion aur tomato jaise components alag-alag dikhai dete hain. Isliye yeh non-uniform mixture hai.<br><br>Example: Vegetable salad mein carrot, cucumber aur tomato ko separately identify kar sakte hain."
},
{
question: "5. Uniform mixture ki main characteristic kya hai?",
options: [
"A. Components har jagah unevenly distributed hote hain",
"B. Components evenly distributed hote hain aur separately distinguish nahi kiye ja sakte",
"C. Components hamesha naked eye se visible hote hain",
"D. Mixture mein sirf solids hote hain"
],
correct: 1,
explanation: "Uniform mixture mein components evenly distributed hote hain. Mixture ke different parts ki composition generally same hoti hai.<br><br>Example: Sugar ko water mein completely dissolve karne par sugar solution uniform mixture banta hai."
},
{
question: "6. Sugar aur water ka mixture uniform kyun hota hai, jab sugar completely dissolve ho jaati hai?",
options: [
"A. Sugar destroy ho jaati hai",
"B. Sugar particles water mein evenly distribute ho jaate hain",
"C. Water sugar mein convert ho jaata hai",
"D. Sugar aur water dono gas ban jaate hain"
],
correct: 1,
explanation: "Sugar dissolve hone par uske particles water mein evenly spread ho jaate hain. Isliye sugar ko separately dekhna possible nahi hota.<br><br>Example: Achhe se stir ki hui sweet lemonade mein har sip ka taste generally similar hota hai."
},
{
question: "7. Inmein se kaunsa non-uniform mixture ka example hai?",
options: [
"A. Sugar solution",
"B. Properly mixed salt solution",
"C. Sprout salad",
"D. Clean air"
],
correct: 2,
explanation: "Sprout salad mein different components alag-alag visible hote hain aur mixture har jagah exactly same composition ka nahi hota.<br><br>Example: Fruit salad mein apple, banana aur grapes ko separately dekha ja sakta hai."
},
{
question: "8. Mixture ke components ke baare mein kaunsa statement correct hai?",
options: [
"A. Woh hamesha apni properties lose kar dete hain",
"B. Woh apni properties retain kar sakte hain",
"C. Woh hamesha ek naya compound banate hain",
"D. Unhe kabhi separate nahi kiya ja sakta"
],
correct: 1,
explanation: "Mixture ke components apni individual properties retain karte hain, kyunki mixture banne par unke beech chemical reaction hona zaroori nahi hai.<br><br>Example: Iron filings aur sand ko mix karne par iron magnetic property retain karta hai."
},
{
question: "9. Inmein se kaunsa uniform mixture ka example hai?",
options: [
"A. Sprout salad",
"B. Sand aur stones",
"C. Properly dissolved sugar solution",
"D. Vegetable salad"
],
correct: 2,
explanation: "Jab sugar water mein completely dissolve hokar evenly distribute ho jaati hai, toh mixture uniform ban jaata hai. Components ko separately naked eye se nahi dekha ja sakta.<br><br>Example: Ek achhe se mixed glass of sugar water mein sugar ke crystals separately visible nahi hote."
},
{
question: "10. Poha banane mein rice flakes, vegetables, spices aur peanuts ko mix kiya jaata hai. Isse kya samajh aata hai?",
options: [
"A. Mixtures sirf liquids se bante hain",
"B. Mixtures mein sirf ek component hota hai",
"C. Two or more substances ko mix karke mixture banaya ja sakta hai",
"D. Mixture banane ke liye har substance ko dissolve karna zaroori hai"
],
correct: 2,
explanation: "Mixture solids, liquids ya different types of substances ko combine karke ban sakta hai. Har component ka dissolve hona zaroori nahi hai.<br><br>Example: Poha mein peanuts aur vegetables alag dikh sakte hain, isliye prepared poha generally non-uniform mixture ka example 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>