ch6 part11
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Science Quiz – Newton's Second Law of 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;
margin: 0;
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: 65%;
max-width: 300px;
border: 1px solid #ccc;
border-radius: 6px;
}
</style>
</head>
<body>
<div class="quiz-container">
<h2>🧠 Science Quiz – Newton's Second Law of 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 weightlifter 10 kg mass ka barbell har side par hold kar rahi hai aur bar ka mass bhi 10 kg hai. Barbell ka total mass kitna hoga?",
options: [
"A. 20 kg",
"B. 25 kg",
"C. 30 kg",
"D. 40 kg"
],
correct: 2,
explanation: "Dono sides ka mass = 10 + 10 = 20 kg. Bar ka mass 10 kg hai. Total mass = 20 + 10 = 30 kg."
},
{
question: "2. 30 kg ke barbell par Earth ki gravitational force kitni hogi? Take g = 9.8 m/s².",
options: [
"A. 196 N",
"B. 294 N",
"C. 300 N",
"D. 392 N"
],
correct: 1,
explanation: "Gravitational force F = mg = 30 × 9.8 = 294 N."
},
{
question: "3. Weightlifter 30 kg barbell ko steady hold kar rahi hai. Barbell ko steady rakhne ke liye weightlifter ko kitna upward force lagana hoga?",
options: [
"A. 30 N",
"B. 150 N",
"C. 294 N",
"D. 588 N"
],
correct: 2,
explanation: "Barbell steady hai, isliye net force zero hona chahiye. Downward gravitational force 294 N ko balance karne ke liye 294 N upward force required hai."
},
{
question: "4. Rahul 25 kg ke stationary block ko 50 N force se push karta hai. Friction bhi maximum 50 N hai. 2 seconds mein block kitna displacement karega?",
options: [
"A. 0 m",
"B. 0.2 m",
"C. 0.4 m",
"D. 1 m"
],
correct: 0,
explanation: "Applied force = friction = 50 N. Net force = 0, isliye acceleration zero hai aur stationary block move nahi karega. Displacement 0 m hoga."
},
{
question: "5. 25 kg block par 55 N forward force aur 50 N friction opposite direction mein act kar rahe hain. Block par net force kitna hoga?",
options: [
"A. 105 N",
"B. 55 N",
"C. 50 N",
"D. 5 N"
],
correct: 3,
explanation: "Opposite forces ko subtract karte hain: 55 N − 50 N = 5 N forward."
},
{
question: "6. 25 kg block par net force 5 N hai. Block ki acceleration kitni hogi?",
options: [
"A. 0.1 m/s²",
"B. 0.2 m/s²",
"C. 2 m/s²",
"D. 5 m/s²"
],
correct: 1,
explanation: "Newton’s second law: a = F/m = 5/25 = 0.2 m/s²."
},
{
question: "7. Q6 wale block ki initial velocity 0 m/s hai aur acceleration 0.2 m/s² hai. 2 seconds mein displacement kitna hoga?",
options: [
"A. 0.2 m",
"B. 0.4 m",
"C. 0.8 m",
"D. 1.0 m"
],
correct: 1,
explanation: "s = ut + ½at². Yahan u = 0, a = 0.2 aur t = 2 s. Isliye s = ½ × 0.2 × 4 = 0.4 m."
},
{
question: "8. 1500 kg sports car 0 se 10 m/s velocity 5 seconds mein reach karti hai. Car par force kitna hoga?",
options: [
"A. 1500 N",
"B. 2000 N",
"C. 3000 N",
"D. 5000 N"
],
correct: 2,
explanation: "Acceleration = (10 − 0)/5 = 2 m/s². Force = ma = 1500 × 2 = 3000 N east."
},
{
question: "9. Sports car 5 s se 10 s tak constant velocity se move karti hai. Is interval mein net force kitna hoga?",
options: [
"A. 3000 N",
"B. 1500 N",
"C. 500 N",
"D. 0 N"
],
correct: 3,
explanation: "Constant velocity ka matlab acceleration zero hai. F = ma, isliye net force = 1500 × 0 = 0 N."
},
{
question: "10. Sports car 10 s se 15 s mein 10 m/s se 0 m/s par slow hoti hai. Car ka mass 1500 kg hai. Force ki magnitude aur direction kya hogi?",
options: [
"A. 3000 N east",
"B. 3000 N west",
"C. 1500 N west",
"D. 1500 N east"
],
correct: 1,
explanation: "Acceleration = (0 − 10)/5 = −2 m/s². Force = 1500 × (−2) = −3000 N. Negative sign batata hai ki force motion ke opposite, yani west direction mein 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");
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 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";
const percentage = (score / questions.length) * 100;
document.getElementById("result").innerHTML = `
<h3>Your Score: ${score} / ${questions.length}</h3>
<h3>Percentage: ${percentage}%</h3>
<p>${score >= 8 ? "Excellent Work! 🎉" : score >= 5 ? "Good Effort! 👍" : "Keep Practising! 📚"}</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>