class 9 science chapter 5

ch5part1

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Science Quiz – Mixtures | 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;
}
.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;
}
</style>
</head>

<body>

<div class="quiz-container">

<h2>🧠 Science Quiz – Homogeneous and Heterogeneous 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. Sugar ko water mein dissolve karke achchhi tarah stir kiya jaye, to sugar-water mixture ko kis type ka mixture kaha jayega?",
options: [
"A. Heterogeneous mixture",
"B. Homogeneous mixture",
"C. Suspension",
"D. Insoluble mixture"
],
correct: 1,
explanation: "Sugar water mein uniformly dissolve ho jaati hai, isliye mixture ki composition har jagah same hoti hai. Isse <b>homogeneous mixture ya solution</b> kehte hain."
},

{
question: "2. Ek well-stirred sugar-water solution ke first aur last sip mein sweetness same hoti hai. Is observation se kya pata chalta hai?",
options: [
"A. Sugar sirf bottom mein hai",
"B. Water evaporate ho raha hai",
"C. Mixture uniform hai",
"D. Sugar particles visible hain"
],
correct: 2,
explanation: "Har sip mein sugar ki amount uniformly distributed hoti hai, isliye sweetness same hoti hai. Yeh <b>homogeneous mixture</b> ki property hai."
},

{
question: "3. Vinegar mein acetic acid water mein uniformly mixed hota hai. Vinegar kis type ka mixture hai?",
options: [
"A. Homogeneous mixture",
"B. Heterogeneous mixture",
"C. Suspension",
"D. Pure substance"
],
correct: 0,
explanation: "Vinegar mein acetic acid aur water uniformly mixed hote hain, isliye vinegar ek <b>homogeneous mixture</b> hai."
},

{
question: "4. Soda mein carbon dioxide water mein mixed hoti hai. Soda ko kis category mein rakha ja sakta hai?",
options: [
"A. Heterogeneous mixture",
"B. Homogeneous mixture",
"C. Pure element",
"D. Suspension"
],
correct: 1,
explanation: "Soda mein carbon dioxide water mein uniformly distributed hoti hai, isliye ise <b>homogeneous mixture/solution</b> ka example maana jaata hai."
},

{
question: "5. Sand ko water mein stir karne par sand particles visible hote hain aur kuch time baad neeche settle ho jaate hain. Yeh mixture kya hai?",
options: [
"A. Homogeneous",
"B. Pure substance",
"C. Heterogeneous",
"D. Solution"
],
correct: 2,
explanation: "Sand-water mixture uniform nahi hota. Sand particles visible hote hain aur settle bhi ho jaate hain, isliye yeh <b>heterogeneous mixture</b> hai."
},

{
question: "6. Oil aur water ko mix karke kuch time ke liye chhod diya jaye, to unki different layers ban jaati hain. Yeh mixture kis type ka hai?",
options: [
"A. Homogeneous",
"B. Heterogeneous",
"C. Solution",
"D. Pure liquid"
],
correct: 1,
explanation: "Oil aur water uniformly mix nahi hote aur separate layers bana lete hain. Isliye yeh <b>heterogeneous mixture</b> hai."
},

{
question: "7. Activity 5.1 mein Group A ne 50 mL water mein ek spatula common salt add karke stir kiya. Agar salt completely dissolve ho jaye, to filtration ke baad filter paper par kya residue milega?",
options: [
"A. Salt ka visible residue",
"B. Water ka residue",
"C. Koi significant residue nahi",
"D. Chalk powder"
],
correct: 2,
explanation: "Dissolved salt filter paper ke pores se water ke saath pass ho jaata hai. Isliye <b>visible solid residue nahi bachega</b>."
},

{
question: "8. Activity 5.1 mein Group B ne chalk powder ko water mein mix kiya. Chalk particles visible hain aur mixture ko undisturbed chhodne par neeche settle ho jaate hain. Yeh mixture kya hai?",
options: [
"A. Homogeneous mixture",
"B. Heterogeneous mixture",
"C. Pure substance",
"D. Solution"
],
correct: 1,
explanation: "Chalk particles uniformly dissolved nahi hote. Woh visible hote hain aur settle bhi karte hain, isliye mixture <b>heterogeneous</b> hai."
},

{
question: "9. Activity 5.1 mein laser beam ko mixture ke through pass karke side se observe kiya jaata hai. Is activity ka main purpose kya hai?",
options: [
"A. Mixture ka temperature measure karna",
"B. Particles ke light ke saath behaviour ko observe karna",
"C. Water ko evaporate karna",
"D. Mixture ka mass measure karna"
],
correct: 1,
explanation: "Laser beam ka use mixture mein particles ke presence aur unke <b>light scattering behaviour</b> ko observe karne ke liye kiya jaata hai."
},

{
question: "10. Activity 5.1 mein laser pointer use karte waqt students ko beam mein directly nahi dekhna chahiye. Iska reason kya hai?",
options: [
"A. Laser beam mixture ko heat kar deti hai",
"B. Laser beam glass ko tod sakti hai",
"C. Laser beam aankhon ko irreversible damage kar sakti hai",
"D. Laser beam water ko evaporate kar deti hai"
],
correct: 2,
explanation: "Direct laser light aankhon ko seriously damage kar sakti hai, isliye <b>laser beam mein directly dekhna unsafe hai</b>."
}

];

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>

Leave a Comment