ch7 part4
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>đź§ Work and Energy 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;
}
.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;
line-height: 1.5;
}
.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;
}
#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>🧠Work and Energy Quiz – 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" 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. Kisi object ke paas capacity to do work ho, to science mein us object ke paas kya kaha jaata hai?",
options: [
"A. Force",
"B. Energy",
"C. Acceleration",
"D. Displacement"
],
correct: 1,
explanation: "Kisi object ki work karne ki capacity ko energy kehte hain."
},
{
question: "2. Ek fielder cricket ball ko force laga kar wicket ki taraf throw karta hai. Ball ko energy kaise milti hai?",
options: [
"A. Wicket ke force se",
"B. Gravity ke zero hone se",
"C. Fielder dwara ball par kiye gaye work se",
"D. Air friction se"
],
correct: 2,
explanation: "Fielder ball par positive work karta hai, jisse ball ki energy increase hoti hai."
},
{
question: "3. Ek flowerpot ko ground se utha kar height par rakha jaata hai. Pot ko energy kaise milti hai?",
options: [
"A. Pot par work done ke through",
"B. Air pressure ke through",
"C. Sound energy ke through",
"D. Friction ke through"
],
correct: 0,
explanation: "Pot ko height tak raise karne mein work kiya jaata hai. Ye work pot ki gravitational potential energy increase karta hai."
},
{
question: "4. Work-Energy Theorem ke according kisi object par kiya gaya net work kis ke equal hota hai?",
options: [
"A. Object ke mass ke",
"B. Object ke displacement ke",
"C. Object ki kinetic energy mein change ke",
"D. Object ke velocity ke"
],
correct: 2,
explanation: "Work-Energy Theorem ke according, kisi object par kiya gaya net work uski kinetic energy mein change ke equal hota hai."
},
{
question: "5. Jab kisi object par positive net work kiya jaata hai, to object ki kinetic energy par kya effect hota hai?",
options: [
"A. Energy decrease hoti hai",
"B. Energy increase hoti hai",
"C. Energy always zero ho jaati hai",
"D. Mass decrease hota hai"
],
correct: 1,
explanation: "Positive net work object ki kinetic energy increase karta hai."
},
{
question: "6. Cricket ball wicket se takrakar wickets ko move kar deti hai. Is situation mein energy ka kya hota hai?",
options: [
"A. Ball ki energy destroy ho jaati hai",
"B. Ball apni energy wickets ko transfer karti hai",
"C. Wickets ball ko energy deti hain only",
"D. Koi energy transfer nahi hoti"
],
correct: 1,
explanation: "Moving ball ke paas kinetic energy hoti hai. Collision ke during ball apni energy ka kuch part wickets ko transfer karti hai, jisse wickets move karti hain."
},
{
question: "7. Carrom mein moving striker white coin se collide karta hai. Striker white coin par positive work karta hai. White coin ki energy par kya effect hoga?",
options: [
"A. Increase hogi",
"B. Decrease hogi",
"C. Zero ho jayegi",
"D. Same rahegi"
],
correct: 0,
explanation: "Striker white coin ko force deta hai aur uski direction mein displacement produce karta hai. Isliye positive work hota hai aur white coin ki kinetic energy increase hoti hai."
},
{
question: "8. Carrom mein moving striker white coin se collide karta hai. Newton's Third Law ke according white coin striker par opposite force lagata hai. Is force ke dwara striker par work kaisa hoga?",
options: [
"A. Positive",
"B. Negative",
"C. Zero",
"D. Infinite"
],
correct: 1,
explanation: "Collision ke dauran white coin ka force striker ke displacement ke opposite direction mein hota hai. Isliye white coin striker par negative work karta hai aur striker ki kinetic energy decrease hoti hai."
},
{
question: "9. Energy ke baare mein kaunsa statement correct hai?",
options: [
"A. Energy sirf mechanical work ke through transfer ho sakti hai.",
"B. Energy heat, radiation, electric circuits aur sound waves ke through bhi transfer ho sakti hai.",
"C. Energy kabhi heat ke form mein transfer nahi hoti.",
"D. Energy sirf moving objects mein hoti hai."
],
correct: 1,
explanation: "Energy transfer ke many ways hain—mechanical work, heat, radiation, electrical transfer aur sound waves."
},
{
question: "10. Work aur energy ka SI unit kya hai?",
options: [
"A. Newton (N)",
"B. Watt (W)",
"C. Joule (J)",
"D. Metre (m)"
],
correct: 2,
explanation: "Work aur energy dono ka SI unit Joule (J) hai. Work done energy transfer aur change se connected hota hai."
}
];
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>
<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() {
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 Attempt! Keep Practising." :
"Keep Learning and Try Again!"}</p>
`;
}
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>