ch9part6
<!DOCTYPE html>
<html lang="en">
<head>
<title>🧠 Law of Constant Proportions – MCQ Quiz</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<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: 65%;
max-width: 300px;
border: 1px solid #ccc;
border-radius: 6px;
}
</style>
</head>
<body>
<div class="quiz-container">
<h2>🧠 Law of Constant Proportions – MCQ 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. Sodium chloride (NaCl) mein sodium aur chlorine ka mass ratio <b>23 : 35.5</b> hai. Agar <b>46 g sodium</b> completely react kare, toh kitna chlorine required hoga?",
options: [
"A. 35.5 g",
"B. 46 g",
"C. 71 g",
"D. 92 g"
],
correct: 2,
explanation: "23 g sodium ke liye 35.5 g chlorine required hai. 46 g sodium = 2 × 23 g, so chlorine = 2 × 35.5 = <b>71 g</b>. Baaki values given ratio satisfy nahi karti."
},
{
question: "2. Ek compound mein sulfur <b>40%</b> aur oxygen <b>60%</b> by mass hai. Agar sample mein <b>20 g sulfur</b> hai, toh oxygen ka mass kitna hoga?",
options: [
"A. 20 g",
"B. 30 g",
"C. 40 g",
"D. 60 g"
],
correct: 1,
explanation: "Sulfur : Oxygen = 40 : 60 = 2 : 3. Agar sulfur 20 g hai, toh oxygen = 20 × 60 ÷ 40 = <b>30 g</b>."
},
{
question: "3. Carbon monoxide (CO) mein carbon aur oxygen ka mass ratio <b>3 : 4</b> hai. Agar <b>9 g carbon</b> completely react kare, toh kitna oxygen required hoga?",
options: [
"A. 6 g",
"B. 9 g",
"C. 12 g",
"D. 15 g"
],
correct: 2,
explanation: "3 g carbon ke liye 4 g oxygen required hai. 9 g carbon = 3 × 3 g, so oxygen = 3 × 4 = <b>12 g</b>."
},
{
question: "4. Law of Definite Proportions <b>compounds</b> par apply hota hai, lekin mixtures par nahi. Iska main reason kya hai?",
options: [
"A. Mixture mein substances hamesha fixed mass ratio mein present hote hain",
"B. Compound mein elements fixed ratio mein chemically combined hote hain, while mixture mein components variable ratio mein ho sakte hain",
"C. Mixture mein koi mass nahi hota",
"D. Compound mein elements ka mass zero hota hai"
],
correct: 1,
explanation: "Pure compound ki composition <b>fixed</b> hoti hai. Mixture mein components ko different quantities mein mix kiya ja sakta hai, isliye unka ratio fixed nahi hota."
},
{
question: "5. Student X ne copper aur oxygen ko <b>4 : 1</b> mass ratio mein combine karke copper oxide banaya. Student Y ne same oxide ke liye ratio <b>8 : 2</b> obtain kiya. Kya ye results Law of Constant Proportions ko justify karte hain?",
options: [
"A. Nahi, kyunki ratios completely different hain",
"B. Haan, kyunki 4 : 1 aur 8 : 2 equivalent ratios hain",
"C. Nahi, kyunki oxygen ka mass same hona chahiye",
"D. Haan, kyunki koi bhi ratio valid hota hai"
],
correct: 1,
explanation: "8 : 2 ko 2 se divide karne par <b>4 : 1</b> milta hai. Dono same mass proportion represent karte hain, so results law ko support karte hain."
},
{
question: "6. 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 Proportions",
"D. Law of Gravitation"
],
correct: 0,
explanation: "Law of Constant Proportions ko <b>Law of Definite Proportions</b> ya <b>Proust’s Law</b> bhi kaha jaata hai."
},
{
question: "7. Joseph Louis Proust ne copper carbonate ke study se kya establish kiya?",
options: [
"A. Copper carbonate ka composition har sample mein random hota hai",
"B. Copper carbonate mein elements fixed proportion by mass mein present hote hain",
"C. Copper carbonate sirf copper se bana hai",
"D. Copper carbonate ek mixture hai"
],
correct: 1,
explanation: "Proust ne demonstrate kiya ki copper carbonate mein <b>copper, carbon aur oxygen</b> definite/fixed mass proportion mein hote hain, chahe compound kahin se bhi obtain kiya gaya ho."
},
{
question: "8. Agar pure water ke ek sample mein <b>1 g hydrogen aur 8 g oxygen</b> hai, toh kisi doosre source se liye gaye <b>18 g pure water</b> mein hydrogen aur oxygen ka mass kitna hoga?",
options: [
"A. 2 g H aur 16 g O",
"B. 4 g H aur 14 g O",
"C. 8 g H aur 10 g O",
"D. 1 g H aur 17 g O"
],
correct: 0,
explanation: "Water mein H : O = <b>1 : 8</b>. 18 g water mein total 9 parts hain, so hydrogen = 2 g aur oxygen = <b>16 g</b>. Ratio same rehta hai."
},
{
question: "9. Cinnabar mein mercury approximately <b>86.22%</b> aur sulfur <b>13.78%</b> by mass hota hai. Agar cinnabar ka sample <b>100 g</b> ho, toh mercury aur sulfur ke masses kya honge?",
options: [
"A. 86.22 g mercury, 13.78 g sulfur",
"B. 13.78 g mercury, 86.22 g sulfur",
"C. 50 g mercury, 50 g sulfur",
"D. 80 g mercury, 20 g sulfur"
],
correct: 0,
explanation: "100 g sample mein percentage directly mass ko represent karti hai. Isliye mercury = <b>86.22 g</b> aur sulfur = <b>13.78 g</b>."
},
{
question: "10. Dalton ki Atomic Theory ke development mein Law of Conservation of Mass aur Law of Constant Proportions ka kya importance tha?",
options: [
"A. In laws ne explain kiya ki atoms chemical reactions mein create hote hain",
"B. In laws ne substances ke fixed proportions aur mass conservation ko explain karne ke liye atomic theory ka foundation diya",
"C. In laws ne prove kiya ki mixtures ki composition fixed hoti hai",
"D. In laws ne electrons ki discovery ki"
],
correct: 1,
explanation: "Dono laws ne Dalton ko ye explain karne mein help kiya ki substances <b>fixed proportions</b> mein combine karte hain aur chemical reaction mein mass ka loss ya gain nahi hota."
}
];
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>${userName}, 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>