ch4 part16
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Motion and Kinematic Equations 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;
}
.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: 10px;
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: 10px;
margin-bottom: 15px;
border-left: 5px solid #2a5298;
border-radius: 5px;
line-height: 1.6;
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; }
#userName {
padding: 10px;
width: 90%;
max-width: 350px;
border: 1px solid #aaa;
border-radius: 6px;
}
#result { text-align: center; margin-top: 20px; }
@media(max-width:600px) {
body { padding: 10px; }
.quiz-container { width: 100%; padding: 15px; }
}
</style>
</head>
<body>
<div class="quiz-container">
<h2>đ§ Motion and Kinematic Equations Quiz</h2>
<h3 style="text-align:center;color:#2a5298;">APICAL CLASSES</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"></div>
<div id="scoreboard">
<h3>đ Scoreboard</h3>
<ol id="scoreList"></ol>
</div>
</div>
</div>
<script>
const questions = [
{
question: "1. Kisi object ki position ko describe karne ke liye reference point ke respect mein kin quantities ki zaroorat hoti hai?",
options: [
"A. Sirf time",
"B. Distance aur direction",
"C. Mass aur volume",
"D. Speed aur acceleration"
],
correct: 1,
explanation: "Reference point se object ki distance aur direction uski position ko describe karti hai."
},
{
question: "2. Agar kisi object ki position reference point ke respect mein time ke saath change hoti hai, toh object ko kya kaha jaata hai?",
options: [
"A. Rest mein",
"B. Stationary",
"C. Motion mein",
"D. Balanced"
],
correct: 2,
explanation: "Position agar time ke saath change ho rahi hai, toh object motion mein hai."
},
{
question: "3. Displacement kya represent karta hai?",
options: [
"A. Total distance travelled",
"B. Net change in position between two instants",
"C. Total time taken",
"D. Change in speed only"
],
correct: 1,
explanation: "Displacement object ki initial aur final position ke beech net change hota hai."
},
{
question: "4. Ek object 150 m distance 30 s mein travel karta hai. Uski average speed kya hogi?",
options: [
"A. 3 m/s",
"B. 5 m/s",
"C. 10 m/s",
"D. 15 m/s"
],
correct: 1,
explanation: "Average speed = total distance / time = 150/30 = 5 m/s."
},
{
question: "5. Average velocity calculate karne ke liye kaunsi quantity use hoti hai?",
options: [
"A. Total distance",
"B. Displacement",
"C. Mass",
"D. Volume"
],
correct: 1,
explanation: "Average velocity = displacement / time interval."
},
{
question: "6. Ek object ki velocity 10 m/s se 20 m/s ho jaati hai 5 s mein. Uski average acceleration kya hogi?",
options: [
"A. 1 m/s²",
"B. 2 m/s²",
"C. 5 m/s²",
"D. 10 m/s²"
],
correct: 1,
explanation: "Average acceleration = (v â u)/t = (20 â 10)/5 = 2 m/s²."
},
{
question: "7. Ek object straight line mein constant acceleration ke saath move kar raha hai. Agar u = 5 m/s, a = 2 m/s² aur t = 4 s hai, toh final velocity kya hogi?",
options: [
"A. 7 m/s",
"B. 9 m/s",
"C. 13 m/s",
"D. 15 m/s"
],
correct: 2,
explanation: "v = u + at = 5 + (2 Ă 4) = 13 m/s."
},
{
question: "8. Ek object ki initial velocity 4 m/s, acceleration 2 m/s² aur time 3 s hai. Uska displacement kitna hoga?",
options: [
"A. 12 m",
"B. 15 m",
"C. 18 m",
"D. 21 m"
],
correct: 3,
explanation: "s = ut + ½at² = (4 à 3) + ½ à 2 à 3² = 12 + 9 = 21 m."
},
{
question: "9. Kinematic equation v² = u² + 2as mein agar u = 0, a = 4 m/s² aur s = 8 m ho, toh final velocity kya hogi?",
options: [
"A. 4 m/s",
"B. 6 m/s",
"C. 8 m/s",
"D. 16 m/s"
],
correct: 2,
explanation: "v² = 0² + 2 à 4 à 8 = 64, therefore v = 8 m/s."
},
{
question: "10. Jab koi object circular path par constant speed se move karta hai, toh uski motion ko kya kaha jaata hai?",
options: [
"A. Uniform linear motion",
"B. Non-uniform linear motion",
"C. Uniform circular motion",
"D. Random motion"
],
correct: 2,
explanation: "Circular path par constant (uniform) speed se hone wali motion ko uniform circular motion kehte hain."
}
];
let currentQuestion = 0;
let score = 0;
let userAnswers = [];
let userName = "";
let submitted = 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 = `
<p style="text-align:right;color:#555;">
Question ${currentQuestion + 1} of ${questions.length}
</p>
<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 (submitted) return;
saveAnswer();
score = 0;
questions.forEach((q, index) => {
if (userAnswers[index] === q.correct) {
score++;
}
});
submitted = 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>Correct Answer:</strong> ${q.options[q.correct]}<br>
<strong>Explanation:</strong> ${q.explanation}
</div>
<hr>
`;
});
document.querySelector(".controls").style.display = "none";
document.getElementById("result").innerHTML = `
<h3>Congratulations, ${escapeHTML(userName)}!</h3>
<h2>Your Score: ${score} / ${questions.length}</h2>
<p>
${score >= 8
? "Excellent Work!"
: score >= 5
? "Good Effort! Keep Practising."
: "Keep Learning and Try Again!"}
</p>
`;
}
function escapeHTML(str) {
return str.replace(/[&<>"']/g, char => ({
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'"
})[char]);
}
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(String(s.name))} - ${s.score}/10 (${escapeHTML(String(s.date))})</li>`
).join("");
}
</script>
</body>
</html>