ch9part5
<!DOCTYPE html>
<html lang="en">
<head>
<title>🧠Law of Constant Proportions – 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>🧠Law of Constant Proportions – 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. Law of Constant Proportions kis scientist ne propose kiya tha?",
options: [
"A. Antoine Lavoisier",
"B. Joseph Proust",
"C. John Dalton",
"D. Ernest Rutherford"
],
correct: 1,
explanation: "<b>Joseph Proust</b> ne propose kiya ki kisi pure compound mein elements hamesha <b>fixed ratio by mass</b> mein present hote hain."
},
{
question: "2. Law of Constant Proportions ke according kisi compound mein elements ka ratio kis basis par fixed hota hai?",
options: [
"A. Volume",
"B. Colour",
"C. Mass",
"D. Temperature"
],
correct: 2,
explanation: "Is law ke according compound mein present elements <b>fixed ratio by mass</b> mein combine karte hain. Source ya preparation method change hone par bhi ratio same rehta hai."
},
{
question: "3. Different sources—river, borewell aur ocean—se purified water liya gaya. Har sample mein hydrogen aur oxygen ka mass ratio kya milega?",
options: [
"A. 1 : 4",
"B. 1 : 6",
"C. 1 : 8",
"D. 2 : 8"
],
correct: 2,
explanation: "Pure water mein hydrogen : oxygen ka mass ratio <b>1 : 8</b> hota hai, chahe water kisi bhi source se liya gaya ho."
},
{
question: "4. Agar <b>9 g purified water</b> ko decompose kiya jaye, toh approximately kitna hydrogen aur oxygen obtain hoga?",
options: [
"A. 4 g hydrogen, 5 g oxygen",
"B. 1 g hydrogen, 8 g oxygen",
"C. 2 g hydrogen, 7 g oxygen",
"D. 3 g hydrogen, 6 g oxygen"
],
correct: 1,
explanation: "Water mein H : O ka fixed mass ratio <b>1 : 8</b> hai. Total 9 parts mein se 1 part hydrogen aur 8 parts oxygen hoga. Therefore, <b>1 g H + 8 g O</b>."
},
{
question: "5. Water ka sample river se liya gaya aur doosra sample ocean se. Dono purified samples mein hydrogen aur oxygen ka mass ratio same kyun rahega?",
options: [
"A. Water ka colour same hota hai",
"B. Law of Constant Proportions ke according pure compound mein elements fixed mass ratio mein hote hain",
"C. Ocean water hamesha river water se lighter hota hai",
"D. Hydrogen aur oxygen ka mass equal hota hai"
],
correct: 1,
explanation: "Compound ka source change hone se uske elements ka <b>fixed mass ratio</b> change nahi hota. Isliye purified water mein ratio 1:8 hi rahega."
},
{
question: "6. Cinnabar ko heat karne par mercury aur sulfur approximately kitne mass percentages mein obtain hote hain?",
options: [
"A. Mercury 50%, Sulfur 50%",
"B. Mercury 75%, Sulfur 25%",
"C. Mercury 86.22%, Sulfur 13.78%",
"D. Mercury 13.78%, Sulfur 86.22%"
],
correct: 2,
explanation: "Cinnabar mein mercury approximately <b>86.22%</b> aur sulfur approximately <b>13.78%</b> by mass hota hai. Dono percentages ka total 100% hota hai."
},
{
question: "7. Cinnabar banane ke liye mercury aur sulfur ko approximately kis proportion mein combine kiya ja sakta hai?",
options: [
"A. Mercury 86.22% aur sulfur 13.78%",
"B. Mercury 13.78% aur sulfur 86.22%",
"C. Mercury 50% aur sulfur 50%",
"D. Mercury 25% aur sulfur 75%"
],
correct: 0,
explanation: "Cinnabar mein mercury aur sulfur ka composition approximately <b>86.22% : 13.78%</b> by mass hota hai. Ye fixed composition Law of Constant Proportions ko illustrate karta hai."
},
{
question: "8. Joseph Louis Proust ne copper carbonate ke study se kya demonstrate kiya?",
options: [
"A. Copper carbonate ka composition preparation aur source ke according change hota hai",
"B. Copper carbonate mein copper, carbon aur oxygen fixed proportion by mass mein hote hain",
"C. Copper carbonate mein sirf copper present hota hai",
"D. Copper carbonate ek element hai"
],
correct: 1,
explanation: "Proust ne show kiya ki <b>copper carbonate</b> mein copper, carbon aur oxygen ka mass composition fixed rehta hai, chahe compound ko kahin bhi ya kisi bhi method se prepare kiya gaya ho."
},
{
question: "9. Law of Constant Proportions ko aur kis naam se jaana jaata hai?",
options: [
"A. Law of Definite Proportions",
"B. Law of Conservation of Energy",
"C. Law of Multiple Volumes",
"D. Law of Gravitation"
],
correct: 0,
explanation: "<b>Law of Constant Proportions</b> ko <b>Law of Definite Proportions</b> aur <b>Proust’s Law</b> bhi kaha jaata hai."
},
{
question: "10. Ek pure compound ke do samples ka mass alag-alag hai, lekin dono samples mein elements ka mass ratio same hai. Ye observation kis law ko support karti hai?",
options: [
"A. Law of Conservation of Mass",
"B. Law of Constant Proportions",
"C. Newton’s Law",
"D. Law of Reflection"
],
correct: 1,
explanation: "Sample ka total mass change ho sakta hai, lekin <b>same pure compound</b> mein constituent elements ka mass ratio fixed rehta hai. Isi principle ko Law of Constant Proportions kehte hain."
}
];
let currentQuestion = 0;
let score = 0;
let userAnswers = [];
let userName = "";
let quizSubmitted = false;
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() {
if (quizSubmitted) return;
saveAnswer();
score = 0;
questions.forEach((q, index) => {
if (userAnswers[index] === q.correct) score++;
});
quizSubmitted = 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;">${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>