ch9part3
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>🧠 Light – Spherical Mirrors Quiz</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;
}
#userName {
padding: 10px;
width: 90%;
max-width: 350px;
border: 1px solid #ccc;
border-radius: 6px;
}
</style>
</head>
<body>
<div class="quiz-container">
<h2>🧠 Light – Spherical Mirrors Quiz | APICAL CLASSES</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. Spherical mirror ke ray diagram mein image locate karne ke liye generally kitni rays consider karna convenient hota hai?",
options: [
"A. Sirf 1 ray",
"B. 2 rays",
"C. 10 rays",
"D. Infinite rays"
],
correct: 1,
explanation: "✅ Correct Answer: B. 2 rays<br><br>Har point se infinite rays originate ho sakti hain, lekin ray diagram ko simple aur clear rakhne ke liye generally 2 rays consider ki jaati hain. In reflected rays ka intersection image ki position batata hai."
},
{
question: "2. Concave mirror par principal axis ke parallel incident ray reflection ke baad kahan se pass hoti hai?",
options: [
"A. Pole P",
"B. Centre of curvature C",
"C. Principal focus F",
"D. Mirror ke behind"
],
correct: 2,
explanation: "✅ Correct Answer: C. Principal focus F<br><br>Concave mirror par principal axis ke parallel ray reflection ke baad principal focus F se pass hoti hai."
},
{
question: "3. Convex mirror par principal axis ke parallel ray reflection ke baad kya hota hai?",
options: [
"A. F par actually meet karti hai",
"B. C par meet karti hai",
"C. Principal focus F se aati hui appear hoti hai",
"D. Same path par return karti hai"
],
correct: 2,
explanation: "✅ Correct Answer: C. Principal focus F se aati hui appear hoti hai<br><br>Convex mirror reflected rays ko diverge karta hai. Ye rays principal focus F se aati hui appear hoti hain."
},
{
question: "4. Concave mirror ke principal focus se pass hone wali ray reflection ke baad kya karti hai?",
options: [
"A. Principal axis ke parallel ho jaati hai",
"B. C se pass karti hai",
"C. Same path par return karti hai",
"D. Mirror ke behind chali jaati hai"
],
correct: 0,
explanation: "✅ Correct Answer: A. Principal axis ke parallel ho jaati hai<br><br>Concave mirror mein focus F se pass hone wali ray reflection ke baad principal axis ke parallel emerge karti hai."
},
{
question: "5. Convex mirror ki taraf principal focus ki direction mein directed ray reflection ke baad kya karti hai?",
options: [
"A. C se pass karti hai",
"B. Principal axis ke parallel emerge hoti hai",
"C. Same path par return karti hai",
"D. Pole par ruk jaati hai"
],
correct: 1,
explanation: "✅ Correct Answer: B. Principal axis ke parallel emerge hoti hai<br><br>Convex mirror ki taraf principal focus ki direction mein directed ray reflection ke baad principal axis ke parallel ho jaati hai."
},
{
question: "6. Concave mirror ke centre of curvature se pass hone wali ray reflection ke baad kya karti hai?",
options: [
"A. Focus se pass karti hai",
"B. Principal axis ke parallel ho jaati hai",
"C. Same path par wapas aati hai",
"D. Mirror ke behind chali jaati hai"
],
correct: 2,
explanation: "✅ Correct Answer: C. Same path par wapas aati hai<br><br>Centre of curvature par incident ray mirror ki surface par normal ke along fall karti hai. Isliye reflection ke baad ray usi path par return karti hai."
},
{
question: "7. Ray diagram mein image ki position determine karne ke liye reflected rays ka kya important role hai?",
options: [
"A. Unka colour determine karna",
"B. Unka intersection image ki position batata hai",
"C. Unki speed measure karna",
"D. Unka temperature measure karna"
],
correct: 1,
explanation: "✅ Correct Answer: B. Unka intersection image ki position batata hai<br><br>At least two reflected rays jahan intersect karti hain, wahi point image of the object point ki position ko locate karta hai."
},
{
question: "8. Mirror ke pole P par incident ray ke liye reflection mein kaunsa law follow hota hai?",
options: [
"A. Angle of incidence = Angle of reflection",
"B. Angle of incidence > Angle of reflection",
"C. Angle of incidence = 0 always",
"D. Reflection ka koi law nahi hota"
],
correct: 0,
explanation: "✅ Correct Answer: A. Angle of incidence = Angle of reflection<br><br>Pole P par bhi law of reflection apply hota hai. Incident ray aur reflected ray ke angles normal (principal axis) ke respect mein equal hote hain."
},
{
question: "9. Concave mirror mein principal axis ke parallel ray ko ray diagram mein use karne ka main advantage kya hai?",
options: [
"A. Uski reflected direction easily determine ki ja sakti hai",
"B. Woh mirror se pass nahi hoti",
"C. Woh hamesha same path par return karti hai",
"D. Woh light ko absorb karti hai"
],
correct: 0,
explanation: "✅ Correct Answer: A. Uski reflected direction easily determine ki ja sakti hai<br><br>Ray diagrams mein aisi rays choose ki jaati hain jinki reflected direction easily known ho. Parallel ray concave mirror se reflect hokar focus F se pass hoti hai."
},
{
question: "10. Agar do reflected rays ek point par intersect karti hain, to woh point kya represent karta hai?",
options: [
"A. Pole",
"B. Centre of curvature",
"C. Image of the object point",
"D. Aperture"
],
correct: 2,
explanation: "✅ Correct Answer: C. Image of the object point<br><br>Extended object ke har small portion ko point source maana ja sakta hai. Us point se aane wali rays ke reflected rays jahan intersect karti hain, wahi us point ki image position hoti hai."
}
];
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];
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>
<p>${score === 10 ? "Excellent! 🎉" :
score >= 7 ? "Very Good! 👏" :
score >= 5 ? "Good Attempt! 👍" :
"Keep Practicing! 💪"}</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>${s.name} - ${s.score}/10 (${s.date})</li>`
).join('');
}
</script>
</body>
</html>