class 9 science chapter 7

ch7 part6

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

.progress {
    text-align: center;
    color: #555;
    margin-bottom: 15px;
}

#userName {
    padding: 10px;
    width: 90%;
    max-width: 350px;
    border: 1px solid #ccc;
    border-radius: 6px;
    margin-bottom: 10px;
}
</style>
</head>

<body>

<div class="quiz-container">

<h2>🧠 Science Quiz – Kinetic Energy</h2>

<div id="nameSection">
    <p><strong>Enter your name to start:</strong></p>
    <input type="text" id="userName" placeholder="Your Name">
    <br>
    <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</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. Kinetic energy ka SI unit kya hai?",
options: [
"A. Newton (N)",
"B. Joule (J)",
"C. Watt (W)",
"D. Metre (m)"
],
correct: 1,
explanation: "Kinetic energy ka SI unit joule (J) hai, jo work ka bhi SI unit hai."
},

{
question: "2. Kinetic energy ke baare mein kaunsa statement correct hai?",
options: [
"A. Iski direction hoti hai.",
"B. Ye hamesha negative hoti hai.",
"C. Iski koi direction nahi hoti.",
"D. Ye sirf stationary object mein hoti hai."
],
correct: 2,
explanation: "Kinetic energy ek scalar quantity hai, isliye iski koi direction nahi hoti."
},

{
question: "3. Agar kisi object par positive work kiya jaata hai aur uski velocity increase hoti hai, to uski kinetic energy par kya effect hoga?",
options: [
"A. Decrease hogi",
"B. Increase hogi",
"C. Zero ho jayegi",
"D. Same rahegi"
],
correct: 1,
explanation: "Positive work se object ki velocity increase ho sakti hai, aur velocity badhne par kinetic energy bhi increase hoti hai."
},

{
question: "4. Agar kisi moving object par negative work kiya jaata hai aur uski velocity decrease hoti hai, to kinetic energy kya hogi?",
options: [
"A. Increase hogi",
"B. Decrease hogi",
"C. Same rahegi",
"D. Infinite ho jayegi"
],
correct: 1,
explanation: "K = 1/2 mv². Velocity decrease hone par kinetic energy bhi decrease hoti hai."
},

{
question: "5. Agar kisi object par force dwara zero work kiya jaata hai aur object ki velocity change nahi hoti, to uski kinetic energy ka kya hoga?",
options: [
"A. Increase hogi",
"B. Decrease hogi",
"C. Constant rahegi",
"D. Zero ho jayegi"
],
correct: 2,
explanation: "Velocity same hai, aur K = 1/2 mv². Isliye kinetic energy constant rahegi."
},

{
question: "6. Ek vehicle ki velocity v se badhkar 2v ho jaati hai. Uski kinetic energy original kinetic energy ki comparison mein kitni hogi?",
options: [
"A. 2 times",
"B. 3 times",
"C. 4 times",
"D. 8 times"
],
correct: 2,
explanation: "Kinetic energy velocity ke square ke proportional hai: K ∝ v². Velocity double hone par kinetic energy 2² = 4 times ho jaati hai."
},

{
question: "7. Ek cricket ball ka mass 0.2 kg hai aur delivery ke time uski velocity 43 m/s hai. Ball ki kinetic energy approximately kitni hogi?",
options: [
"A. 86 J",
"B. 184.9 J",
"C. 369.8 J",
"D. 925 J"
],
correct: 1,
explanation: "K = 1/2 mv² = 1/2 × 0.2 × 43² = 0.1 × 1849 = 184.9 J."
},

{
question: "8. Ek jet aircraft ka mass 15,000 kg hai aur landing ke time wire aircraft par 367,500 N backward force lagata hai. Aircraft 100 m mein stop ho jaata hai. Wire dwara kiya gaya work kitna hoga?",
options: [
"A. +36,750,000 J",
"B. −36,750,000 J",
"C. −367,500 J",
"D. +367,500 J"
],
correct: 1,
explanation: "Force aur aircraft ka displacement opposite direction mein hain. W = F × s = 367,500 × (−100) = −36,750,000 J."
},

{
question: "9. Aircraft carrier wale example mein jet aircraft wire ke contact se pehle approximately kitni velocity se move kar raha tha?",
options: [
"A. 35 m/s",
"B. 50 m/s",
"C. 70 m/s",
"D. 100 m/s"
],
correct: 2,
explanation: "Work-energy theorem ke according initial kinetic energy = stopping force dwara kiye gaye negative work ki magnitude. Calculation se v = 70 m/s milta hai, jo 252 km/h ke equal hai."
},

{
question: "10. Jet aircraft ko 100 m mein stop karne ke liye wire backward force lagata hai. Is process mein aircraft ki kinetic energy ka kya hota hai?",
options: [
"A. Kinetic energy increase hoti hai",
"B. Kinetic energy decrease hokar zero ho jaati hai",
"C. Kinetic energy constant rehti hai",
"D. Kinetic energy mass mein convert ho jaati hai"
],
correct: 1,
explanation: "Wire aircraft ke motion ke opposite force lagata hai aur negative work karta hai. Isse aircraft ki kinetic energy decrease hoti hai aur stop hone par zero ho jaati 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";

    showQuestion();
    loadScoreboard();
}

function showQuestion() {

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

    document.getElementById("progress").innerText =
        "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() {

    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";
    document.getElementById("progress").style.display = "none";

    document.getElementById("result").innerHTML = `
        <h3>Your Score: ${score} / ${questions.length}</h3>
        <p><strong>Student Name:</strong> ${userName}</p>
        <p>Correct Answers: ${score}</p>
        <p>Incorrect / Unanswered: ${questions.length - score}</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