ch10 part2
<!DOCTYPE html>
<html lang="en">
<head>
<title>Class 10 Science Quiz โ Light and Mirrors</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; }
</style>
</head>
<body>
<div class="quiz-container">
<h2>๐ง Class 10 Science Quiz โ Light and Mirrors</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. Concave aur convex mirror ko side se dekhkar kaise identify kar sakte hain?",
options: [
"A. Mirror ka colour dekhkar",
"B. Reflecting surface andar ya bahar curved hai, yeh dekhkar",
"C. Mirror ka weight dekhkar",
"D. Mirror ki length dekhkar"
],
correct: 1,
explanation: "Concave mirror ki reflecting surface andar ki taraf curved hoti hai, jabki convex mirror ki reflecting surface bahar ki taraf ubhri hoti hai.<br><br>Example: Steel spoon ki inner surface concave aur outer surface convex mirror ki tarah behave karti hai."
},
{
question: "2. Jab object concave mirror ke bahut paas rakha jaata hai, toh image kaisi ban sakti hai?",
options: [
"A. Erect aur enlarged",
"B. Inverted aur hamesha chhoti",
"C. Hamesha invisible",
"D. Hamesha same size"
],
correct: 0,
explanation: "Jab object concave mirror ke paas, yani pole aur focus ke beech hota hai, toh uski image seedhi (erect), virtual aur object se badi (enlarged) banti hai.<br><br>Example: Dentist paas se daanton ko bada dekhne ke liye concave mirror ka use karta hai."
},
{
question: "3. Convex mirror mein image ki nature kaisi hoti hai?",
options: [
"A. Hamesha inverted aur enlarged",
"B. Hamesha erect aur diminished",
"C. Hamesha same size",
"D. Kabhi image nahi banti"
],
correct: 1,
explanation: "Convex mirror hamesha virtual, erect aur diminished yani chhoti image banata hai.<br><br>Example: Car ke side-view mirror mein peeche aane wali gaadiyan seedhi aur chhoti dikhai deti hain."
},
{
question: "4. Jab kisi object ko concave mirror se door le jaate hain, toh image mein kya change aa sakta hai?",
options: [
"A. Image hamesha erect hi rehti hai",
"B. Image inverted ho sakti hai aur uska size badal sakta hai",
"C. Image hamesha same size ki rehti hai",
"D. Image ka colour badal jaata hai"
],
correct: 1,
explanation: "Concave mirror mein image object ki position par depend karti hai. Object ko focus se aage le jaane par image inverted ho sakti hai aur uska size bhi change hota hai.<br><br>Example: Concave mirror mein paas rakha face bada aur seedha dikh sakta hai, lekin distance badhane par image ulเคเฅ ho sakti hai."
},
{
question: "5. Plane mirror mein object ki image aam taur par kaisi hoti hai?",
options: [
"A. Erect aur object ke same size ki",
"B. Inverted aur chhoti",
"C. Erect aur bahut badi",
"D. Hamesha invisible"
],
correct: 0,
explanation: "Plane mirror mein image seedhi aur object ke barabar size ki hoti hai. Ismein lateral inversion bhi hota hai.<br><br>Example: Bathroom ke flat mirror mein apna face dekhne par image seedhi aur lagbhag same size ki dikhti hai."
},
{
question: "6. Lateral inversion ka kya meaning hai?",
options: [
"A. Image ka bada ho jaana",
"B. Image ka chhota ho jaana",
"C. Image mein left aur right ka interchange dikhna",
"D. Image ka ulta ho jaana vertically"
],
correct: 2,
explanation: "Lateral inversion mein image ka left side right side jaisa aur right side left side jaisa dikhai deta hai.<br><br>Example: Plane mirror ke saamne apna right hand uthao. Image mein aisa lagega jaise saamne wala vyakti apna left hand utha raha hai."
},
{
question: "7. Torch aur car headlights ke reflectors mein kaunsa mirror use hota hai?",
options: [
"A. Plane mirror",
"B. Concave mirror",
"C. Convex mirror",
"D. Koi mirror nahi"
],
correct: 1,
explanation: "Concave mirror ka use torch aur headlights mein reflector ke roop mein hota hai. Suitable position par light source rakhne se reflected light ki rays ek direction mein bheji ja sakti hain.<br><br>Example: Car ki headlight ka reflector light ko road ki taraf bhejne mein help karta hai."
},
{
question: "8. Vehicles ke side-view mirrors mein convex mirror kyun use hota hai?",
options: [
"A. Yeh objects ko bada dikhata hai",
"B. Yeh sirf paas ki cheezein dikhata hai",
"C. Yeh wide area ka erect aur chhota image dikhata hai",
"D. Yeh light ko absorb karta hai"
],
correct: 2,
explanation: "Convex mirror ka field of view wide hota hai. Isliye driver peeche ke road aur traffic ka zyada area dekh sakta hai.<br><br>Example: Car ka side-view mirror driver ko peeche se aane wali kai gaadiyon ko dekhne mein help karta hai."
},
{
question: "9. Road intersections aur sharp bends par convex mirrors kyun lagaye jaate hain?",
options: [
"A. Road ko bright banane ke liye",
"B. Doosri taraf se aane wale vehicles ko dekhne aur collisions se bachne ke liye",
"C. Vehicles ki speed badhane ke liye",
"D. Road ka temperature kam karne ke liye"
],
correct: 1,
explanation: "Convex mirror wide area ka view deta hai. Isse drivers blind turns par doosri taraf se aane wale vehicles ko dekh sakte hain.<br><br>Example: Pahadi road ke sharp bend par laga convex mirror saamne se aane wali car ko dekhne mein help karta hai."
},
{
question: "10. Big stores mein convex mirrors kyun lagaye jaate hain?",
options: [
"A. Products ko bada dikhane ke liye",
"B. Store ke bade area par nazar rakhne ke liye",
"C. Light ko produce karne ke liye",
"D. Products ka weight measure karne ke liye"
],
correct: 1,
explanation: "Convex mirror ek wide area ka view deta hai. Isliye shopkeepers store ke kai sections ko monitor kar sakte hain aur theft ko rokne mein help milti hai.<br><br>Example: Supermarket ke ceiling corner par laga convex mirror staff ko aisles mein customers ki movement dekhne mein help karta hai."
}
];
let currentQuestion = 0;
let score = 0;
let userAnswers = [];
let userName = "";
function startQuiz() {
userName = document.getElementById("userName").value.trim();
if (!userName) return alert("Please enter your name.");
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>`;
}
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>