ch7 part2
<!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 | 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;
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: 15px 0;
line-height: 1.6;
}
.options label {
display: block;
margin: 8px 0;
padding: 12px;
border-radius: 6px;
border: 1px solid #ccc;
cursor: pointer;
transition: 0.3s;
}
.options label:hover {
background: #f0f0f0;
}
.options input {
margin-right: 8px;
}
.correct {
background-color: #c8f7c5 !important;
border-color: #28a745 !important;
}
.wrong {
background-color: #f8d7da !important;
border-color: #dc3545 !important;
}
.explanation {
background: #e9ecef;
padding: 12px;
margin-top: 12px;
border-left: 5px solid #2a5298;
line-height: 1.6;
display: none;
}
.controls {
text-align: center;
margin-top: 20px;
}
button {
background-color: #2a5298;
color: white;
border: none;
padding: 10px 20px;
border-radius: 6px;
cursor: pointer;
margin: 5px;
font-size: 15px;
}
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;
}
#userName {
padding: 10px;
width: 90%;
max-width: 350px;
border: 1px solid #ccc;
border-radius: 6px;
margin-bottom: 10px;
}
.progress {
text-align: center;
color: #555;
margin-bottom: 15px;
}
</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">
<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"></div>
<div id="scoreboard">
<h3>🏆 Scoreboard</h3>
<ol id="scoreList"></ol>
</div>
</div>
</div>
<script>
const questions = [
{
question: "1. Agar kisi object par acting force F = 0 hai, to object par work done kitna hoga?",
options: [
"A. Zero",
"B. One joule",
"C. Force ke equal",
"D. Displacement ke equal"
],
correct: 0,
explanation: "Work done ka formula W = F × s hai. Agar F = 0 hai, to work done bhi zero hoga."
},
{
question: "2. Ek person ek rigid wall ko bahut force se push karta hai, lekin wall move nahi hoti. Wall par scientific sense mein work done kitna hai?",
options: [
"A. Maximum",
"B. Zero",
"C. Negative",
"D. Positive"
],
correct: 1,
explanation: "Wall par force lag raha hai, lekin displacement zero hai. Isliye W = F × 0 = 0. Person tired ho sakta hai, lekin wall par scientific work zero hai."
},
{
question: "3. Ek girl ek box ko upar ki taraf force laga kar horizontal direction mein carry kar rahi hai. Box ka displacement horizontal hai. Girl ke upward force ke dwara box par work done kitna hoga?",
options: [
"A. Positive",
"B. Negative",
"C. Zero",
"D. Maximum"
],
correct: 2,
explanation: "Force upward hai aur displacement horizontal. Dono directions perpendicular hain, isliye force ki direction mein displacement nahi hai aur work done zero hai."
},
{
question: "4. Kisi object par force act kar raha hai, lekin object ka displacement zero hai. Work done ke baare mein kya correct hai?",
options: [
"A. Work always positive hoga",
"B. Work always negative hoga",
"C. Work zero hoga",
"D. Work force se greater hoga"
],
correct: 2,
explanation: "Work done = F × s. Jab s = 0, force kitna bhi ho, work done zero hota hai."
},
{
question: "5. Jab applied force aur object ka displacement same direction mein ho, to work done kaisa hota hai?",
options: [
"A. Positive",
"B. Negative",
"C. Zero",
"D. Undefined"
],
correct: 0,
explanation: "Force aur displacement same direction mein hone par force object ki motion ko support karta hai, isliye work done positive hota hai."
},
{
question: "6. Ek boy wheelchair ko forward direction mein push karta hai aur wheelchair bhi forward move karti hai. Boy dwara wheelchair par kiya gaya work kaisa hoga?",
options: [
"A. Zero work",
"B. Negative work",
"C. Positive work",
"D. No work because wheelchair has wheels"
],
correct: 2,
explanation: "Boy ka force aur wheelchair ka displacement same direction mein hain. Isliye boy wheelchair par positive work karta hai."
},
{
question: "7. Ek goalkeeper moving football ko stop karne ke liye ball ki motion ke opposite direction mein force lagata hai. Goalkeeper dwara ball par kiya gaya work kaisa hoga?",
options: [
"A. Positive",
"B. Negative",
"C. Zero",
"D. Infinite"
],
correct: 1,
explanation: "Goalkeeper ka force ball ke displacement ke opposite direction mein hai. Isliye goalkeeper ball par negative work karta hai."
},
{
question: "8. Moving football ko goalkeeper stop karta hai. Newton's Third Law ke according ball aur goalkeeper ek-doosre par kya force lagate hain?",
options: [
"A. Equal and opposite forces",
"B. Equal forces in same direction",
"C. Different forces in same direction",
"D. Sirf goalkeeper force lagata hai"
],
correct: 0,
explanation: "Newton's Third Law ke according dono objects ek-doosre par equal magnitude aur opposite direction ki forces lagate hain."
},
{
question: "9. Jab goalkeeper ball ko stop karta hai, ball goalkeeper par jo force lagati hai, us force ke dwara goalkeeper par work kaisa hota hai?",
options: [
"A. Negative work",
"B. Zero work",
"C. Positive work",
"D. No work"
],
correct: 2,
explanation: "Ball goalkeeper ko force karti hai aur goalkeeper ka displacement ball ke force ki direction mein hota hai. Isliye ball goalkeeper par positive work karti hai."
},
{
question: "10. Work ke baare mein kaunsa statement correct hai?",
options: [
"A. Work ki hamesha direction hoti hai.",
"B. Work sirf positive ho sakta hai.",
"C. Work ka koi direction nahi hota, lekin positive ya negative value ho sakti hai.",
"D. Work hamesha zero hota hai jab force lagta hai."
],
correct: 2,
explanation: "Force aur displacement vector quantities hain, lekin work ek scalar quantity hai. Work ko positive, negative ya zero value se describe kiya ja sakta 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>