class 9 science chapter 5

ch5part3

<!DOCTYPE html>
<html lang="en">
<head>
<title>🧠 Science Quiz – Concentration of Solutions</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 – Concentration of Solutions</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. Mass by mass percentage (% m/m or % w/w) batata hai ki 100 g total solution mein kitne grams solute present hain. Is statement ke according correct formula kaunsa hai?",
options: [
"A. (Mass of solvent / Mass of solution) × 100",
"B. (Mass of solute / Mass of solution) × 100",
"C. (Mass of solution / Mass of solute) × 100",
"D. (Mass of solute / Mass of solvent) × 100"
],
correct: 1,
explanation: "✅ Correct: Option B.<br>Mass by mass percentage mein solute ki mass ko total solution ki mass se divide karke 100 se multiply karte hain.<br><br><b>Formula:</b> % m/m = (Mass of solute / Mass of solution) × 100"
},

{
question: "2. 10 g salt ko 90 g water mein dissolve kiya gaya. Total solution ki mass kitni hogi?",
options: [
"A. 90 g",
"B. 95 g",
"C. 100 g",
"D. 110 g"
],
correct: 2,
explanation: "✅ Correct: Option C.<br>Total mass = Mass of solute + Mass of solvent<br>= 10 + 90 = <b>100 g</b>."
},

{
question: "3. 10 g salt ko 90 g water mein dissolve karne par mass by mass percentage kya hogi?",
options: [
"A. 5%",
"B. 10%",
"C. 20%",
"D. 90%"
],
correct: 1,
explanation: "✅ Correct: Option B.<br>Total solution mass = 10 + 90 = 100 g.<br>% m/m = (10 / 100) × 100 = <b>10%</b>."
},

{
question: "4. Packaged food par salt, sugar ya protein ki composition ko show karne ke liye kaunsi concentration method commonly useful hai?",
options: [
"A. Mass by mass percentage",
"B. Mass by volume percentage only",
"C. Volume by volume percentage only",
"D. Temperature percentage"
],
correct: 0,
explanation: "✅ Correct: Option A.<br>Packaged foods mein composition ko often <b>% m/m ya % w/w</b> ke form mein show kiya ja sakta hai."
},

{
question: "5. Mass by volume percentage (% m/v or % w/v) ka matlab kya hai?",
options: [
"A. 100 g solution mein solute ke grams",
"B. 100 mL solution mein solute ke grams",
"C. 100 mL solvent mein solvent ke grams",
"D. 100 g solvent mein solute ke millilitres"
],
correct: 1,
explanation: "✅ Correct: Option B.<br>% m/v batata hai ki <b>100 mL total solution mein kitne grams solute</b> present hain.<br><br>Formula: % m/v = (Mass of solute in g / Volume of solution in mL) × 100"
},

{
question: "6. 5 g glucose ko water mein dissolve karke exactly 100 mL solution banaya gaya. Is solution ki mass by volume percentage kya hogi?",
options: [
"A. 2%",
"B. 5%",
"C. 10%",
"D. 20%"
],
correct: 1,
explanation: "✅ Correct: Option B.<br>% m/v = (Mass of solute / Volume of solution) × 100<br>= (5 / 100) × 100 = <b>5%</b>.<br>Isliye ise 5% glucose solution kaha jaata hai."
},

{
question: "7. Mass by volume percentage method medicines aur laboratories mein useful kyun hai?",
options: [
"A. Kyunki liquids ka volume measure karna convenient ho sakta hai",
"B. Kyunki solute ki mass measure nahi ki ja sakti",
"C. Kyunki ismein solvent ki zaroorat nahi hoti",
"D. Kyunki solution hamesha heterogeneous hota hai"
],
correct: 0,
explanation: "✅ Correct: Option A.<br>Medicines aur laboratories mein kai situations mein <b>liquid ka volume measure karna weighing se easier</b> hota hai."
},

{
question: "8. Volume by volume percentage (% v/v) kis situation mein commonly use ki jaati hai?",
options: [
"A. Solid ko water mein dissolve karte waqt",
"B. Do miscible liquids ko mix karte waqt",
"C. Sand aur water ko mix karte waqt",
"D. Salt aur solid sugar ko mix karte waqt"
],
correct: 1,
explanation: "✅ Correct: Option B.<br>% v/v ka use <b>do miscible liquids</b> ke mixtures mein hota hai, jaise perfumes, cosmetics aur vinegar."
},

{
question: "9. Volume by volume percentage ka meaning kya hai?",
options: [
"A. 100 g solution mein solute ke millilitres",
"B. 100 mL solution mein solute ke millilitres",
"C. 100 mL solvent mein solute ke grams",
"D. 100 g solvent mein solute ke grams"
],
correct: 1,
explanation: "✅ Correct: Option B.<br>% v/v batata hai ki <b>100 mL total solution mein kitne mL solute</b> present hain.<br><br>Formula: % v/v = (Volume of solute / Volume of solution) × 100"
},

{
question: "10. Agar kisi perfume solution mein 100 mL total solution mein 20 mL liquid solute present hai, to volume by volume percentage kya hogi?",
options: [
"A. 5%",
"B. 10%",
"C. 20%",
"D. 80%"
],
correct: 2,
explanation: "✅ Correct: Option C.<br>% v/v = (Volume of solute / Volume of solution) × 100<br>= (20 / 100) × 100 = <b>20%</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}
                ${selected === null || selected === undefined
                    ? "<br><b>Your answer: Not attempted</b>"
                    : ""}
            </div>
            <hr>
        `;
    });

    document.querySelector(".controls").style.display = "none";

    document.getElementById("result").innerHTML = `
        <h3>Your Score: ${score} / ${questions.length}</h3>
        <p><b>Percentage:</b> ${(score / questions.length) * 100}%</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>

Leave a Comment