ch4 part17
<!DOCTYPE html>
<html lang="en">
<head>
<title>🧠 Science Quiz – Motion</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;
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: 60%;
max-width: 300px;
border: 1px solid #ccc;
border-radius: 6px;
}
</style>
</head>
<body>
<div class="quiz-container">
<h2>🧠 Science Quiz – Motion</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. Ek person ghar se 250 m door shop tak jaata hai, phir bag lene ke liye ghar wapas aata hai, dobara shop jaata hai aur provisions lekar phir ghar wapas aa jaata hai. Uska total distance aur displacement kya hoga?",
options: [
"A. Distance = 500 m, displacement = 0 m",
"B. Distance = 750 m, displacement = 250 m",
"C. Distance = 1000 m, displacement = 0 m",
"D. Distance = 1000 m, displacement = 250 m"
],
correct: 2,
explanation: "Person ne 250 m ki journey <b>4 times</b> ki.<br>Total distance = 250 × 4 = <b>1000 m</b>.<br>Starting aur final position same hai, isliye displacement = <b>0 m</b>."
},
{
question: "2. Ek student ground floor se 4th floor tak jaata hai aur phir 2nd floor par apni classroom mein wapas aata hai. Har floor ki height 3 m hai. Total vertical distance aur displacement kya hoga?",
options: [
"A. Distance = 12 m, displacement = 6 m",
"B. Distance = 18 m, displacement = 6 m",
"C. Distance = 18 m, displacement = 12 m",
"D. Distance = 6 m, displacement = 18 m"
],
correct: 1,
explanation: "Ground se 4th floor = 4 × 3 = <b>12 m</b>.<br>4th se 2nd floor = 2 × 3 = <b>6 m</b>.<br>Total distance = 12 + 6 = <b>18 m</b>.<br>Displacement = <b>6 m upward</b>."
},
{
question: "3. Ek scooter ka speedometer constant speed show kar raha hai. Kya scooter phir bhi accelerate kar sakta hai?",
options: [
"A. Nahi, constant speed ka matlab acceleration hamesha zero hai",
"B. Haan, agar scooter ki direction continuously change ho rahi ho",
"C. Nahi, acceleration sirf speed badhne par hoti hai",
"D. Haan, lekin sirf jab scooter rest mein ho"
],
correct: 1,
explanation: "Acceleration velocity ke change hone ki wajah se hoti hai. <b>Speed constant</b> hone ke baad bhi direction change hone par velocity change hoti hai, isliye acceleration ho sakti hai."
},
{
question: "4. Ek car rest se start karti hai aur 6 s mein 24 m/s ki velocity reach karti hai. Average acceleration aur 6 s mein travelled distance kya hoga?",
options: [
"A. 4 m/s² aur 72 m",
"B. 4 m/s² aur 144 m",
"C. 6 m/s² aur 72 m",
"D. 6 m/s² aur 144 m"
],
correct: 0,
explanation: "a = (v − u)/t = (24 − 0)/6 = <b>4 m/s²</b>.<br>s = ut + ½at²<br>= 0 + ½ × 4 × 6²<br>= <b>72 m</b>."
},
{
question: "5. Ek motorbike 28 m/s ki initial velocity se move kar rahi hai aur 98 m travel karne ke baad stop ho jaati hai. Uski acceleration aur stopping time kya hoga?",
options: [
"A. −2 m/s², 10 s",
"B. −4 m/s², 7 s",
"C. −4 m/s², 14 s",
"D. −7 m/s², 4 s"
],
correct: 1,
explanation: "v² = u² + 2as<br>0 = 28² + 2 × a × 98<br>a = <b>−4 m/s²</b>.<br>v = u + at<br>0 = 28 − 4t<br>t = <b>7 s</b>."
},
{
question: "6. Position-time graph mein do objects A aur B ke graphs ki slopes kisi point par equal hain. Us point par unki velocities ke baare mein kya kaha ja sakta hai?",
options: [
"A. Dono ki velocity equal hai",
"B. Dono ka displacement equal hai",
"C. Dono ki acceleration equal hai",
"D. Dono ki distance equal hai"
],
correct: 0,
explanation: "Position-time graph ka <b>slope velocity</b> represent karta hai. Isliye equal slopes ka matlab <b>equal velocity</b> hai."
},
{
question: "7. Do objects A aur B ke position-time graphs mein 0 se 10 s ke interval mein unki initial aur final positions same hain. Is information se kya definitely conclude kiya ja sakta hai?",
options: [
"A. Dono ki average velocity equal hai",
"B. Dono ki average speed equal hai",
"C. Dono ki instantaneous velocity har moment equal hai",
"D. Dono ne exactly same path follow kiya hai"
],
correct: 0,
explanation: "Average velocity = <b>Displacement / Time</b>.<br>Same initial aur final positions ka matlab dono ka displacement same hai. Time interval bhi same hai, isliye average velocity equal hogi."
},
{
question: "8. Ek truck 54 km/h ki speed se chal raha tha aur 36 s mein speed ko 36 km/h tak reduce karta hai. Constant acceleration maan kar is duration mein truck ne kitna distance travel kiya?",
options: [
"A. 360 m",
"B. 400 m",
"C. 450 m",
"D. 540 m"
],
correct: 2,
explanation: "54 km/h = <b>15 m/s</b> aur 36 km/h = <b>10 m/s</b>.<br>Average velocity = (15 + 10)/2 = <b>12.5 m/s</b>.<br>Distance = 12.5 × 36 = <b>450 m</b>."
},
{
question: "9. Ek car rest se 5 s mein uniformly 20 m/s tak accelerate karti hai, phir 10 s tak 20 m/s ki constant speed se chalti hai, aur finally 6 s mein uniformly stop ho jaati hai. Total distance kitna hoga?",
options: [
"A. 250 m",
"B. 300 m",
"C. 310 m",
"D. 350 m"
],
correct: 2,
explanation: "First part: s₁ = ½ × 20 × 5 = <b>50 m</b>.<br>Second part: s₂ = 20 × 10 = <b>200 m</b>.<br>Third part: s₃ = ½ × 20 × 6 = <b>60 m</b>.<br>Total distance = 50 + 200 + 60 = <b>310 m</b>."
},
{
question: "10. Ek bus 36 km/h ki speed se chal rahi hai. Driver ko 30 m ahead obstacle dikhta hai. Reaction time 0.5 s hai. Brake lagne ke baad bus ki constant deceleration 2.5 m/s² hai. Kya bus obstacle se pehle stop ho jayegi?",
options: [
"A. Haan, 5 m pehle stop hogi",
"B. Haan, 10 m pehle stop hogi",
"C. Nahi, bus exactly obstacle tak jaakar stop hogi",
"D. Nahi, bus obstacle se 10 m pehle hi stop hogi"
],
correct: 0,
explanation: "36 km/h = <b>10 m/s</b>.<br>Reaction distance = 10 × 0.5 = <b>5 m</b>.<br>Braking distance = u²/(2a) = 100/(2 × 2.5) = <b>20 m</b>.<br>Total stopping distance = 5 + 20 = <b>25 m</b>.<br>Obstacle 30 m ahead hai, isliye bus <b>5 m pehle stop hogi</b>."
}
];
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>
`;
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;">
${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 = [];
try {
scores = JSON.parse(localStorage.getItem("quizScores")) || [];
} catch (error) {
scores = [];
}
scores.push({
name: name,
score: score,
date: new Date().toLocaleString()
});
localStorage.setItem("quizScores", JSON.stringify(scores));
}
function loadScoreboard() {
let scores = [];
try {
scores = JSON.parse(localStorage.getItem("quizScores")) || [];
} catch (error) {
scores = [];
}
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>