ch4 part3
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>🧠 Science Quiz – Distance and Displacement | 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;
}
.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; }
.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;
}
.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; }
input[type="text"] {
padding: 10px;
width: 65%;
max-width: 300px;
border: 1px solid #ccc;
border-radius: 6px;
}
</style>
</head>
<body>
<div class="quiz-container">
<h2>🧠 APICAL CLASSES – SCIENCE QUIZ</h2>
<h3 style="text-align:center;">Topic: Distance and Displacement</h3>
<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. Straight-line motion mein total distance travelled aur displacement ka magnitude kab equal hota hai?",
options: [
"A. Jab object baar-baar direction change kare",
"B. Jab object bina turn back kiye ek hi direction mein move kare",
"C. Jab object starting point par wapas aa jaye",
"D. Jab object rest mein ho"
],
correct: 1,
explanation: "Agar object straight line mein sirf ek direction mein move karta hai aur turn back nahi karta, toh distance aur displacement ka magnitude equal hota hai."
},
{
question: "2. Ek ball O se vertically upward throw ki jaati hai. Woh A par 40 cm aur B par 80 cm height tak pahunchti hai. O se B tak ball ki total distance aur displacement ka magnitude kya hoga?",
options: [
"A. Distance 80 cm, displacement 80 cm",
"B. Distance 40 cm, displacement 80 cm",
"C. Distance 80 cm, displacement 40 cm",
"D. Distance 160 cm, displacement 80 cm"
],
correct: 0,
explanation: "O se B tak ball sirf upward direction mein gayi hai. Isliye total distance = 80 cm aur displacement ka magnitude = 80 cm upward."
},
{
question: "3. Ball O se 120 cm upward jaakar B point tak pahunchti hai aur phir 40 cm neeche C point par aati hai. O se C tak total distance aur displacement ka magnitude kya hoga?",
options: [
"A. 80 cm, 160 cm",
"B. 160 cm, 80 cm",
"C. 120 cm, 40 cm",
"D. 40 cm, 120 cm"
],
correct: 1,
explanation: "Total distance = 120 + 40 = 160 cm. Final position C, O se 80 cm upar hai, isliye displacement = 80 cm upward."
},
{
question: "4. Ek ball O se 140 cm upward jaakar phir same straight line mein wapas O par aa jaati hai. Ball ke complete motion ke liye displacement kya hoga?",
options: [
"A. 140 cm upward",
"B. 280 cm",
"C. 140 cm downward",
"D. 0 cm"
],
correct: 3,
explanation: "Ball ka initial aur final position same O hai. Isliye net change in position, yani displacement, zero hai."
},
{
question: "5. Usi motion mein, jisme ball O se 140 cm upward jaakar wapas O par aati hai, total distance travelled kitni hogi?",
options: [
"A. 0 cm",
"B. 140 cm",
"C. 280 cm",
"D. 70 cm"
],
correct: 2,
explanation: "Upward distance = 140 cm aur downward distance = 140 cm. Total distance = 140 + 140 = 280 cm."
},
{
question: "6. Ball O se upward move karke B tak jaati hai aur phir C tak neeche aati hai. Inmein se displacement ke baare mein kaunsa statement correct hai?",
options: [
"A. Displacement ka magnitude total distance se greater ho sakta hai",
"B. Displacement ka magnitude total distance ke equal ya less hota hai",
"C. Displacement hamesha total distance se greater hota hai",
"D. Displacement hamesha zero hota hai"
],
correct: 1,
explanation: "Displacement ka magnitude total distance se kabhi greater nahi ho sakta. Yeh distance ke equal ya usse less ho sakta hai."
},
{
question: "7. Athlete straight track par O se B tak jaati hai aur phir wapas O par aa jaati hai. Kis situation mein uska displacement zero hoga?",
options: [
"A. Jab woh B par rukegi",
"B. Jab woh O par wapas aayegi",
"C. Jab woh halfway point par hogi",
"D. Jab woh maximum speed se chalegi"
],
correct: 1,
explanation: "Displacement initial aur final position ke beech net change hai. Final position agar starting point O ho, toh displacement zero hoga."
},
{
question: "8. Vehicle ke fuel consumption ka relation mainly kis quantity se hota hai?",
options: [
"A. Displacement",
"B. Total distance travelled",
"C. Direction only",
"D. Initial position"
],
correct: 1,
explanation: "Vehicle ko fuel consume karke actual path par travel karna padta hai. Isliye fuel consumption ka relation total distance travelled se hota hai, displacement se nahi."
},
{
question: "9. Ek ball inclined track par O se A, B, C aur D ki taraf roll karti hai. Agar ball continuously ek hi direction mein inclined straight path par move kar rahi hai, toh O se kisi bhi intermediate point tak distance aur displacement ke magnitude mein kya relation hoga?",
options: [
"A. Distance हमेशा displacement se greater hogi",
"B. Displacement हमेशा zero hoga",
"C. Distance aur displacement ka magnitude equal hoga",
"D. Displacement distance se greater hoga"
],
correct: 2,
explanation: "Ball bina turn back kiye ek hi direction mein straight path par move kar rahi hai. Isliye distance aur displacement ka magnitude equal hoga."
},
{
question: "10. Ek ball O se 100 cm upward jaati hai aur phir 60 cm downward move karti hai. Is motion se kaunsa conclusion correct hai?",
options: [
"A. Total distance = 40 cm aur displacement = 160 cm",
"B. Total distance = 160 cm aur displacement = 40 cm upward",
"C. Total distance = 40 cm aur displacement = 40 cm downward",
"D. Total distance = 100 cm aur displacement = 60 cm upward"
],
correct: 1,
explanation: "Total distance = 100 + 60 = 160 cm. Final position O se 40 cm upar hai, isliye displacement = 40 cm upward."
}
];
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];
let optsHTML = q.options.map((opt, i) => {
let cls = "";
if (i === q.correct) cls = "correct";
if (selected === i && selected !== q.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 = `
<h3>Your Score: ${score} / ${questions.length}</h3>
<p>Percentage: ${((score / questions.length) * 100).toFixed(1)}%</p>
`;
}
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>${escapeHTML(s.name)} - ${s.score}/${questions.length} (${escapeHTML(s.date)})</li>`
).join("");
}
function escapeHTML(value) {
return String(value).replace(/[&<>"']/g, char => ({
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'"
})[char]);
}
</script>
</body>
</html>