class 9 science chapter 6

ch6 part1

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Force and Its Effects - Science 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;
  margin: 0;
}
.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: 12px;
  border-radius: 6px;
  border: 1px solid #ccc;
  cursor: pointer;
  transition: 0.3s;
}
.options label:hover {
  background: #f0f0f0;
}
.options input {
  margin-right: 8px;
}
.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;
  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;
}
#userName {
  padding: 10px;
  width: 95%;
  max-width: 350px;
  border: 1px solid #aaa;
  border-radius: 6px;
}
</style>
</head>

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

<h2>🧠 Science Quiz – Force and Its Effects</h2>
<p style="text-align:center;"><b>APICAL CLASSES</b></p>

<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. Ek ball rest position mein hai. Agar us par force apply kiya jaaye, to force kya kar sakta hai?",
  options: [
    "A. Ball ko move kara sakta hai",
    "B. Ball ka mass change kar sakta hai",
    "C. Ball ko invisible bana sakta hai",
    "D. Ball ka temperature hamesha zero kar sakta hai"
  ],
  correct: 0,
  explanation: "Force kisi <b>stationary object ko motion mein laa sakta hai</b>."
},
{
  question: "2. Cricket bat se moving ball par force lagane par ball ki direction change ho jaati hai. Ye force ka kaunsa effect show karta hai?",
  options: [
    "A. Force object ka colour change karta hai",
    "B. Force motion ki direction change kar sakta hai",
    "C. Force object ka mass destroy karta hai",
    "D. Force object ko hamesha stop karta hai"
  ],
  correct: 1,
  explanation: "Force moving object ki <b>speed aur direction</b>, dono mein change kar sakta hai."
},
{
  question: "3. Fingers se lemon ko squeeze karne par lemon ka shape change ho jaata hai. Ye force ka kya effect hai?",
  options: [
    "A. Force shape change kar sakta hai",
    "B. Force mass increase karta hai",
    "C. Force density zero karta hai",
    "D. Force object ko gas bana deta hai"
  ],
  correct: 0,
  explanation: "Lemon par applied force uski <b>shape change</b> kar deta hai. Force object ko deform bhi kar sakta hai."
},
{
  question: "4. Force ko completely describe karne ke liye magnitude ke saath aur kya specify karna zaroori hai?",
  options: [
    "A. Colour",
    "B. Direction",
    "C. Temperature",
    "D. Volume"
  ],
  correct: 1,
  explanation: "Force ek <b>vector quantity</b> hai, isliye uski <b>magnitude aur direction</b> dono specify karni hoti hain."
},
{
  question: "5. Frictional force generally moving object ki motion ke kis direction mein act karta hai?",
  options: [
    "A. Motion ki same direction mein",
    "B. Motion ki opposite direction mein",
    "C. Hamesha upward",
    "D. Hamesha downward"
  ],
  correct: 1,
  explanation: "Friction generally object ki motion ko oppose karta hai, isliye force <b>motion ki opposite direction</b> mein act karta hai."
},
{
  question: "6. Like poles of two magnets ek-doosre par kaunsi force lagate hain?",
  options: [
    "A. Attractive magnetic force",
    "B. Repulsive magnetic force",
    "C. Gravitational force only",
    "D. Buoyant force"
  ],
  correct: 1,
  explanation: "Magnetic force mein <b>like poles repel</b> aur unlike poles attract karte hain."
},
{
  question: "7. Force ka SI unit kya hai?",
  options: [
    "A. Joule (J)",
    "B. Watt (W)",
    "C. Newton (N)",
    "D. Pascal (Pa)"
  ],
  correct: 2,
  explanation: "Force ka SI unit <b>newton</b> hai aur iska symbol <b>N</b> hai."
},
{
  question: "8. Force ki magnitude kya express karti hai?",
  options: [
    "A. Force ki direction",
    "B. Force ki strength",
    "C. Object ka mass",
    "D. Object ka volume"
  ],
  correct: 1,
  explanation: "Force ki <b>magnitude uski strength</b> ko express karti hai."
},
{
  question: "9. Spring balance ka use kis quantity ko measure karne ke liye kiya ja sakta hai?",
  options: [
    "A. Sirf temperature",
    "B. Force ki magnitude",
    "C. Sirf distance",
    "D. Sirf time"
  ],
  correct: 1,
  explanation: "Spring balance se <b>weight</b>, jo gravitational force hai, measure kiya ja sakta hai. Isliye spring balance generally <b>force ki magnitude</b> measure kar sakta hai."
},
{
  question: "10. Everyday life mein directly feel ki ja sakne wali very small forces approximately kis order ki hoti hain?",
  options: [
    "A. Kilonewtons (10³ N)",
    "B. Newtons (1 N)",
    "C. Millinewtons (10⁻³ N)",
    "D. Yoctonewtons (10⁻²⁴ N)"
  ],
  correct: 2,
  explanation: "Everyday life mein light touch jaise very small forces ka order approximately <b>millinewtons (10⁻³ N)</b> hota hai. Specialized experiments mein scientists isse bhi bahut smaller forces measure kar sakte hain."
}
];

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 = `
    <p style="text-align:right;">Question ${currentQuestion + 1} of ${questions.length}</p>
    <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() {
  saveAnswer();

  if (quizSubmitted) return;

  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];

    let optsHTML = q.options.map((opt, i) => {
      let cls = "";

      if (i === q.correct) {
        cls = "correct";
      }

      if (selected === i && selected !== q.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;">
        <b>Explanation:</b> ${q.explanation}
      </div>
      <hr>
    `;
  });

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

  document.getElementById("result").innerHTML = `
    <h3>Your Score: ${score} / ${questions.length}</h3>
    <p><b>${userName}</b>, ${
      score >= 8 ? "Excellent work!" :
      score >= 5 ? "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