ch1 part 1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chemical Reactions and Equations 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;
}
</style>
</head>
<body>
<div class="quiz-container">
<h2>🧠 Chemical Reactions and Equations – Science Quiz</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. Jab magnesium ribbon ko oxygen mein burn kiya jata hai, to kya product banta hai?",
options: [
"A. Magnesium chloride",
"B. Magnesium oxide",
"C. Magnesium sulphate",
"D. Magnesium carbonate"
],
correct: 1,
explanation: "Magnesium oxygen ke saath react karke magnesium oxide (MgO) banata hai. Ismein magnesium ribbon dazzling white flame ke saath burn hoti hai."
},
{
question: "2. Chemical reaction mein jin substances mein chemical change hota hai, unhe kya kaha jata hai?",
options: [
"A. Products",
"B. Reactants",
"C. Elements",
"D. Compounds"
],
correct: 1,
explanation: "Jo substances reaction mein participate karke chemical change undergo karte hain, unhe reactants kaha jata hai. Products reaction ke baad banne wale naye substances hote hain."
},
{
question: "3. Magnesium aur oxygen ki word-equation kya hogi?",
options: [
"A. Magnesium → Oxygen + Magnesium oxide",
"B. Oxygen + Magnesium oxide → Magnesium",
"C. Magnesium + Oxygen → Magnesium oxide",
"D. Magnesium oxide → Magnesium + Oxygen"
],
correct: 2,
explanation: "Word equation mein reactants left side par aur product right side par likha jata hai. Arrow reaction ki direction show karta hai."
},
{
question: "4. Chemical equation mein arrow (→) kya indicate karta hai?",
options: [
"A. Reactants ki quantity",
"B. Reaction ki direction",
"C. Temperature",
"D. Pressure"
],
correct: 1,
explanation: "Arrow reactants se products ki taraf reaction ki direction show karta hai."
},
{
question: "5. Magnesium + Oxygen → Magnesium oxide ko chemical formulae mein kaise likhenge?",
options: [
"A. Mg + O → MgO",
"B. Mg₂ + O₂ → Mg₂O",
"C. Mg + O₂ → MgO",
"D. MgO → Mg + O₂"
],
correct: 2,
explanation: "Magnesium ka formula Mg, oxygen ka O₂ aur magnesium oxide ka MgO hota hai. Ye equation abhi skeletal ya unbalanced equation hai."
},
{
question: "6. Agar LHS aur RHS par har element ke atoms ki number same ho, to equation ko kya kahenge?",
options: [
"A. Skeletal equation",
"B. Unbalanced equation",
"C. Balanced chemical equation",
"D. Word equation"
],
correct: 2,
explanation: "Balanced chemical equation mein har element ke atoms ki sankhya LHS aur RHS par equal hoti hai."
},
{
question: "7. Chemical equation ko balance karne ka main reason kya hai?",
options: [
"A. Law of conservation of mass ko follow karna",
"B. Reaction ko fast banana",
"C. Product ka colour change karna",
"D. Temperature increase karna"
],
correct: 0,
explanation: "Law of conservation of mass ke according mass neither created nor destroyed hota hai. Isliye reaction ke dono sides par har element ke atoms ki total number equal honi chahiye."
},
{
question: "8. Zn + H₂SO₄ → ZnSO₄ + H₂ equation mein hydrogen atoms kitne hain?",
options: [
"A. 1 on both sides",
"B. 2 on both sides",
"C. 4 on both sides",
"D. 3 on both sides"
],
correct: 1,
explanation: "H₂SO₄ mein 2 hydrogen atoms hain aur RHS par H₂ mein bhi 2 hydrogen atoms hain. Isliye hydrogen balanced hai."
},
{
question: "9. Zn + H₂SO₄ → ZnSO₄ + H₂ equation ke baare mein kaunsa statement correct hai?",
options: [
"A. Ye unbalanced hai",
"B. Sirf oxygen balanced hai",
"C. Har element ke atoms dono sides equal hain",
"D. Ismein koi product nahi hai"
],
correct: 2,
explanation: "Zn = 1, H = 2, S = 1 aur O = 4 dono sides par same hain. Therefore, equation balanced hai."
},
{
question: "10. Equation Fe + H₂O → Fe₃O₄ + H₂ ko balance karne par correct equation kya hogi?",
options: [
"A. Fe + H₂O → Fe₃O₄ + H₂",
"B. 3Fe + 4H₂O → Fe₃O₄ + 4H₂",
"C. 4Fe + 3H₂O → Fe₃O₄ + 3H₂",
"D. 3Fe + 3H₂O → Fe₃O₄ + 3H₂"
],
correct: 1,
explanation: "RHS mein Fe₃O₄ ke liye 3 Fe atoms aur 4 O atoms chahiye. Isliye LHS par 3Fe aur 4H₂O lenge. Ab hydrogen LHS par 8 hai, isliye RHS par 4H₂ hoga. Thus, equation balanced 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>