ch4 part2
<!DOCTYPE html>
<html lang="en">
<head>
<title>🧠 Allotropes of Carbon – Practice 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>🧠 Allotropes of Carbon – Practice 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. Carbon ke different forms ko kya kaha jata hai?",
options: [
"A. Isotopes",
"B. Allotropes",
"C. Ions",
"D. Compounds"
],
correct: 1,
explanation: "Carbon nature mein different structural forms mein present hota hai. In different forms ko <strong>allotropes of carbon</strong> kehte hain, jaise <strong>diamond, graphite aur fullerene</strong>."
},
{
question: "2. Diamond mein har carbon atom kitne other carbon atoms se bonded hota hai?",
options: [
"A. 2",
"B. 3",
"C. 4",
"D. 6"
],
correct: 2,
explanation: "Diamond mein each carbon atom <strong>four other carbon atoms</strong> se bonded hota hai. Isse ek <strong>rigid three-dimensional structure</strong> form hota hai."
},
{
question: "3. Diamond ki structure kaisi hoti hai?",
options: [
"A. Flat single layer",
"B. Rigid three-dimensional structure",
"C. Circular ring",
"D. Random structure"
],
correct: 1,
explanation: "Diamond mein carbon atoms strongly bonded hokar <strong>rigid 3D network</strong> banate hain. Isi structure ki wajah se diamond extremely hard hota hai."
},
{
question: "4. Graphite mein each carbon atom kitne other carbon atoms se bonded hota hai?",
options: [
"A. 1",
"B. 2",
"C. 3",
"D. 4"
],
correct: 2,
explanation: "Graphite mein each carbon atom <strong>three other carbon atoms</strong> se bonded hota hai. Ye atoms same plane mein <strong>hexagonal arrangement</strong> banate hain."
},
{
question: "5. Graphite ki layers ke beech bonding relatively weak hone ka kya result hota hai?",
options: [
"A. Graphite extremely hard hota hai",
"B. Graphite smooth aur slippery hota hai",
"C. Graphite liquid ban jata hai",
"D. Graphite electricity conduct nahi karta"
],
correct: 1,
explanation: "Graphite <strong>layers</strong> se bana hota hai. Layers easily ek-doosre ke upar slide kar sakti hain, isliye graphite <strong>smooth and slippery</strong> hota hai."
},
{
question: "6. Diamond aur graphite ke physical properties different kyun hain?",
options: [
"A. Dono different elements se bane hain",
"B. Dono mein carbon atoms ki bonding/arrangement different hai",
"C. Graphite mein carbon nahi hota",
"D. Diamond mein atoms nahi hote"
],
correct: 1,
explanation: "Diamond aur graphite dono <strong>carbon atoms</strong> se bane hain, lekin atoms ka <strong>bonding pattern aur arrangement different</strong> hai. Isi wajah se unki physical properties bhi different hoti hain."
},
{
question: "7. Inmein se kaunsa carbon ka good conductor of electricity hai?",
options: [
"A. Diamond",
"B. Graphite",
"C. Fullerene only",
"D. Carbon dioxide"
],
correct: 1,
explanation: "Graphite ek <strong>good conductor of electricity</strong> hai. Ye unusual property hai kyunki graphite carbon ka non-metallic allotrope hai."
},
{
question: "8. Fullerene ka first identified form kaunsa tha?",
options: [
"A. C-12",
"B. C-40",
"C. C-60",
"D. C-100"
],
correct: 2,
explanation: "Fullerene family ka first identified member <strong>C-60</strong> tha. Ismein 60 carbon atoms football-like shape mein arranged hote hain."
},
{
question: "9. C-60 molecule ko fullerene naam kis scientist/architect ke design se related shape ki wajah se diya gaya?",
options: [
"A. Albert Einstein",
"B. Buckminster Fuller",
"C. Isaac Newton",
"D. James Watt"
],
correct: 1,
explanation: "C-60 ka structure <strong>football-like</strong> tha aur ye US architect <strong>Buckminster Fuller</strong> ke geodesic dome design jaisa dikhta tha. Isliye ise <strong>fullerene</strong> kaha gaya."
},
{
question: "10. Diamond ko artificially/synthetically banane ke liye carbon ko kis condition mein subject kiya ja sakta hai?",
options: [
"A. Very low pressure and low temperature",
"B. High pressure and high temperature",
"C. Only water mein",
"D. Normal room temperature par"
],
correct: 1,
explanation: "<strong>Synthetic diamonds</strong> pure carbon ko <strong>very high pressure and temperature</strong> par subject karke banaye ja sakte hain. Ye natural diamonds se otherwise distinguish karna difficult ho sakta 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}/${questions.length} (${s.date})</li>`
).join('');
}
</script>
</body>
</html>