class 8 science chapter 6

ch6 part 1

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pressure Quiz - APICAL CLASSES</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; }
  .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;
  }
  .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; }
  input[type="text"] {
    padding: 10px;
    width: 60%;
    max-width: 300px;
    border: 1px solid #ccc;
    border-radius: 6px;
  }
</style>
</head>

<body>
<div class="quiz-container">

  <h2>🧠 PRESSURE QUIZ – APICAL CLASSES</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. Pressure kise kehte hain?",
    options: [
      "A. Force Ă— Area",
      "B. Force per unit area",
      "C. Area per unit mass",
      "D. Mass per unit volume"
    ],
    correct: 1,
    explanation: "Pressure ka matlab hai kisi surface ke unit area par lagne wala force. Pressure calculate karne ke liye force ko area se divide karte hain.<br><br><b>Formula:</b> Pressure = Force / Area<br><br><b>Example:</b> Same weight wala bag narrow straps se zyada pressure daalta hai, jabki broad straps pressure ko kam kar dete hain."
  },
  {
    question: "2. Pressure ka SI unit kya hai?",
    options: [
      "A. Newton (N)",
      "B. Kilogram (kg)",
      "C. Pascal (Pa)",
      "D. Metre (m)"
    ],
    correct: 2,
    explanation: "Force ka SI unit newton aur area ka SI unit square metre (m²) hai. Isliye pressure ka SI unit N/m² hota hai, jise pascal kehte hain.<br><br><b>Example:</b> 1 Pa = 1 N/m²."
  },
  {
    question: "3. Agar 100 N force ko 2 m² area par lagaya jaaye, toh pressure kitna hoga?",
    options: [
      "A. 50 Pa",
      "B. 200 Pa",
      "C. 102 Pa",
      "D. 25 Pa"
    ],
    correct: 0,
    explanation: "<b>Formula:</b> Pressure = Force / Area<br><br>Pressure = 100 / 2 = 50 N/m² = 50 Pa.<br><br><b>Example:</b> Agar 100 N force 1 m² area par lage, toh pressure 100 Pa hoga. Same force ke liye area kam karne se pressure badhta hai."
  },
  {
    question: "4. School bag ki broad straps shoulders ko zyada comfortable kyon rakhti hain?",
    options: [
      "A. Bag ka weight kam ho jata hai",
      "B. Gravity khatam ho jaati hai",
      "C. Bag ka mass kam ho jata hai",
      "D. Force larger area par spread ho jata hai"
    ],
    correct: 3,
    explanation: "Broad straps force ko shoulders ke larger area par spread karti hain. Isse pressure kam hota hai aur bag carry karna comfortable lagta hai.<br><br><b>Example:</b> Narrow straps shoulders par zyada pressure daal sakti hain, jabki broad straps pressure ko distribute karti hain."
  },
  {
    question: "5. Iron nail ko uske pointed end se deewar ya lakdi mein ghusana aasaan kyon hota hai?",
    options: [
      "A. Pointed end par force nahi lagta",
      "B. Pointed end ka area chhota hota hai, isliye pressure zyada hota hai",
      "C. Pointed end ka mass zyada hota hai",
      "D. Pointed end gravity ko badha deta hai"
    ],
    correct: 1,
    explanation: "Jab same force chhote area par lagta hai, toh pressure badh jaata hai. Isliye nail ka pointed end material mein aasani se enter karta hai.<br><br><b>Example:</b> Needle ki sharp tip chhote area par force lagakar kapde mein enter kar sakti hai."
  },
  {
    question: "6. Apple ko sharp knife se cut karna blunt knife ke comparison mein aasaan kyon hota hai?",
    options: [
      "A. Sharp knife ka weight hamesha zyada hota hai",
      "B. Sharp knife gravity ko increase karta hai",
      "C. Sharp edge ka area chhota hota hai, isliye pressure zyada hota hai",
      "D. Blunt knife par koi force nahi lagta"
    ],
    correct: 2,
    explanation: "Sharp edge contact ka area kam karti hai. Same force lagane par pressure zyada hota hai, isliye cutting easier hoti hai.<br><br><b>Example:</b> Sharp scissors paper ko blunt scissors ke comparison mein aasani se cut karti hain."
  },
  {
    question: "7. Sir par heavy load rakhte waqt round cloth ka piece kyon rakha jata hai?",
    options: [
      "A. Contact area badhane aur pressure kam karne ke liye",
      "B. Load ka mass badhane ke liye",
      "C. Gravity ko rokne ke liye",
      "D. Load ko hawa mein uthane ke liye"
    ],
    correct: 0,
    explanation: "Cloth load aur head ke beech contact area badhata hai. Force larger area par spread hota hai, isliye pressure kam hota hai.<br><br><b>Example:</b> Broad bucket handle narrow handle ke comparison mein haath par kam pressure daalta hai."
  },
  {
    question: "8. Same force ko do surfaces par lagaya jaata hai. Kis situation mein pressure sabse zyada hoga?",
    options: [
      "A. Jab area double ho jaaye",
      "B. Jab area triple ho jaaye",
      "C. Jab force zero ho jaaye",
      "D. Jab area sabse chhota ho"
    ],
    correct: 3,
    explanation: "Pressure force ke directly proportional aur area ke inversely proportional hota hai. Same force ke liye area kam hoga toh pressure zyada hoga.<br><br><b>Example:</b> High heels ka contact area flat shoes se chhota hota hai, isliye same weight par high heels zyada pressure daal sakti hain."
  },
  {
    question: "9. Strong wind ke karan trees sway ya bend kyon karte hain?",
    options: [
      "A. Wind trees ka mass khatam kar deti hai",
      "B. Moving air trees par force lagati hai aur wind pressure create hota hai",
      "C. Trees par gravity lagna band ho jaata hai",
      "D. Wind sirf temperature change karti hai, force nahi lagati"
    ],
    correct: 1,
    explanation: "Moving air objects par force lagati hai. Strong wind ka pressure trees ko sway ya bend kar sakta hai aur doors ya windows ko bhi move kar sakta hai.<br><br><b>Example:</b> Strong wind mein khule darwaze slam ho sakte hain aur kapde flutter kar sakte hain."
  },
  {
    question: "10. Overhead water tanks ko height par kyon rakha jaata hai?",
    options: [
      "A. Water ka mass zero karne ke liye",
      "B. Water ko gravity se bachane ke liye",
      "C. Height ke karan water pressure milta hai, jisse water pipes mein flow kar sakta hai",
      "D. Tank ka area kam karne ke liye"
    ],
    correct: 2,
    explanation: "Tank mein water ki height ki wajah se neeche ke pipes par hydrostatic pressure hota hai. Yeh pressure water ko pipes se flow karne mein help karta hai.<br><br><b>Example:</b> Rooftop water tank se water neeche ke bathroom taps tak flow karta hai. Flow actual height aur plumbing arrangement par bhi depend karta 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>
  `;

  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;">
        ${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