class 9 science chapter 5

ch5part2

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

#userName {
    padding: 10px;
    width: 90%;
    border: 1px solid #ccc;
    border-radius: 6px;
    margin-bottom: 10px;
}
</style>
</head>

<body>

<div class="quiz-container">

<h2>🧠 APICAL CLASSES – Science Quiz<br>Solution and Concentration</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. Solution mein woh substance jo dissolve hota hai, use kya kehte hain?",
options: [
"A. Solvent",
"B. Solute",
"C. Residue",
"D. Filtrate"
],
correct: 1,
explanation: "Jo substance kisi solvent mein dissolve hota hai, usse Solute kehte hain. Example: Sugar-water solution mein sugar solute hai."
},

{
question: "2. Sugar aur water se bane solution mein solvent kaun hai?",
options: [
"A. Sugar",
"B. Water",
"C. Sugar aur water dono",
"D. Koi nahi"
],
correct: 1,
explanation: "Solvent woh substance hota hai jo solute ko dissolve karta hai. Sugar-water solution mein water, sugar ko dissolve karta hai."
},

{
question: "3. Solution ki concentration ka kya meaning hai?",
options: [
"A. Solution ka colour",
"B. Solute ka melting point",
"C. Given amount of solvent ya solution mein dissolved solute ki amount",
"D. Solvent ka boiling point"
],
correct: 2,
explanation: "Concentration batati hai ki given amount of solvent ya solution mein kitna solute dissolved hai."
},

{
question: "4. ORS prepare karte waqt salt aur sugar ko fixed amount of water mein specified quantity mein add karna zaroori kyun hai?",
options: [
"A. Solution ka colour change karne ke liye",
"B. Correct concentration maintain karne ke liye",
"C. Water ko evaporate karne ke liye",
"D. Sugar ko solid banane ke liye"
],
correct: 1,
explanation: "ORS mein salt, sugar aur water ka proper proportion hona zaroori hai. Amount change karne par solution proper ORS nahi rahega."
},

{
question: "5. Agar ORS banate waqt same amount of water mein required quantity se bahut zyada salt aur sugar add kar di jaye, to kya problem ho sakti hai?",
options: [
"A. ORS ki concentration change ho jayegi",
"B. Solution automatically pure water ban jayega",
"C. Sugar dissolve hona band kar degi",
"D. Water solvent nahi rahega"
],
correct: 0,
explanation: "Solute ki amount badalne se concentration change ho jaati hai. Isliye ORS mein specified quantities follow karna important hai."
},

{
question: "6. Farmers pesticides ko crops par spray karte waqt pesticide aur water ka correct proportion kyun rakhte hain?",
options: [
"A. Pesticide ka colour same rakhne ke liye",
"B. Crop protection ke liye suitable concentration maintain karne ke liye",
"C. Water ko remove karne ke liye",
"D. Soil ko dry karne ke liye"
],
correct: 1,
explanation: "Too little pesticide crops ko protect nahi karega, jabki too much pesticide crops, soil aur environment ko damage kar sakta hai."
},

{
question: "7. Agar pesticide solution mein pesticide ki quantity bahut kam ho, to kya ho sakta hai?",
options: [
"A. Crops ko sufficient protection nahi milega",
"B. Crops instantly grow karenge",
"C. Soil automatically fertile ho jayegi",
"D. Water solvent nahi rahega"
],
correct: 0,
explanation: "Pesticide bahut kam hone par solution ki concentration insufficient ho sakti hai aur crops ko proper protection nahi milega."
},

{
question: "8. Agar same amount of solute ko dissolve karne ke liye solvent ki quantity badha di jaye, to solution ki concentration par kya effect padega?",
options: [
"A. Concentration generally decrease hogi",
"B. Concentration always double hogi",
"C. Concentration unchanged rahegi",
"D. Concentration zero ho jayegi"
],
correct: 0,
explanation: "Same solute ko larger amount of solvent mein distribute karne par solution more dilute ho jaata hai, isliye concentration decrease hoti hai."
},

{
question: "9. Concentration ko express karne ke liye chapter mein kaunsi common method discuss ki gayi hai?",
options: [
"A. Percentage",
"B. Temperature",
"C. Density only",
"D. Pressure"
],
correct: 0,
explanation: "Solution ki concentration ko different ways se express kiya ja sakta hai. Is section mein percentage concentration ko common method ke roop mein discuss kiya gaya hai."
},

{
question: "10. Neeche diye gaye examples mein concentration ka correct proportion maintain karna sabse important kyun hai?",
options: [
"A. Sirf solution ka appearance improve karne ke liye",
"B. Solution ko desired purpose ke liye suitable banane ke liye",
"C. Solvent ko solute mein convert karne ke liye",
"D. Mixture ko heterogeneous banane ke liye"
],
correct: 1,
explanation: "ORS, medicines, pesticides, food aur cosmetics jaise examples mein correct concentration zaroori hoti hai, kyunki wrong concentration se desired result nahi milega ya harm ho sakta 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 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() {

    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;">
                <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><strong>Student Name:</strong> ${escapeHTML(userName)}</p>
        <p>${score >= 8 ? "Excellent Performance! 🎉" :
             score >= 5 ? "Good Attempt! Keep Practicing." :
             "Keep Learning and Try Again!"}</p>
    `;
}

function escapeHTML(value) {
    return value.replace(/[&<>"']/g, char => ({
        '&': '&amp;',
        '<': '&lt;',
        '>': '&gt;',
        '"': '&quot;',
        "'": '&#39;'
    })[char]);
}

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>${escapeHTML(s.name)} - ${s.score}/10 (${escapeHTML(s.date)})</li>
        `).join('');
}

</script>

</body>
</html>

Leave a Comment