ch7 part7
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Science Quiz – Potential Energy | 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;
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;
}
.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;
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;
}
#result {
text-align: center;
margin-top: 20px;
color: #1e3c72;
}
@media(max-width:600px) {
body { padding: 10px; }
.quiz-container {
width: 100%;
padding: 15px;
}
}
</style>
</head>
<body>
<div class="quiz-container">
<h2>🧠 Science Quiz – Potential Energy<br>APICAL CLASSES</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"></div>
<div id="scoreboard">
<h3>🏆 Scoreboard</h3>
<ol id="scoreList"></ol>
</div>
</div>
</div>
<script>
const questions = [
{
question: "1. Stretched rubber band ko release karne par uske contact mein rakhe coins forward move karte hain. Coins ko motion kis wajah se milta hai?",
options: [
"A. Rubber band ki stored energy ke karan",
"B. Coins ke mass ke karan",
"C. Air friction ke karan",
"D. Coins ke temperature ke karan"
],
correct: 0,
explanation: "Stretched rubber band mein deformation ke karan energy store hoti hai. Release karne par ye energy coins ko kinetic energy deti hai."
},
{
question: "2. Slingshot ki stretched elastic band mein energy kyun store hoti hai?",
options: [
"A. Uska temperature increase hota hai",
"B. Uski shape/deformation change hoti hai",
"C. Uska mass increase hota hai",
"D. Uski velocity zero hoti hai"
],
correct: 1,
explanation: "Elastic band ko stretch karne par uski shape deform hoti hai. Is deformation ke karan work stored energy ke form mein store hota hai."
},
{
question: "3. Archer jab bow ki string ko pull karta hai aur bow bend ho jaata hai, to bow mein kya store hota hai?",
options: [
"A. Sound energy",
"B. Thermal energy",
"C. Potential energy",
"D. Nuclear energy"
],
correct: 2,
explanation: "Bent bow ki changed shape/configuration ke karan usmein potential energy store hoti hai, jo release hone par arrow ko kinetic energy deti hai."
},
{
question: "4. Ek spring ko stretch ya compress karne par spring mein energy kaise store hoti hai?",
options: [
"A. Spring ki deformation ke karan",
"B. Spring ki colour change ke karan",
"C. Spring ke mass change ke karan",
"D. Spring ke temperature zero hone ke karan"
],
correct: 0,
explanation: "Spring ko stretch ya compress karne mein work kiya jaata hai. Ye work spring ki deformed shape mein stored energy ke form mein rehta hai."
},
{
question: "5. Jab deformed spring ko release kiya jaata hai, to stored energy mainly kis form mein transfer ho sakti hai?",
options: [
"A. Kinetic energy",
"B. Nuclear energy",
"C. Chemical energy only",
"D. Mass"
],
correct: 0,
explanation: "Release hone par spring apni original shape ki taraf aati hai aur stored energy ko contact mein object ki kinetic energy mein transfer kar sakti hai."
},
{
question: "6. Spring ko deform karne ke liye external force ki zarurat kyun hoti hai?",
options: [
"A. Internal forces ko overcome karne ke liye",
"B. Spring ka mass badhane ke liye",
"C. Spring ko heat karne ke liye",
"D. Gravity ko completely remove karne ke liye"
],
correct: 0,
explanation: "Spring ke internal forces deformation ko oppose karte hain. Isliye external force laga kar un internal forces ko overcome karna padta hai."
},
{
question: "7. Do magnets ke unlike poles ko ek-doosre se separate karne par system mein energy kyun store hoti hai?",
options: [
"A. Magnets ka temperature badh jaata hai",
"B. Unki relative positions change hoti hain",
"C. Magnets ka mass double ho jaata hai",
"D. Magnetic force completely disappear ho jaata hai"
],
correct: 1,
explanation: "Unlike poles ek-doosre ko attract karte hain. Unhe separate karne mein work karna padta hai, isliye system unki relative position ke karan energy store karta hai."
},
{
question: "8. Do unlike magnetic poles ko separate karke release kiya jaaye, to kya hoga?",
options: [
"A. Magnets ek-doosre se aur door chale jaayenge",
"B. Magnets ek-doosre ki taraf move karenge aur kinetic energy gain karenge",
"C. Magnets stationary rahenge",
"D. Magnets ki mass decrease hogi"
],
correct: 1,
explanation: "Unlike poles attract karte hain. Release karne par magnets ek-doosre ki taraf move karte hain aur stored potential energy kinetic energy mein convert hoti hai."
},
{
question: "9. Ball ko Earth ki surface se height tak lift karne par ball-Earth system mein energy kis wajah se store hoti hai?",
options: [
"A. Ball aur Earth ki relative position ke karan",
"B. Ball ke colour ke karan",
"C. Ball ki shape change hone ke karan",
"D. Air friction ke karan"
],
correct: 0,
explanation: "Ball ko height par lift karne mein gravitational force ke against work kiya jaata hai. Isliye ball-Earth system mein relative position ke karan potential energy store hoti hai."
},
{
question: "10. Potential energy ki correct definition kya hai?",
options: [
"A. Sirf moving object ki energy",
"B. Deformation ya objects ki relative positions ke karan stored energy",
"C. Sirf heat ke karan stored energy",
"D. Sirf electrical current ki energy"
],
correct: 1,
explanation: "Potential energy kisi object ki deformation ke karan ya interacting objects ki relative positions ke karan stored energy hoti hai. Examples: stretched spring, bent bow aur raised ball."
}
];
let currentQuestion = 0;
let score = 0;
let userAnswers = [];
let userName = "";
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>
`;
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();
score = 0;
questions.forEach((q, index) => {
if (userAnswers[index] === q.correct) {
score++;
}
});
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("result").innerHTML = `
<h3>Your Score: ${score} / ${questions.length}</h3>
<p>${score >= 8 ? "Excellent Performance! 🎉" :
score >= 5 ? "Good Job! Keep Practicing! 👍" :
"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>