class 9 science chapter 6

ch6 part3

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

<body>

<div class="quiz-container">

<h2>🧠 Science Quiz – Force and Net Force</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. Do forces 10 N aur 6 N ek block par same direction mein act kar rahe hain. Net force ka magnitude aur direction kya hoga?",
options: [
"A. 4 N, left",
"B. 16 N, right",
"C. 16 N, left",
"D. 4 N, right"
],
correct: 1,
explanation: "Same direction ke forces add hote hain: 10 N + 6 N = <b>16 N</b>, aur direction right hogi."
},

{
question: "2. Ek block par 10 N ka force right aur 6 N ka force left direction mein act kar raha hai. Net force kya hoga?",
options: [
"A. 16 N right",
"B. 4 N left",
"C. 4 N right",
"D. 16 N left"
],
correct: 2,
explanation: "Opposite forces mein difference liya jaata hai: 10 N − 6 N = <b>4 N</b>. Larger force right mein hai."
},

{
question: "3. Agar 6 N ka force right aur 10 N ka force left direction mein act kare, to net force kya hoga?",
options: [
"A. 4 N left",
"B. 4 N right",
"C. 16 N left",
"D. 16 N right"
],
correct: 0,
explanation: "10 N − 6 N = <b>4 N</b>. Larger force 10 N left direction mein hai, isliye net force left hoga."
},

{
question: "4. Do forces 10 N aur 6 N ek object par opposite directions mein act kar rahe hain. Net force find karne ke liye kya kiya jaata hai?",
options: [
"A. Dono forces ko multiply karte hain",
"B. Dono forces ko divide karte hain",
"C. Dono forces ko add karte hain",
"D. Dono forces ke magnitudes ka difference lete hain"
],
correct: 3,
explanation: "Opposite direction ke unequal forces ke case mein net force = <b>larger force − smaller force</b>."
},

{
question: "5. Agar do forces ek-doosre ke angle par act kar rahe hon, to unka exact net force calculate karna kis level par detail mein seekha jaata hai?",
options: [
"A. Isi basic section mein complete method",
"B. Higher grades mein",
"C. Sirf primary classes mein",
"D. Force calculation possible nahi hai"
],
correct: 1,
explanation: "Chapter mein bataya gaya hai ki angled forces ka net force calculate karna <b>higher grades</b> mein detail mein seekhenge."
},

{
question: "6. Equal aur opposite forces kisi extended object ke do ends par apply kiye jaayen, to kya ho sakta hai?",
options: [
"A. Object rotate kar sakta hai",
"B. Object ka mass zero ho jaata hai",
"C. Object dissolve ho jaata hai",
"D. Object hamesha rest mein rahta hai"
],
correct: 0,
explanation: "Extended object par equal aur opposite forces rotation produce kar sakte hain, jaise <b>handlebar ya tap ko turn karna</b>."
},

{
question: "7. Weightlifter ek barbell ko steady position mein hold kar raha hai. Barbell par kaun-se do important forces act karte hain?",
options: [
"A. Magnetic force aur frictional force",
"B. Gravitational force aur weightlifter ka upward force",
"C. Buoyant force aur magnetic force",
"D. Sirf gravitational force"
],
correct: 1,
explanation: "Gravity barbell ko downward pull karti hai, jabki weightlifter ka applied force upward hota hai."
},

{
question: "8. Weightlifter barbell ko steady rakhta hai, yani barbell rest mein hai. Is situation mein us par upward aur downward forces kaise honge?",
options: [
"A. Equal aur balanced",
"B. Unequal aur balanced",
"C. Equal aur same direction",
"D. Zero aur opposite direction"
],
correct: 0,
explanation: "Barbell steady hai, isliye upward aur downward forces balance kar rahe hain. Net force <b>zero</b> hai."
},

{
question: "9. Arm-wrestling mein players R aur S ke arms front direction mein tilt kar rahe hain. Is situation se kya conclude kiya ja sakta hai?",
options: [
"A. Forces balanced hain kyunki dono players force laga rahe hain",
"B. Forces balanced nahi hain",
"C. Dono forces hamesha zero hain",
"D. Sirf gravity act kar rahi hai"
],
correct: 1,
explanation: "Arms ka tilt hona batata hai ki forces balanced nahi hain; ek player ka force doosre se larger hai."
},

{
question: "10. Arm-wrestling mein agar R aur S ke arms front direction mein tilt ho rahe hain, to larger force kis player ne lagaya hoga?",
options: [
"A. Jo player opposite direction mein arm ko tilt kar raha hai",
"B. Jo player arm ko front direction mein tilt karne mein cause kar raha hai",
"C. Dono players ne exactly equal force lagaya",
"D. Kisi player ne force nahi lagaya"
],
correct: 1,
explanation: "Unequal forces hone par arm <b>larger force ki direction</b> mein tilt hota hai."
}

];

let currentQuestion = 0;
let score = 0;
let userAnswers = [];
let userName = "";
let quizSubmitted = 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>
  `;

  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() {
  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;">
        <strong>Explanation:</strong> ${q.explanation}
      </div>
      <hr>
    `;
  });

  document.querySelector(".controls").style.display = "none";

  const percentage = (score / questions.length) * 100;

  document.getElementById("result").innerHTML = `
    <h3>Your Score: ${score} / ${questions.length}</h3>
    <h3>Percentage: ${percentage}%</h3>
    <p><strong>${userName}</strong>, ${
      percentage >= 80 ? "Excellent work!" :
      percentage >= 50 ? "Good effort! Keep practising." :
      "Keep learning and try again!"
    }</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