ch7 part10
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Science Quiz – Conservation of Mechanical 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;
}
.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 – Conservation of Mechanical Energy</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. Activity 7.2 mein simple pendulum ke bob ko point P par le jaakar release kiya jata hai. Point P par bob ke paas kaunsi energy hoti hai?",
options: [
"A. Only kinetic energy",
"B. Only potential energy",
"C. No energy",
"D. Only sound energy"
],
correct: 1,
explanation: "Point P par bob extreme position par momentarily rest mein hota hai, isliye uski kinetic energy zero aur potential energy mgh hoti hai."
},
{
question: "2. Activity 7.2 mein pendulum bob ke bottom-most point Q par potential energy ko zero maana gaya hai. Q par bob ke paas mainly kaunsi energy hoti hai?",
options: [
"A. Kinetic energy",
"B. Potential energy",
"C. Chemical energy",
"D. Nuclear energy"
],
correct: 0,
explanation: "Q par bob ki height minimum hoti hai, isliye PE zero hai aur bob maximum speed ke paas hota hai, so kinetic energy hoti hai."
},
{
question: "3. Pendulum bob jab opposite extreme point R par pahunchta hai, to uski kinetic energy kya hoti hai?",
options: [
"A. Maximum",
"B. Half",
"C. Zero",
"D. Infinite"
],
correct: 2,
explanation: "Extreme point R par bob momentarily stop karta hai, isliye uski kinetic energy zero hoti hai."
},
{
question: "4. Activity 7.2 mein bob point P se release hone ke baad point R par approximately same height tak kyun pahunchta hai?",
options: [
"A. Mass increase ho jata hai",
"B. Mechanical energy conserved rehti hai",
"C. Gravity disappear ho jati hai",
"D. Air resistance energy provide karta hai"
],
correct: 1,
explanation: "Ideal condition mein potential energy aur kinetic energy ek-doosre mein convert hoti hain, lekin total mechanical energy constant rehti hai."
},
{
question: "5. Real life mein pendulum eventually stop kyun ho jata hai?",
options: [
"A. Gravity completely stop ho jati hai",
"B. Bob ka mass decrease ho jata hai",
"C. Friction aur air resistance ki wajah se energy loss hota hai",
"D. Potential energy continuously increase hoti hai"
],
correct: 2,
explanation: "Support par friction aur air resistance mechanical energy ko other forms mein transfer karte hain, isliye pendulum ki oscillations gradually decrease hoti hain."
},
{
question: "6. Conservation of mechanical energy ka use real-life problems mein kyun useful ho sakta hai?",
options: [
"A. Ye mass ko automatically calculate karta hai",
"B. Ye intermediate motion ke detailed steps ko avoid karke final speed ya position find karne mein help karta hai",
"C. Ye friction ko hamesha zero karta hai",
"D. Ye gravity ko remove karta hai"
],
correct: 1,
explanation: "Energy conservation se hum directly initial aur final mechanical energy compare karke final speed ya position nikal sakte hain."
},
{
question: "7. Example 7.8 mein child height h ke slide ke top par hai. Agar friction ko neglect karein, to bottom par child ki potential energy ka kya hota hai?",
options: [
"A. Entirely kinetic energy mein convert hoti hai",
"B. Entirely chemical energy mein convert hoti hai",
"C. Zero energy mein convert hoti hai",
"D. Mass mein convert hoti hai"
],
correct: 0,
explanation: "Friction neglect karne par mechanical energy conserved rehti hai. Top ki mgh potential energy bottom par kinetic energy ½mv² ban jati hai."
},
{
question: "8. Height h se slide karne wale child ki bottom par velocity v ke liye kaunsa relation correct hai?",
options: [
"A. v = gh",
"B. v = √(2gh)",
"C. v = 2gh",
"D. v = √(gh/2)"
],
correct: 1,
explanation: "Energy conservation se ½mv² = mgh. Isse v² = 2gh, therefore v = √(2gh)."
},
{
question: "9. Example 7.8 ke according, friction ko neglect karne par child ki bottom velocity kis factor par depend karti hai?",
options: [
"A. Sirf slide ki height h par",
"B. Sirf child ke mass par",
"C. Slide ke shape par",
"D. Child ke mass aur slide ke shape dono par"
],
correct: 0,
explanation: "v = √(2gh) mein child ka mass cancel ho jata hai aur slide ka shape bhi matter nahi karta. Velocity sirf height h par depend karti hai."
},
{
question: "10. Do children same height h se different-shaped slides par friction ko neglect karte hue slide karte hain. Unki bottom par speed kya hogi?",
options: [
"A. Different hogi because slides different hain",
"B. Same hogi if their starting conditions are the same",
"C. Heavier child ki speed hamesha zyada hogi",
"D. Lambi slide wale child ki speed zero hogi"
],
correct: 1,
explanation: "Conservation of mechanical energy ke according bottom speed v = √(2gh) hoti hai. Same height aur same starting condition par slide ka shape aur mass speed ko affect nahi karte."
}
];
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 = `
<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>
<div class="explanation" id="explain${currentQuestion}">${q.explanation}</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 nextQuestion() {
saveAnswer();
if (currentQuestion < questions.length - 1) {
currentQuestion++;
showQuestion();
}
}
function prevQuestion() {
saveAnswer();
if (currentQuestion > 0) {
currentQuestion--;
showQuestion();
}
}
function saveAnswer() {
const selected = document.querySelector('input[name="option"]:checked');
userAnswers[currentQuestion] = selected ? parseInt(selected.value) : null;
}
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;">
${q.explanation}
</div>
<hr>
`;
});
document.querySelector(".controls").style.display = "none";
document.getElementById("result").innerHTML =
`<h3>Your Score: ${score} / ${questions.length}</h3>`;
}
function saveScore(name, score) {
let scores = JSON.parse(localStorage.getItem("quizScores")) || [];
scores.push({
name,
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>