ch6 part13
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Newton's Third Law Quiz | 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;
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; }
.brand {
text-align: center;
color: #555;
font-weight: bold;
letter-spacing: 1px;
}
.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; }
.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: 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; }
input[type="text"] {
padding: 10px;
width: 65%;
max-width: 300px;
border: 1px solid #aaa;
border-radius: 6px;
}
#scoreboard {
margin-top: 25px;
background: #eef3f7;
padding: 15px;
border-radius: 8px;
}
#scoreboard h3 { text-align: center; }
ol { padding-left: 20px; }
.result-summary {
text-align: center;
margin: 20px 0;
padding: 15px;
background: #eef3f7;
border-radius: 8px;
}
@media(max-width:600px) {
body { padding: 10px; }
.quiz-container { width: 100%; padding: 15px; }
}
</style>
</head>
<body>
<div class="quiz-container">
<div class="brand">APICAL CLASSES</div>
<h2>π§ Newton's Third Law of Motion Quiz</h2>
<p style="text-align:center;">Action and Reaction, Walking and Friction | 10 MCQs</p>
<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. Jab ek girl table ko forward direction mein push karti hai, table girl par force kis direction mein lagata hai?",
options: [
"A. Forward",
"B. Backward",
"C. Upward",
"D. Downward"
],
correct: 1,
explanation: "Girl table par forward force lagati hai. Newtonβs Third Law ke according table girl par opposite direction, yani backward force lagata hai."
},
{
question: "2. Jab girl table ko reverse direction mein pull karti hai, table girl par force kis direction mein lagata hai?",
options: [
"A. Girl ke pull ke opposite direction mein",
"B. Girl ke pull ki same direction mein",
"C. Sirf downward",
"D. Sirf upward"
],
correct: 0,
explanation: "Action aur reaction forces opposite directions mein act karte hain. Isliye table girl par opposite direction mein force lagata hai."
},
{
question: "3. Bicycle par rider ground ko backward push karta hai. Ground rider aur bicycle ko kis direction mein push karta hai?",
options: [
"A. Backward",
"B. Forward",
"C. Downward",
"D. Sideways"
],
correct: 1,
explanation: "Rider ground ko backward push karta hai. Ground reaction force ke roop mein rider ke feet par forward force lagata hai, jisse bicycle forward move karti hai."
},
{
question: "4. Walking ke time foot ground ko kis direction mein push karta hai?",
options: [
"A. Forward",
"B. Backward",
"C. Upward",
"D. Left side"
],
correct: 1,
explanation: "Walking mein foot ground ko backward push karta hai. Iske response mein ground foot par forward frictional force lagata hai."
},
{
question: "5. Walking ke time ground ka frictional force person ke foot par kis direction mein act karta hai?",
options: [
"A. Backward",
"B. Forward",
"C. Downward",
"D. Upward"
],
correct: 1,
explanation: "Foot ground ko backward push karta hai aur foot ke backward slip karne ki tendency hoti hai. Isliye friction forward direction mein act karta hai."
},
{
question: "6. Agar walking ke time friction bilkul na ho, to kya hoga?",
options: [
"A. Person easily run karega",
"B. Foot backward slip kar sakta hai aur person gir sakta hai",
"C. Person ki speed automatically increase hogi",
"D. Person hawa mein float karega"
],
correct: 1,
explanation: "Friction ke bina foot aur ground ke beech proper grip nahi hogi. Foot backward slip kar sakta hai aur person fall kar sakta hai."
},
{
question: "7. Footwear ke soles par grooves banane ka main purpose kya hai?",
options: [
"A. Shoes ko lightweight banana",
"B. Friction increase karna",
"C. Shoes ka colour change karna",
"D. Shoes ko flexible banana"
],
correct: 1,
explanation: "Grooves floor aur footwear ke soles ke beech friction increase karte hain, jisse slipping kam hoti hai."
},
{
question: "8. Vehicles ke tyres par treads ka main function kya hai?",
options: [
"A. Tyre ka mass increase karna",
"B. Road aur tyre ke beech friction increase karna",
"C. Engine ki power increase karna",
"D. Vehicle ki height increase karna"
],
correct: 1,
explanation: "Tyre ke treads road ke saath friction/grip badhate hain, jisse vehicle ko control karna easier hota hai."
},
{
question: "9. Wet polished floor par walking difficult kyun hoti hai?",
options: [
"A. Friction decrease ho jaata hai",
"B. Friction bahut increase ho jaata hai",
"C. Gravitational force disappear ho jaata hai",
"D. Person ka mass decrease ho jaata hai"
],
correct: 0,
explanation: "Wet polished surface par feet aur floor ke beech friction kam ho jaata hai. Isliye feet easily slip kar sakte hain."
},
{
question: "10. Water ya snow-covered road par driving risky kyun hoti hai?",
options: [
"A. Tyres aur road ke beech friction kam ho jaata hai",
"B. Tyres aur road ke beech friction bahut increase ho jaata hai",
"C. Vehicle ka mass suddenly increase ho jaata hai",
"D. Engine automatically stop ho jaata hai"
],
correct: 0,
explanation: "Water ya snow road aur tyres ke beech friction ko reduce kar sakta hai. Isse tyre slip hone ka risk badhta hai aur vehicle control karna difficult ho 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");
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("result").innerHTML = `
<div class="result-summary">
<h3>π― ${escapeHTML(userName)}, Your Score: ${score} / ${questions.length}</h3>
<p>Correct Answers: ${score}</p>
<p>Incorrect or Unattempted: ${questions.length - score}</p>
<h3>${score >= 8 ? "Excellent Work! π" :
score >= 5 ? "Good Effort! π" :
"Keep Practising! π"}</h3>
</div>
`;
}
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>${escapeHTML(s.name)} - ${s.score}/10 (${escapeHTML(s.date)})</li>`
).join("");
}
function escapeHTML(value) {
return String(value).replace(/[&<>"']/g, char => ({
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'"
})[char]);
}
</script>
</body>
</html>