ch4 part1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Class 10 Science Quiz – Carbon and Its Compounds</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 – Carbon and Its Compounds</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. Carbon compounds humare liye important kyun hain?",
options: [
"A. Sirf metals banane ke liye",
"B. Food, clothes, medicines aur living structures mein carbon compounds important hain",
"C. Sirf glass banane ke liye",
"D. Sirf water purification ke liye"
],
correct: 1,
explanation: "Food, clothes, medicines, books aur bahut si daily-use things carbon compounds par based hoti hain. All living structures bhi largely carbon-based hote hain."
},
{
question: "2. Earth's crust mein carbon approximately kitne percentage present hai?",
options: [
"A. 0.02%",
"B. 2%",
"C. 20%",
"D. 0.2%"
],
correct: 0,
explanation: "Earth's crust mein approximately 0.02% carbon present hai. Ye carbonates, hydrogencarbonates, coal aur petroleum jaise forms mein milta hai."
},
{
question: "3. Carbon ka atomic number kya hai?",
options: [
"A. 4",
"B. 6",
"C. 8",
"D. 12"
],
correct: 1,
explanation: "Carbon ka atomic number 6 hai. Iska electronic configuration 2, 4 hota hai, yani carbon ke outermost shell mein 4 valence electrons hote hain."
},
{
question: "4. Carbon ionic compound banate waqt four electrons gain ya lose karne ke bajay kya karta hai?",
options: [
"A. Sirf protons share karta hai",
"B. Valence electrons ko other atoms ke saath share karta hai",
"C. Apne nucleus ko remove karta hai",
"D. Neutrons gain karta hai"
],
correct: 1,
explanation: "Carbon ke liye 4 electrons gain ya lose karna difficult hota hai. Isliye carbon valence electrons share karta hai aur covalent bonds form karta hai."
},
{
question: "5. Do hydrogen atoms H₂ molecule banate waqt kis type ka bond form karte hain?",
options: [
"A. Ionic bond",
"B. Double covalent bond",
"C. Single covalent bond",
"D. Triple covalent bond"
],
correct: 2,
explanation: "Har hydrogen atom ek electron share karta hai. Isse one shared pair of electrons banta hai, jise single covalent bond kehte hain."
},
{
question: "6. Oxygen molecule (O₂) mein kaunsa bond hota hai?",
options: [
"A. Single bond",
"B. Double bond",
"C. Triple bond",
"D. Ionic bond"
],
correct: 1,
explanation: "Oxygen ke outer shell mein 6 electrons hote hain aur octet complete karne ke liye 2 electrons ki need hoti hai. Dono oxygen atoms two pairs of electrons share karte hain, forming a double bond."
},
{
question: "7. Nitrogen molecule (N₂) mein kitne shared pairs of electrons hote hain?",
options: [
"A. One",
"B. Two",
"C. Three",
"D. Four"
],
correct: 2,
explanation: "Nitrogen ka atomic number 7 hai aur usse octet complete karne ke liye 3 electrons ki need hoti hai. Isliye two nitrogen atoms three pairs of electrons share karte hain, forming a triple bond."
},
{
question: "8. Carbon ki valency kya hai?",
options: [
"A. 1",
"B. 2",
"C. 3",
"D. 4"
],
correct: 3,
explanation: "Carbon ke outermost shell mein 4 valence electrons hote hain. Isliye carbon tetravalent hai aur generally four covalent bonds form kar sakta hai."
},
{
question: "9. Methane ka chemical formula kya hai?",
options: [
"A. CH₃",
"B. CH₄",
"C. C₂H₆",
"D. CO₂"
],
correct: 1,
explanation: "Methane mein one carbon atom aur four hydrogen atoms hote hain, isliye iska formula CH₄ hai. Carbon four hydrogen atoms ke saath four single covalent bonds form karta hai."
},
{
question: "10. Covalent compounds generally electricity ke poor conductors kyun hote hain?",
options: [
"A. Inmein charged ions form nahi hote",
"B. Inmein bahut saare free ions hote hain",
"C. Inmein only metals present hote hain",
"D. Inmein electrons completely destroy ho jaate hain"
],
correct: 0,
explanation: "Covalent compounds mein electrons atoms ke beech share hote hain aur charged ions generally form nahi hote. Isliye ye compounds generally poor conductors of electricity hote hain. Inmein intermolecular forces bhi relatively weak hoti hain, isliye inke melting aur boiling points generally low hote hain."
}
];
let currentQuestion = 0;
let score = 0;
let userAnswers = [];
let userName = "";
let quizSubmitted = false;
function startQuiz() {
userName = document.getElementById("userName").value.trim();
if (!userName) {
alert("Please enter your name.");
return;
}
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>
`;
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 saveAnswer() {
const selected = document.querySelector('input[name="option"]:checked');
userAnswers[currentQuestion] = selected ? parseInt(selected.value, 10) : null;
}
function nextQuestion() {
saveAnswer();
if (currentQuestion < questions.length - 1) {
currentQuestion++;
showQuestion();
}
}
function prevQuestion() {
saveAnswer();
if (currentQuestion > 0) {
currentQuestion--;
showQuestion();
}
}
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;">
<strong>Explanation:</strong> ${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: name,
score: 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}/${questions.length} (${s.date})</li>`
).join("");
}
</script>
</body>
</html>