class 9 science chapter 5

ch5part6

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>APICAL CLASSES - Crystallization 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; 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>Crystallization</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. Copper sulfate crystals prepare karne ke experiment mein copper sulfate ko water mein dissolve karke solution ko gradually saturated kyun kiya jaata hai?",
options: [
"A. Solution ko colourless banane ke liye",
"B. Maximum solute dissolve karne ke liye",
"C. Water ko completely remove karne ke liye",
"D. Copper sulfate ko gas mein convert karne ke liye"
],
correct: 1,
explanation: "Saturated solution mein given temperature par maximum possible copper sulfate dissolve hota hai. Cooling par excess copper sulfate crystals ke form mein separate ho sakta hai."
},

{
question: "2. Copper sulfate crystallization experiment mein dilute sulfuric acid ki ek drop kyun add ki jaati hai?",
options: [
"A. Solution ko boil karne ke liye",
"B. Pure crystals banane mein unwanted reactions ko prevent karne ke liye",
"C. Copper sulfate ko insoluble banane ke liye",
"D. Water ka volume increase karne ke liye"
],
correct: 1,
explanation: "Dilute sulfuric acid kuch unwanted reactions ko prevent karne mein help karti hai, jisse pure copper sulfate crystals obtain kiye ja sakte hain."
},

{
question: "3. Hot saturated copper sulfate solution ko filter karne ka main purpose kya hai?",
options: [
"A. Copper sulfate ko dissolve karna",
"B. Insoluble impurities remove karna",
"C. Solution ko cool karna",
"D. Crystals ko melt karna"
],
correct: 1,
explanation: "Hot solution ko filter karke insoluble impurities remove ki jaati hain. Dissolved copper sulfate filtrate mein remain karta hai."
},

{
question: "4. Filtered hot copper sulfate solution ko cover karke slowly cool karne par large, shiny aur well-shaped crystals kyun bante hain?",
options: [
"A. Particles ko gradually arrange hone ke liye sufficient time milta hai",
"B. Solution mein extra water add hota hai",
"C. Copper sulfate gas ban jaata hai",
"D. Impurities crystals mein convert ho jaati hain"
],
correct: 0,
explanation: "Slow cooling particles ko gradually arrange hone ka enough time deta hai, jisse larger aur well-formed crystals ban sakte hain."
},

{
question: "5. Hot saturated copper sulfate solution ko ice-cold water mein rapidly cool karne par generally kya hoga?",
options: [
"A. Larger and better-shaped crystals banenge",
"B. Smaller and less well-formed crystals banenge",
"C. Koi solid form nahi hoga",
"D. Copper sulfate completely evaporate ho jayega"
],
correct: 1,
explanation: "Rapid cooling se particles ko proper arrangement ke liye kam time milta hai. Isliye smaller aur less well-formed crystals bante hain."
},

{
question: "6. Copper sulfate crystals ko obtain karne ke baad unhe cold water se rinse karke dry kiya jaata hai. Cold water use karne ka advantage kya hai?",
options: [
"A. Crystals ki solubility increase karna",
"B. Crystals ko dissolve hone se kam karna",
"C. Crystals ko liquid banana",
"D. Copper sulfate ko decompose karna"
],
correct: 1,
explanation: "Copper sulfate water mein soluble hai. Cold water mein solubility lower hoti hai, isliye crystals rinse karte waqt kam dissolve hote hain."
},

{
question: "7. Crystallization ka main purpose kya hai?",
options: [
"A. Homogeneous mixture se pure crystals obtain karna",
"B. Do gases ko separate karna",
"C. Solution ko permanently liquid rakhna",
"D. Solvent ko solute mein convert karna"
],
correct: 0,
explanation: "Crystallization ka use homogeneous mixtures se pure substances ko crystals ke form mein separate aur purify karne ke liye hota hai."
},

{
question: "8. Kisi new compound ko prepare karne ke baad usmein unwanted impurities present hain. Crystallization kaise help karegi?",
options: [
"A. Desired substance ko impurities ke saath permanently mix karegi",
"B. Desired pure substance ko crystals ke form mein separate karegi",
"C. Sabhi substances ko gas mein convert karegi",
"D. Sirf solvent ko filter karegi"
],
correct: 1,
explanation: "Crystallization unwanted impurities ko separate karke desired substance ke relatively pure crystals obtain karne mein help karti hai."
},

{
question: "9. Agar saturated copper sulfate solution ka 1–2 mL glass plate par rakhkar kuch time ke liye chhod diya jaye aur water evaporate ho jaye, to kya observe kiya ja sakta hai?",
options: [
"A. Copper sulfate crystals form ho sakte hain",
"B. Solution ka mass increase hoga",
"C. Copper sulfate gas ban jayega",
"D. Water ki quantity increase hogi"
],
correct: 0,
explanation: "Water evaporate hone par dissolved copper sulfate ki concentration badhti hai aur excess copper sulfate crystals ke form mein separate ho sakta hai."
},

{
question: "10. Common salt crystals ke size par evaporation ki rate ka kya effect ho sakta hai?",
options: [
"A. Faster evaporation generally smaller crystals de sakti hai",
"B. Faster evaporation hamesha largest crystals deti hai",
"C. Evaporation rate ka koi effect nahi hota",
"D. Slow evaporation se crystals form hi nahi hote"
],
correct: 0,
explanation: "Slow evaporation particles ko orderly arrangement ke liye more time deti hai, isliye generally larger crystals ban sakte hain. Faster evaporation se smaller crystals banne ki tendency hoti 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 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