class 9 science chapter 4

ch4 part18

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Motion and Displacement Quiz | APICAL CLASSES</title>
<style>
* { box-sizing: border-box; }
body {
  font-family: Arial, sans-serif;
  background: linear-gradient(135deg, #a1c4fd, #c2e9fb);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
  min-height: 100vh;
}
.quiz-container {
  background: #fff;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 800px;
}
h2 { text-align: center; color: #1e3c72; }
.brand {
  text-align: center;
  color: #2a5298;
  font-weight: bold;
  letter-spacing: 2px;
  margin-bottom: 20px;
}
.question { font-weight: bold; margin: 15px 0; line-height: 1.6; }
.options label {
  display: block;
  margin: 9px 0;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid #ccc;
  cursor: pointer;
  transition: 0.2s;
  line-height: 1.5;
}
.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: 12px;
  border-left: 5px solid #2a5298;
  border-radius: 5px;
  line-height: 1.6;
}
.controls { text-align: center; margin-top: 20px; }
button {
  background-color: #2a5298;
  color: white;
  border: none;
  padding: 11px 20px;
  border-radius: 6px;
  cursor: pointer;
  margin: 5px;
  font-size: 15px;
}
button:hover { background-color: #1e3c72; }
#scoreboard {
  margin-top: 25px;
  background: #eef3f7;
  padding: 15px;
  border-radius: 8px;
}
#scoreboard h3 { text-align: center; }
ol { padding-left: 25px; }
#userName {
  padding: 11px;
  width: 100%;
  margin: 10px 0;
  border: 1px solid #aaa;
  border-radius: 5px;
}
.progress {
  color: #555;
  font-size: 14px;
  text-align: right;
}
#result {
  text-align: center;
  margin-top: 20px;
  line-height: 1.6;
}
@media(max-width:600px) {
  body { padding: 10px; }
  .quiz-container { padding: 16px; }
  h2 { font-size: 20px; }
  button { padding: 10px 14px; }
}
</style>
</head>

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

  <div class="brand">APICAL CLASSES</div>
  <h2>🧠 Motion, Velocity and Displacement Quiz</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 class="progress" id="progress"></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 Quiz</button>
    </div>

    <div id="result"></div>

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

<script>
const questions = [
{
question: "1. Ek student kehta hai, “Earth Sun ke around move karti hai.” Earth par rakhi hui ek book ko Earth ke reference frame mein kaise consider kiya ja sakta hai?",
options: [
"A. Book hamesha motion mein hai",
"B. Book Earth ke respect mein rest mein ho sakti hai",
"C. Book ka acceleration hamesha maximum hai",
"D. Book ki velocity hamesha zero nahi ho sakti"
],
correct: 1,
explanation: "Motion ya rest reference point/frame par depend karta hai. Earth ke respect mein book ki position change nahi ho rahi, isliye book Earth ke respect mein rest mein hai."
},
{
question: "2. Ek cyclist ke velocity-time graph mein kisi time interval ke dauran velocity constant 4 m/s hai. Is interval mein velocity-time graph ke neeche ka area kya represent karega?",
options: [
"A. Acceleration",
"B. Displacement",
"C. Force",
"D. Average acceleration"
],
correct: 1,
explanation: "Velocity-time graph ke neeche ka area displacement represent karta hai. Constant velocity ke case mein area = velocity × time."
},
{
question: "3. Ek cyclist 20 s tak 5 m/s ki constant velocity se move karta hai. Is duration mein displacement kitna hoga?",
options: [
"A. 25 m",
"B. 50 m",
"C. 100 m",
"D. 125 m"
],
correct: 2,
explanation: "Displacement = velocity × time = 5 × 20 = 100 m."
},
{
question: "4. Kisi cyclist ki velocity 120 s ke interval mein 6 m/s se 0 m/s ho jaati hai. Constant acceleration assume karne par average acceleration kya hogi?",
options: [
"A. +0.05 m/s²",
"B. −0.05 m/s²",
"C. −0.5 m/s²",
"D. +0.5 m/s²"
],
correct: 1,
explanation: "a = (v − u)/t = (0 − 6)/120 = −0.05 m/s². Negative sign batata hai ki velocity decrease ho rahi hai."
},
{
question: "5. Ek car 2 minutes tak 6 m/s ki constant velocity se move karti hai. Iske baad woh 1 m/s² acceleration ke saath 6 s tak accelerate karti hai. Total displacement kya hoga?",
options: [
"A. 720 m",
"B. 756 m",
"C. 774 m",
"D. 792 m"
],
correct: 2,
explanation: "First 120 s: s₁ = 6 × 120 = 720 m.<br>Next 6 s: s₂ = 6 × 6 + ½ × 1 × 6² = 36 + 18 = 54 m.<br>Total displacement = 720 + 54 = 774 m. Correct answer 774 m hai."
},
{
question: "6. Car A rest se start karke 5 s mein 5 m/s velocity attain karti hai. Car A ki acceleration kya hogi?",
options: [
"A. 0.5 m/s²",
"B. 1 m/s²",
"C. 2 m/s²",
"D. 5 m/s²"
],
correct: 1,
explanation: "a = (v − u)/t = (5 − 0)/5 = 1 m/s²."
},
{
question: "7. Car B rest se start karke 10 s mein 3 m/s velocity attain karti hai. Car B ki acceleration kya hogi?",
options: [
"A. 0.3 m/s²",
"B. 0.5 m/s²",
"C. 1.5 m/s²",
"D. 3 m/s²"
],
correct: 0,
explanation: "a = (v − u)/t = (3 − 0)/10 = 0.3 m/s²."
},
{
question: "8. Car A rest se start karti hai aur 5 s mein 5 m/s velocity tak pahunchti hai. Is 5 s mein uska displacement kitna hoga, assuming constant acceleration?",
options: [
"A. 10 m",
"B. 12.5 m",
"C. 20 m",
"D. 25 m"
],
correct: 1,
explanation: "Average velocity = (0 + 5)/2 = 2.5 m/s.<br>Displacement = 2.5 × 5 = 12.5 m."
},
{
question: "9. Rohan 6 PM se 7:30 PM tak clock ki minute hand ke tip ko observe karta hai. Minute hand ki length 7 cm hai. Is duration mein tip kitna distance travel karega?",
options: [
"A. 7π cm",
"B. 14π cm",
"C. 21π cm",
"D. 28π cm"
],
correct: 2,
explanation: "1.5 hours mein minute hand 1.5 revolutions complete karegi. One revolution distance = 2πr = 14π cm. Therefore distance = 1.5 × 14π = 21π cm."
},
{
question: "10. Rohan ke clock experiment mein minute hand ki tip 6 PM se 7:30 PM tak move karti hai. Is duration ke baad tip ka displacement kitna hoga?",
options: [
"A. 0 cm",
"B. 7 cm",
"C. 14 cm",
"D. 21π cm"
],
correct: 2,
explanation: "1.5 revolutions ke baad tip starting point ke exactly opposite position par hoti hai. Diameter = 2r = 2 × 7 = 14 cm, isliye displacement 14 cm 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("progress").textContent =
    "Question " + (currentQuestion + 1) + " of " + questions.length;

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

  const unanswered = userAnswers.findIndex(answer => answer === null);
  if (unanswered !== -1) {
    alert("Please answer all questions before submitting. Question " + (unanswered + 1) + " is unanswered.");
    currentQuestion = unanswered;
    showQuestion();
    return;
  }

  if (quizSubmitted) return;
  quizSubmitted = true;

  score = 0;
  questions.forEach((q, index) => {
    if (userAnswers[index] === q.correct) score++;
  });

  saveScore(userName, score);
  showResults();
  loadScoreboard();
}

function showResults() {
  const container = document.getElementById("questionContainer");
  let reviewHTML = "";

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

    const 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}
        ${i === q.correct ? " ✓ Correct Answer" : ""}
        ${selected === i && selected !== q.correct ? " ✗ Your Answer" : ""}
      </label>`;
    }).join("");

    reviewHTML += `
      <div class="question">${q.question}</div>
      <div class="options">${optsHTML}</div>
      <div class="explanation">
        <strong>Explanation:</strong> ${q.explanation}
      </div>
      <hr>
    `;
  });

  container.innerHTML = reviewHTML;
  document.querySelector(".controls").style.display = "none";
  document.getElementById("progress").style.display = "none";

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

  document.getElementById("result").innerHTML = `
    <h2>🎉 Quiz Completed!</h2>
    <h3>${userName}</h3>
    <h2>Your Score: ${score} / ${questions.length}</h2>
    <h3>Percentage: ${percentage.toFixed(1)}%</h3>
    <button onclick="location.reload()">Try Again</button>
  `;
}

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

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

Leave a Comment