class 8 science chapter 7

ch7 part 1

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>🧠 Matter and Constituent Particles 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>🧠 Matter and Constituent Particles 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. Jab hum chalk ko chhote pieces mein todte hain aur phir grind karte hain, toh kya hota hai?",
    options: [
      "A. Chalk ek naya substance ban jaata hai",
      "B. Chalk ka colour hamesha change ho jaata hai",
      "C. Chalk ke pieces ka size chhota ho jaata hai",
      "D. Chalk gas mein convert ho jaata hai"
    ],
    correct: 2,
    explanation: "Chalk ko todne ya grind karne par uska size reduce hota hai, lekin chalk kisi naye substance mein convert nahi hota. Isliye yeh physical change hai.<br><br>Example: Sugar ko powder banana bhi physical change hai, kyunki substance sugar hi rehta hai."
  },

  {
    question: "2. Chalk ko grind karna kis type ka change hai?",
    options: [
      "A. Chemical change",
      "B. Physical change",
      "C. Nuclear change",
      "D. Biological change"
    ],
    correct: 1,
    explanation: "Physical change mein substance ki shape, size ya state change ho sakti hai, lekin koi naya substance nahi banta.<br><br>Example: Ice ka melt hokar water banna physical change hai, kyunki dono water hi hain."
  },

  {
    question: "3. Kisi substance ko banane wali basic units ko kya kehte hain?",
    options: [
      "A. Cells",
      "B. Constituent particles",
      "C. Organs",
      "D. Tissues"
    ],
    correct: 1,
    explanation: "Constituent particles kisi substance ya material ko banane wali basic units hoti hain. Chalk ka ek bada piece bahut saare tiny particles se milkar bana hota hai.<br><br>Example: Sugar ka ek crystal bhi bahut saare sugar molecules se milkar bana hota hai."
  },

  {
    question: "4. Chalk powder ko magnifying glass se observe karne par kya pata chalta hai?",
    options: [
      "A. Chalk ek hi solid block hai",
      "B. Chalk powder mein chhote grains dikhte hain",
      "C. Chalk completely disappear ho jaata hai",
      "D. Chalk water ban jaata hai"
    ],
    correct: 1,
    explanation: "Chalk ko grind karne se chhote grains ya specks bante hain. Har speck bhi chalk substance ka hi part hota hai aur usmein constituent particles hote hain.<br><br>Example: Sand ko dhyan se dekhne par usmein bahut saare chhote grains nazar aate hain."
  },

  {
    question: "5. Chalk ko baar-baar todne aur grind karne ka main purpose kya hai?",
    options: [
      "A. Chalk ko jalana",
      "B. Chalk ka colour badalna",
      "C. Yeh samajhna ki matter chhote particles se bana hai",
      "D. Chalk ko liquid banana"
    ],
    correct: 2,
    explanation: "Chalk ko smaller pieces mein todne se humein samajh aata hai ki ek bada piece bhi bahut saare chhote constituent particles se bana hota hai.<br><br>Example: Ek building bahut saari bricks se milkar banti hai; isi tarah matter bhi chhote particles se bana hota hai."
  },

  {
    question: "6. Chalk ko grind karne par kaunsa statement correct hai?",
    options: [
      "A. Chalk ka chemical composition zaroor change hota hai",
      "B. Chalk ek naya substance ban jaata hai",
      "C. Chalk ka size reduce hota hai, substance wahi rehta hai",
      "D. Chalk ke saare particles destroy ho jaate hain"
    ],
    correct: 2,
    explanation: "Grinding se chalk ke pieces chhote hote hain. Is process mein chalk ki chemical identity change nahi hoti.<br><br>Example: Ek piece of sugar ko crush karke powder banane par woh sugar hi rehti hai."
  },

  {
    question: "7. Sand aur clay ke grains ke baare mein kya sahi hai?",
    options: [
      "A. Woh matter ke sabse bade units hain",
      "B. Woh kisi bhi particle se nahi bane hote",
      "C. Woh bhi bahut saare constituent particles se bane hote hain",
      "D. Woh sirf gases se bane hote hain"
    ],
    correct: 2,
    explanation: "Sand aur clay ke grains bhi matter hain aur unmein constituent particles hote hain. Grain khud material ka sabse basic building block nahi hota.<br><br>Example: Ek sand grain chhota dikh sakta hai, lekin woh bhi bahut saare microscopic particles se bana hota hai."
  },

  {
    question: "8. Sugar ko water mein dissolve karne par kya hota hai?",
    options: [
      "A. Sugar completely destroy ho jaati hai",
      "B. Sugar ke particles water mein spread ho jaate hain",
      "C. Sugar water ko gas bana deti hai",
      "D. Sugar hamesha container ke bottom par hi rehti hai"
    ],
    correct: 1,
    explanation: "Sugar dissolve hone par uske molecules water mein spread ho jaate hain aur solution banate hain. Sugar aam taur par gayab hoti hui dikhti hai, lekin woh destroy nahi hoti.<br><br>Example: Chai mein sugar stir karne par sugar poori chai mein spread ho jaati hai."
  },

  {
    question: "9. Sugar ko water mein dissolve karna generally kis type ka change hai?",
    options: [
      "A. Physical change",
      "B. Chemical change",
      "C. Nuclear change",
      "D. Combustion"
    ],
    correct: 0,
    explanation: "Sugar dissolve hone par aam taur par koi naya substance nahi banta. Water evaporate karke sugar ko phir se recover kiya ja sakta hai.<br><br>Example: Sugar solution ko suitable conditions mein heat karke water evaporate karne par sugar wapas mil sakti hai."
  },

  {
    question: "10. Matter ke constituent particles ke baare mein kaunsa statement correct hai?",
    options: [
      "A. Sirf chalk mein constituent particles hote hain",
      "B. Sirf liquids mein particles hote hain",
      "C. Matter alag-alag constituent particles se bana hota hai",
      "D. Sirf living things mein particles hote hain"
    ],
    correct: 2,
    explanation: "Matter, jaise solids, liquids aur gases, constituent particles se milkar bana hota hai. In particles ki arrangement aur movement substance ki properties ko affect karti hain.<br><br>Example: Chalk ek solid hai, water ek liquid hai aur air gases ka mixture hai — teeno matter hain aur particles se bane hain."
  }

];

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;">
        <strong>Explanation:</strong><br>
        ${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