ch1 part 6
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Science Quiz – Chemical Reactions and Equations</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; 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; }
.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; }
#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>🧠 Science Quiz – Chemical Reactions and Equations</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. Reaction 2PbO + C → 2Pb + CO₂ mein kaunsa statement incorrect hai?",
options: [
"A. Lead oxide is getting reduced",
"B. Carbon is getting oxidised",
"C. Lead is getting reduced",
"D. Carbon dioxide is getting oxidised"
],
correct: 3,
explanation: "Is reaction mein PbO oxygen lose karke Pb banata hai, isliye PbO reduced hota hai. Carbon oxygen gain karke CO₂ banata hai, isliye carbon oxidised hota hai. CO₂ oxidised nahi ho raha, balki product hai."
},
{
question: "2. Reaction Fe₂O₃ + 2Al → Al₂O₃ + 2Fe kis type ki reaction hai?",
options: [
"A. Combination reaction",
"B. Decomposition reaction",
"C. Displacement reaction",
"D. Double displacement reaction"
],
correct: 2,
explanation: "Is reaction mein aluminium, iron ko Fe₂O₃ se displace karta hai aur Al₂O₃ aur Fe form hote hain. Isliye ye displacement reaction hai."
},
{
question: "3. Jab dilute hydrochloric acid ko iron filings ke saath react karaya jata hai, to kya products bante hain?",
options: [
"A. Hydrogen gas and iron chloride",
"B. Chlorine gas and iron hydroxide",
"C. No reaction",
"D. Iron salt and water"
],
correct: 0,
explanation: "Iron dilute HCl ke saath react karta hai: Fe + 2HCl → FeCl₂ + H₂. Is reaction mein iron chloride aur hydrogen gas produce hote hain."
},
{
question: "4. Chemical equation ko balance karna kyun necessary hai?",
options: [
"A. Reaction ko fast karne ke liye",
"B. Law of conservation of mass ko follow karne ke liye",
"C. Product ka colour change karne ke liye",
"D. Temperature increase karne ke liye"
],
correct: 1,
explanation: "Chemical reaction mein atoms create ya destroy nahi hote. Isliye reactants aur products dono sides par har element ke atoms ki number equal honi chahiye. Isi ko ensure karne ke liye equation ko balance kiya jata hai."
},
{
question: "5. Hydrogen gas nitrogen ke saath react karke ammonia banati hai. Iski balanced chemical equation kya hogi?",
options: [
"A. H₂ + N₂ → NH₃",
"B. N₂ + 3H₂ → 2NH₃",
"C. 2N₂ + H₂ → 2NH₃",
"D. N₂ + H₂ → 2NH₃"
],
correct: 1,
explanation: "LHS par N₂ mein 2 nitrogen atoms hain, isliye RHS par 2NH₃ lenge. Ab RHS mein hydrogen = 6, isliye LHS par 3H₂ chahiye. Balanced equation hai: N₂ + 3H₂ → 2NH₃."
},
{
question: "6. Equation HNO₃ + Ca(OH)₂ → Ca(NO₃)₂ + H₂O ko balance karne par correct equation kya hogi?",
options: [
"A. HNO₃ + Ca(OH)₂ → Ca(NO₃)₂ + H₂O",
"B. 2HNO₃ + Ca(OH)₂ → Ca(NO₃)₂ + 2H₂O",
"C. HNO₃ + 2Ca(OH)₂ → Ca(NO₃)₂ + H₂O",
"D. 2HNO₃ + 2Ca(OH)₂ → Ca(NO₃)₂ + H₂O"
],
correct: 1,
explanation: "Ca(NO₃)₂ mein 2 nitrate groups hain, isliye LHS par 2HNO₃ chahiye. Iske baad hydrogen aur oxygen ko balance karne ke liye 2H₂O lagta hai. Balanced equation: 2HNO₃ + Ca(OH)₂ → Ca(NO₃)₂ + 2H₂O."
},
{
question: "7. ZnCO₃(s) → ZnO(s) + CO₂(g) kis type ki reaction hai?",
options: [
"A. Combination reaction",
"B. Displacement reaction",
"C. Decomposition reaction",
"D. Double displacement reaction"
],
correct: 2,
explanation: "Yahan ek single compound ZnCO₃ break hokar do simpler substances ZnO aur CO₂ banata hai. Isliye ye decomposition reaction hai."
},
{
question: "8. H₂(g) + Cl₂(g) → 2HCl(g) kis type ki reaction hai?",
options: [
"A. Combination reaction",
"B. Decomposition reaction",
"C. Displacement reaction",
"D. Precipitation reaction"
],
correct: 0,
explanation: "Yahan hydrogen aur chlorine, do reactants, combine hokar ek single product HCl banate hain. Isliye ye combination reaction hai."
},
{
question: "9. Exothermic reaction ka correct meaning kya hai?",
options: [
"A. Jisme energy absorb hoti hai",
"B. Jisme heat/energy release hoti hai",
"C. Jisme sirf gas produce hoti hai",
"D. Jisme koi energy change nahi hota"
],
correct: 1,
explanation: "Jis reaction mein heat release hoti hai, use exothermic reaction kehte hain. Respiration iska important example hai, kyunki glucose oxygen ke saath react karke energy release karta hai."
},
{
question: "10. Decomposition reactions ko combination reactions ka opposite kyun kaha jata hai?",
options: [
"A. Combination mein one product break hota hai",
"B. Decomposition mein two or more substances combine hote hain",
"C. Combination mein two or more substances se single product banta hai, jabki decomposition mein single substance se two or more products bante hain",
"D. Dono reactions exactly same hoti hain"
],
correct: 2,
explanation: "Combination reaction: Two or more reactants → single product. Example: CaO + H₂O → Ca(OH)₂.<br><br>Decomposition reaction: Single reactant → two or more products. Example: CaCO₃ → CaO + CO₂.<br><br>Isliye dono reactions ko ek doosre ka opposite kaha jata 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>