class 9 science chapter 4

ch4 part15

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>🧠 APICAL CLASSES – Science 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;
  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;
}
.subtitle {
  text-align: center;
  color: #555;
  font-weight: bold;
}
.question {
  font-weight: bold;
  margin: 15px 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: 12px;
  margin-top: 10px;
  border-left: 5px solid #2a5298;
  line-height: 1.6;
  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;
}
#userName {
  padding: 10px;
  width: 95%;
  max-width: 350px;
  border: 1px solid #ccc;
  border-radius: 6px;
}
#result {
  text-align: center;
  margin-top: 20px;
  color: #1e3c72;
}
</style>
</head>

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

  <h2>🧠 APICAL CLASSES – SCIENCE QUIZ</h2>
  <p class="subtitle">Motion in Two Dimensions & Uniform Circular Motion</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="questionCounter"></div>
    <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"></div>

    <div id="scoreboard">
      <h3>🏆 Scoreboard</h3>
      <ol id="scoreList"></ol>
    </div>
  </div>
</div>

<script>
const questions = [
  {
    question: "Q1. Vehicle ka kisi doosre vehicle ko overtake karna, kicked ball ka curved path follow karna, aur satellite ka circular path mein move karna kis type of motion ke examples hain?",
    options: [
      "A. Motion in one dimension",
      "B. Motion in two dimensions",
      "C. Motion at rest",
      "D. Uniform linear motion"
    ],
    correct: 1,
    explanation: "Motion jo plane mein hoti hai, use motion in two dimensions kaha jaata hai."
  },
  {
    question: "Q2. Ek child merry-go-round par circular path mein A se B aur phir C tak move karta hai. Is motion mein distance aur displacement ke beech kya relationship hoga?",
    options: [
      "A. Dono hamesha equal honge",
      "B. Distance zero aur displacement non-zero hoga",
      "C. Distance curved path ABC aur displacement straight-line AC hoga",
      "D. Distance aur displacement dono zero honge"
    ],
    correct: 2,
    explanation: "Distance actual curved path ABC hota hai, jabki displacement initial aur final position ke beech straight-line AC hota hai."
  },
  {
    question: "Q3. Radius R wale circular path par ek object ek complete revolution karta hai. Object dwara travelled distance kitna hoga?",
    options: [
      "A. R",
      "B. 2R",
      "C. πR",
      "D. 2πR"
    ],
    correct: 3,
    explanation: "Circle ki circumference 2πR hoti hai. Ek complete revolution mein object itna distance travel karta hai."
  },
  {
    question: "Q4. Radius R ke circular path par object ek complete revolution ke baad apni original position par return karta hai. Uska displacement kya hoga?",
    options: [
      "A. R",
      "B. 2R",
      "C. 2πR",
      "D. 0"
    ],
    correct: 3,
    explanation: "Initial aur final position same hai, isliye complete revolution ke baad displacement zero hota hai."
  },
  {
    question: "Q5. Ek object radius R ke circular path par ek revolution T seconds mein complete karta hai. Uski average speed ka expression kya hoga?",
    options: [
      "A. 2πR/T",
      "B. R/T",
      "C. 2πT/R",
      "D. T/2πR"
    ],
    correct: 0,
    explanation: "Average speed = Total distance / Time. One revolution ka distance 2πR hai, isliye average speed = 2πR/T."
  },
  {
    question: "Q6. Uniform circular motion ki correct definition kya hai?",
    options: [
      "A. Circular path par changing speed ke saath motion",
      "B. Straight line mein constant speed ke saath motion",
      "C. Circular path par constant speed ke saath motion",
      "D. Circular path par zero velocity ke saath motion"
    ],
    correct: 2,
    explanation: "Jab object circular path par constant speed se move karta hai, usse uniform circular motion kehte hain."
  },
  {
    question: "Q7. Uniform circular motion mein object ki speed constant hoti hai. Phir bhi velocity change kyun hoti hai?",
    options: [
      "A. Mass continuously change hota hai",
      "B. Direction of velocity continuously change hoti hai",
      "C. Distance zero hota hai",
      "D. Time ruk jaata hai"
    ],
    correct: 1,
    explanation: "Velocity mein magnitude ke saath direction bhi important hoti hai. Circular motion mein direction continuously change hoti hai."
  },
  {
    question: "Q8. Ek circular path par moving marble ko ring hata kar release kar diya jaata hai. Marble kis direction mein move karega?",
    options: [
      "A. Circle ke centre ki taraf",
      "B. Circle ke opposite direction mein",
      "C. Us point par circle ki tangent ki direction mein",
      "D. Random direction mein"
    ],
    correct: 2,
    explanation: "Ring remove hone ke instant par marble tangent direction mein straight line mein move karta hai."
  },
  {
    question: "Q9. Uniform circular motion mein acceleration zero kyun nahi hoti, jabki speed constant hoti hai?",
    options: [
      "A. Object ka mass change hota hai",
      "B. Object ki direction of velocity continuously change hoti hai",
      "C. Object ki speed continuously increase hoti hai",
      "D. Object circular path mein rest mein hota hai"
    ],
    correct: 1,
    explanation: "Acceleration velocity ke change ki wajah se hoti hai. Uniform circular motion mein speed constant hai, lekin velocity ki direction continuously change hoti hai, isliye acceleration non-zero hoti hai."
  },
  {
    question: "Q10. Uniform circular motion ko real-world motion ka idealised model kyun kaha jaata hai?",
    options: [
      "A. Real world mein circular motion kabhi nahi hoti",
      "B. Real situations mein constant speed aur perfectly circular path ki conditions hamesha satisfy nahi hoti",
      "C. Circular motion mein acceleration hamesha zero hoti hai",
      "D. Real objects circular motion nahi kar sakte"
    ],
    correct: 1,
    explanation: "Real world mein constant speed aur perfect circular path ki conditions often exactly meet nahi hoti, lekin uniform circular motion complex motions ko samajhne ke liye useful model 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";

  userAnswers = new Array(questions.length).fill(null);
  showQuestion();
  loadScoreboard();
}

function showQuestion() {
  const q = questions[currentQuestion];
  const container = document.getElementById("questionContainer");

  document.getElementById("questionCounter").innerHTML =
    "<strong>Question " + (currentQuestion + 1) +
    " of " + questions.length + "</strong>";

  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, 10) : 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");
  let resultHTML = "";

  questions.forEach((q, index) => {
    const selected = userAnswers[index];
    const correct = q.correct;

    const 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("");

    resultHTML += `
      <div class="question">${q.question}</div>
      <div class="options">${optsHTML}</div>
      <div class="explanation" style="display:block;">
        <strong>Correct Answer:</strong> ${q.options[correct]}<br><br>
        <strong>Explanation:</strong> ${q.explanation}
      </div>
      <hr>
    `;
  });

  container.innerHTML = resultHTML;

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

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

  document.getElementById("result").innerHTML = `
    <h3>🎉 Quiz Completed!</h3>
    <h2>Your Score: ${score} / ${questions.length}</h2>
    <h3>Percentage: ${percentage}%</h3>
  `;
}

function escapeHTML(value) {
  return String(value).replace(/[&<>"']/g, char => ({
    "&": "&amp;",
    "<": "&lt;",
    ">": "&gt;",
    '"': "&quot;",
    "'": "&#039;"
  })[char]);
}

function saveScore(name, score) {
  let scores = [];

  try {
    scores = JSON.parse(localStorage.getItem("quizScores")) || [];
    if (!Array.isArray(scores)) scores = [];
  } catch (error) {
    scores = [];
  }

  scores.push({
    name: name,
    score: score,
    total: questions.length,
    date: new Date().toLocaleString()
  });

  localStorage.setItem("quizScores", JSON.stringify(scores));
}

function loadScoreboard() {
  let scores = [];

  try {
    scores = JSON.parse(localStorage.getItem("quizScores")) || [];
    if (!Array.isArray(scores)) scores = [];
  } catch (error) {
    scores = [];
  }

  scores.sort((a, b) => b.score - a.score);

  document.getElementById("scoreList").innerHTML =
    scores.map(s => `
      <li>
        ${escapeHTML(s.name)} -
        ${s.score}/${s.total || 10}
        (${escapeHTML(s.date || "")})
      </li>
    `).join("");
}
</script>
</body>
</html>

Leave a Comment