class 8 science chapter 2

ch2 part18

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

  .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;
    line-height: 1.5;
  }

  .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: 12px;
    margin-top: 10px;
    margin-bottom: 15px;
    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;
  }

  input[type="text"] {
    padding: 10px;
    width: 65%;
    max-width: 300px;
    border: 1px solid #ccc;
    border-radius: 6px;
  }

  #scoreboard {
    margin-top: 25px;
    background: #eef3f7;
    padding: 15px;
    border-radius: 8px;
  }

  #scoreboard h3 {
    text-align: center;
  }

  ol {
    padding-left: 20px;
  }

  @media (max-width: 600px) {
    body {
      padding: 12px;
    }

    .quiz-container {
      width: 100%;
      padding: 15px;
    }

    input[type="text"] {
      width: 90%;
      box-sizing: border-box;
    }
  }
</style>
</head>

<body>

<div class="quiz-container">

  <h2>🧠 Science Quiz – Yeast and Fermentation</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. Yeast kis group ke microorganisms se belong karta hai?",
    options: [
      "A. Bacteria",
      "B. Protozoa",
      "C. Fungi",
      "D. Algae"
    ],
    correct: 2,
    explanation: "Yeast ek microorganism hai jo fungi group se belong karta hai. Iska use bread aur cakes banane mein kiya jata hai.<br><br><strong>Example:</strong> Bread banane ke liye atta ya maida mein yeast add kiya ja sakta hai."
  },

  {
    question: "2. Flour mein yeast add karne ke baad dough fluffy kyon ho jata hai?",
    options: [
      "A. Yeast carbon dioxide gas release karta hai",
      "B. Yeast flour ko freeze kar deta hai",
      "C. Yeast saara water absorb kar leta hai",
      "D. Yeast flour ko plastic mein badal deta hai"
    ],
    correct: 0,
    explanation: "Yeast food ko break down karke energy release karta hai. Is process mein carbon dioxide gas banti hai, jo dough mein bubbles create karti hai. Isse dough rise karke soft aur fluffy ho jata hai.<br><br><strong>Example:</strong> Bread ke andar chhote-chhote holes carbon dioxide ke bubbles ki wajah se ban sakte hain."
  },

  {
    question: "3. Dough banate waqt yeast ko warm place mein kyon rakha jata hai?",
    options: [
      "A. Taaki dough freeze ho jaye",
      "B. Taaki yeast suitable warm conditions mein grow aur active ho sake",
      "C. Taaki flour ka colour blue ho jaye",
      "D. Taaki dough mein koi gas na bane"
    ],
    correct: 1,
    explanation: "Yeast warm conditions mein achchhi tarah grow aur active ho sakta hai. Bahut zyada heat yeast ko damage kar sakti hai.<br><br><strong>Example:</strong> Bread dough ko suitable warm jagah par rakhne se woh kuch time baad rise kar sakta hai."
  },

  {
    question: "4. Dough mein sugar add karne ka main purpose kya hai?",
    options: [
      "A. Dough ko hard banana",
      "B. Yeast ko completely destroy karna",
      "C. Dough ko dry banana",
      "D. Yeast ko food provide karna"
    ],
    correct: 3,
    explanation: "Sugar yeast ke liye available food source provide karti hai. Yeast sugar ko process karke energy release karta hai aur carbon dioxide produce kar sakta hai.<br><br><strong>Example:</strong> Yeast wale dough mein thodi sugar add karne se fermentation process support hota hai."
  },

  {
    question: "5. Activity mein bowl B mein yeast kyon nahi add kiya gaya?",
    options: [
      "A. Dono bowls ka colour same karne ke liye",
      "B. Flour ko remove karne ke liye",
      "C. Yeast wale aur yeast ke bina dough ka comparison karne ke liye",
      "D. Sugar ko freeze karne ke liye"
    ],
    correct: 2,
    explanation: "Bowl B comparison ke liye control hai. Dono bowls mein flour aur sugar rakhe jaate hain, lekin yeast sirf bowl A mein add kiya jata hai.<br><br><strong>Example:</strong> Agar bowl A ka dough zyada rise kare aur bowl B ka kam, toh yeast ke role ko samajhne mein help milti hai."
  },

  {
    question: "6. Yeast ki activity ke dauraan carbon dioxide ke alawa aur kya produce ho sakta hai?",
    options: [
      "A. Thodi quantity mein alcohol",
      "B. Iron",
      "C. Plastic",
      "D. Sand"
    ],
    correct: 0,
    explanation: "Yeast fermentation ke dauraan carbon dioxide ke saath thodi quantity mein alcohol bhi produce kar sakta hai. Dough mein alcohol ki wajah se smell mein change aa sakta hai.<br><br><strong>Example:</strong> Fermentation ke baad dough ki smell fresh flour ke smell se different ho sakti hai."
  },

  {
    question: "7. Bread aur cakes banane mein yeast ka use kis property ke kaaran hota hai?",
    options: [
      "A. Yeast dough ko metal bana deta hai",
      "B. Yeast carbon dioxide produce karke dough ko rise karne mein help karta hai",
      "C. Yeast dough ko hamesha cold rakhta hai",
      "D. Yeast flour ka saara water remove kar deta hai"
    ],
    correct: 1,
    explanation: "Carbon dioxide dough mein bubbles banati hai. Isse dough ka volume increase hota hai aur baked bread ya cake soft aur airy ho sakta hai.<br><br><strong>Example:</strong> Yeast se bana bread aam taur par zyada fluffy hota hai."
  },

  {
    question: "8. Idli aur dosa ke batter ki fermentation mein kaunsa bacterium help karta hai?",
    options: [
      "A. Amoeba",
      "B. Bread mould",
      "C. Paramecium",
      "D. Lactobacillus"
    ],
    correct: 3,
    explanation: "Lactobacillus ek type ka bacterium hai. Kuch bacteria batter ki fermentation mein help karte hain, jisse uski properties aur texture change hote hain.<br><br><strong>Example:</strong> Idli aur dosa ka batter ferment hone par uska volume badh sakta hai."
  },

  {
    question: "9. Yeast add karne ke baad dough mein bubbles kis gas ke kaaran bante hain?",
    options: [
      "A. Carbon dioxide",
      "B. Helium",
      "C. Neon",
      "D. Argon"
    ],
    correct: 0,
    explanation: "Yeast ke process se release hone wali carbon dioxide dough ke andar trap ho sakti hai. Ye bubbles dough ko rise karne mein help karte hain.<br><br><strong>Example:</strong> Dough ko cut karne par baked bread ke andar small air pockets dikh sakte hain."
  },

  {
    question: "10. Idli, dosa aur bhatura ke preparation mein microorganisms ka kya role ho sakta hai?",
    options: [
      "A. Food ko plastic mein convert karna",
      "B. Food ke saare nutrients destroy karna",
      "C. Fermentation mein help karna",
      "D. Food ko stone mein badalna"
    ],
    correct: 2,
    explanation: "Yeast aur kuch bacteria food fermentation mein help karte hain. Fermentation se batter ya dough ki smell, texture aur volume mein changes aa sakte hain.<br><br><strong>Example:</strong> Idli batter ko ferment karne par woh rise ho sakta hai aur idli soft banane mein help milti hai."
  }

];

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

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>

  `;

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

  if (quizSubmitted) return;

  saveAnswer();

  if (currentQuestion < questions.length - 1) {
    currentQuestion++;
    showQuestion();
  }

}

function prevQuestion() {

  if (quizSubmitted) return;

  saveAnswer();

  if (currentQuestion > 0) {
    currentQuestion--;
    showQuestion();
  }

}

function submitQuiz() {

  if (quizSubmitted) return;

  saveAnswer();

  score = 0;

  questions.forEach((q, index) => {

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

  });

  quizSubmitted = 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>
    <p>
      ${
        score === 10
          ? "Excellent! All answers are correct."
          : score >= 7
          ? "Very good! Keep practising."
          : score >= 4
          ? "Good effort! Revise and try again."
          : "Keep learning and practising. You can improve!"
      }
    </p>
  `;

}

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

}

</script>

</body>
</html>

Leave a Comment