ch7 part1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>š§ Science Quiz ā Work Done</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;
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;
}
</style>
</head>
<body>
<div class="quiz-container">
<h2>š§ Science Quiz ā Work Done</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. Science mein work done ko kis situation mein define kiya jaata hai?",
options: [
"A. Jab force lage, chahe displacement ho ya nahi",
"B. Jab object ka mass change ho",
"C. Jab force object par displacement cause kare",
"D. Jab object sirf rest mein ho"
],
correct: 2,
explanation: "ā
Correct Answer: C. Jab force object par displacement cause kare.<br>Scientific meaning mein work tab hota hai jab force object par displacement produce kare. Sirf force lagna sufficient nahi hai."
},
{
question: "2. Ek 5 kg wheat bag ko slowly 1 m height tak lift kiya jaata hai. Bag par gravitational force kis direction mein act karta hai?",
options: [
"A. Upward",
"B. Downward",
"C. Horizontal right",
"D. Horizontal left"
],
correct: 1,
explanation: "ā
Correct Answer: B. Downward.<br>Gravitational force ya weight hamesha Earth ki taraf, yani downward act karta hai."
},
{
question: "3. Ek 5 kg wheat bag ko 1 m height tak slowly lift karne ke liye upward force approximately kitna hoga? Take g = 10 m/s².",
options: [
"A. 5 N",
"B. 10 N",
"C. 50 N",
"D. 500 N"
],
correct: 2,
explanation: "ā
Correct Answer: C. 50 N.<br>Weight = mg = 5 Ć 10 = 50 N. Bag ko slowly lift karne ke liye upward applied force approximately 50 N hona chahiye."
},
{
question: "4. Agar ek wheat bag ko 1 m ki jagah 3 m height tak same force se lift kiya jaaye, to work done kitna hoga?",
options: [
"A. 1/3 times",
"B. Same",
"C. 2 times",
"D. 3 times"
],
correct: 3,
explanation: "ā
Correct Answer: D. 3 times.<br>Work = Force Ć displacement. Same force mein displacement 1 m se 3 m ho gaya, isliye work 3 times ho jaayega."
},
{
question: "5. Ek bag ko same height tak lift karne ke liye agar applied force ko 2 times kar diya jaaye aur displacement same rahe, to work done par kya effect hoga?",
options: [
"A. Half ho jayega",
"B. Same rahega",
"C. 2 times ho jayega",
"D. 4 times ho jayega"
],
correct: 2,
explanation: "ā
Correct Answer: C. 2 times ho jayega.<br>W = F Ć s. Displacement same hai aur force 2 times hai, isliye work done bhi 2 times ho jaayega."
},
{
question: "6. Work done by a constant force ka correct formula kya hai, jab displacement force ki direction mein ho?",
options: [
"A. W = F/s",
"B. W = F Ć s",
"C. W = m/s",
"D. W = F + s"
],
correct: 1,
explanation: "ā
Correct Answer: B. W = F Ć s.<br>Jab force aur displacement same direction mein hon, work done = force Ć displacement."
},
{
question: "7. Ek object par 10 N ka constant force lagaya jaata hai aur object force ki direction mein 2 m move karta hai. Work done kitna hoga?",
options: [
"A. 5 J",
"B. 12 J",
"C. 20 J",
"D. 200 J"
],
correct: 2,
explanation: "ā
Correct Answer: C. 20 J.<br>W = F Ć s = 10 Ć 2 = 20 J."
},
{
question: "8. Work done ka SI unit kya hai?",
options: [
"A. Newton",
"B. Watt",
"C. Joule",
"D. Kilogram"
],
correct: 2,
explanation: "ā
Correct Answer: C. Joule.<br>Work ka SI unit joule (J) hai. 1 joule = 1 newton Ć 1 metre, yani 1 J = 1 N m."
},
{
question: "9. 1 joule work ka correct meaning kya hai?",
options: [
"A. 1 N force se object 1 m force ki direction mein displace ho",
"B. 1 kg object 1 m/s speed se move kare",
"C. 1 N force se object 1 s mein move kare",
"D. 1 kg object par 1 N force lage"
],
correct: 0,
explanation: "ā
Correct Answer: A. 1 N force se object 1 m force ki direction mein displace ho.<br>1 J work tab hota hai jab 1 N constant force object ko force ki direction mein 1 m displace kare."
},
{
question: "10. Force-displacement graph mein agar force constant ho, to work done graph mein kis quantity ke equal hota hai?",
options: [
"A. Graph ki slope",
"B. Graph ka shaded area",
"C. Graph ka highest point",
"D. Displacement ka square"
],
correct: 1,
explanation: "ā
Correct Answer: B. Graph ka shaded area.<br>Force-displacement graph mein work done curve ke neeche ke area ke equal hota hai. Constant force ke case mein ye rectangular area hota hai: W = F Ć s."
}
];
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;">
${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>