class 10 science chapter 1

ch1 part 2

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chemical Reactions and Equations 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;
}
</style>
</head>

<body>

<div class="quiz-container">

<h2>🧠 Chemical Reactions and Equations Quiz</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. Chemical equation ko balance karte time chemical formula ke andar ke numbers ko change kyun nahi karna chahiye?",
options: [
"A. Reaction slow ho jayegi",
"B. Substance ki identity change ho sakti hai",
"C. Temperature change ho jayega",
"D. Product disappear ho jayega"
],
correct: 1,
explanation: "Chemical formula ke andar subscript change karne se substance ki identity aur composition change ho sakti hai. Isliye equation balance karte waqt sirf coefficients change kiye jate hain."
},

{
question: "2. Equation Fe + H₂O → Fe₃O₄ + H₂ mein LHS par oxygen atoms kitne hain?",
options: [
"A. 1",
"B. 2",
"C. 3",
"D. 4"
],
correct: 0,
explanation: "LHS par H₂O mein sirf 1 oxygen atom hai. Isliye initial equation mein LHS oxygen = 1 atom hai, jabki RHS par Fe₃O₄ mein 4 oxygen atoms hain."
},

{
question: "3. Equation Fe + H₂O → Fe₃O₄ + H₂ mein oxygen ko balance karne ke liye H₂O ke aage kya coefficient lagaya jayega?",
options: [
"A. 2",
"B. 3",
"C. 4",
"D. 5"
],
correct: 2,
explanation: "RHS par Fe₃O₄ mein 4 oxygen atoms hain. LHS par ek H₂O mein 1 oxygen atom hai. Isliye LHS par 4H₂O likhenge, jisse oxygen atoms dono sides par 4 ho jayenge."
},

{
question: "4. 4H₂O mein total hydrogen atoms kitne hote hain?",
options: [
"A. 2",
"B. 4",
"C. 6",
"D. 8"
],
correct: 3,
explanation: "Ek H₂O molecule mein 2 hydrogen atoms hote hain. Agar 4 H₂O molecules hain, to hydrogen atoms = 4 × 2 = 8. Isliye 4H₂O mein 8 hydrogen atoms hain."
},

{
question: "5. Equation Fe + 4H₂O → Fe₃O₄ + 4H₂ mein iron (Fe) ko balance karne ke liye kya karna hoga?",
options: [
"A. Fe ke aage 2 lagana hoga",
"B. Fe ke aage 3 lagana hoga",
"C. Fe ke aage 4 lagana hoga",
"D. Fe ko remove karna hoga"
],
correct: 1,
explanation: "RHS par Fe₃O₄ mein 3 Fe atoms hain, lekin LHS par sirf 1 Fe atom hai. Isliye LHS par 3Fe likhenge. Final equation hogi: 3Fe + 4H₂O → Fe₃O₄ + 4H₂."
},

{
question: "6. Equation 3Fe + 4H₂O → Fe₃O₄ + 4H₂ ko balance karne ke liye kaunsi method use ki gayi hai?",
options: [
"A. Hit-and-trial method",
"B. Filtration method",
"C. Distillation method",
"D. Separation method"
],
correct: 0,
explanation: "Chemical equation ko balance karte waqt suitable smallest whole-number coefficients ko try karke atoms ko equal kiya jata hai. Is method ko hit-and-trial method kaha jata hai."
},

{
question: "7. Chemical equation mein (s) ka kya meaning hota hai?",
options: [
"A. Steam",
"B. Solution",
"C. Solid",
"D. Sulphur"
],
correct: 2,
explanation: "Chemical equations mein (s) ka meaning solid state hota hai. Jaise Fe(s) ka matlab hai iron solid state mein present hai."
},

{
question: "8. Chemical equation mein (aq) ka kya meaning hota hai?",
options: [
"A. Aqueous solution",
"B. Air quality",
"C. Acid quantity",
"D. Atom quantity"
],
correct: 0,
explanation: "(aq) ka matlab aqueous solution, yani substance water mein dissolved hai. Example: NaCl(aq) ka matlab sodium chloride water mein dissolved hai."
},

{
question: "9. Equation 3Fe(s) + 4H₂O(g) → Fe₃O₄(s) + 4H₂(g) mein H₂O(g) kya indicate karta hai?",
options: [
"A. Ice",
"B. Liquid water",
"C. Water vapour/steam",
"D. Aqueous solution"
],
correct: 2,
explanation: "H₂O(g) mein (g) gaseous state ko show karta hai. Isliye yahan water steam/water vapour ke form mein use ho raha hai."
},

{
question: "10. Chemical equation mein reaction conditions, jaise temperature, pressure ya catalyst, generally kahan likhe ja sakte hain?",
options: [
"A. Reactant ke formula ke andar",
"B. Product ke formula ke andar",
"C. Arrow ke upar ya neeche",
"D. Equation ke end mein randomly"
],
correct: 2,
explanation: "Reaction ke liye required temperature, pressure ya catalyst ko generally chemical equation ke arrow ke upar ya neeche show kiya jata hai. Isse pata chalta hai ki reaction kin conditions mein hoti hai."
}

];

let currentQuestion = 0;
let score = 0;
let userAnswers = [];
let userName = "";
let submitted = false;

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() {

    if (submitted) return;

    saveAnswer();

    score = 0;

    questions.forEach((q, index) => {
        if (userAnswers[index] === q.correct) {
            score++;
        }
    });

    submitted = true;

    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