3 Unit 1: How the Sun Works
Why is the Sun so important to life on Earth? How does it work?
Earth & Space Science
HS-ESS1-1 Time: 6 Days 🧠 Quiz & Evaluate ↓
4 Engage: How Does the Sun Provide Energy?
4.1 ⚡ The Sun’s Unbelievable Power
The energy released by the Sun in ONE SECOND is more energy than the entire world uses in a whole day.
Think about that. Every power plant, every car, every phone charger, every factory on Earth — all running for 24 hours — uses less energy than what the Sun pumps out in a single second.
4.1.1 🤔 How is that possible?
- What is the Sun made of?
- What process could possibly release that much energy?
- How long can the Sun keep doing this?
- Does the exoplanet in our performance task have a star like this?
Code
buildQuiz = function(id, title, questions) {
const outer = html`<div id="${id}" style="margin:18px 0 24px 0;text-align:center;">
<button style="
display:inline-flex;align-items:center;gap:7px;
background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);
color:#fff;border:none;padding:9px 22px;border-radius:50px;
font-size:.95em;font-weight:700;cursor:pointer;
box-shadow:0 3px 12px rgba(102,126,234,.45);
transition:transform .15s,box-shadow .15s;"
onmouseover="this.style.transform='scale(1.04)';this.style.boxShadow='0 5px 18px rgba(102,126,234,.55)'"
onmouseout="this.style.transform='scale(1)';this.style.boxShadow='0 3px 12px rgba(102,126,234,.45)'"
>
<span style="font-size:1.1em;">📝</span> ${title}
<span class="chevron" style="transition:transform .3s;">▼</span>
</button>
<div class="quiz-body" style="
max-height:0;opacity:0;overflow:hidden;
transition:max-height .5s cubic-bezier(.4,0,.2,1),opacity .4s ease,margin-top .3s ease;
margin-top:0;text-align:left;">
<button class="close-btn" style="
display:block;margin:0 auto 10px auto;
background:rgba(102,126,234,.12);color:#667eea;border:none;
padding:5px 18px;border-radius:50px;font-size:.85em;
font-weight:600;cursor:pointer;">Hide Quiz</button>
<p style="text-align:center;color:#718096;font-style:italic;font-size:.9em;margin-bottom:12px;">
Select an answer for each question.</p>
</div>
</div>`;
const toggle = outer.querySelector("button");
const chevron = toggle.querySelector(".chevron");
const body = outer.querySelector(".quiz-body");
const closeBtn = body.querySelector(".close-btn");
function expand(){ body.style.maxHeight="2000px";body.style.opacity="1";body.style.marginTop="14px";chevron.style.transform="rotate(180deg)"; }
function collapse(){ body.style.maxHeight="0";body.style.opacity="0";body.style.marginTop="0";chevron.style.transform="rotate(0)"; }
toggle.onclick = () => body.style.maxHeight === "0px" || body.style.maxHeight === "" ? expand() : collapse();
closeBtn.onclick = collapse;
questions.forEach((qq, qi) => {
const card = document.createElement("div");
card.style.cssText = "background:#fff;border-radius:12px;padding:16px 20px;margin-bottom:14px;box-shadow:0 2px 8px rgba(0,0,0,.08);";
card.innerHTML = `<p style="font-weight:700;margin:0 0 10px;">${qi+1}. ${qq.q}</p>`;
qq.options.forEach((opt, oi) => {
const btn = document.createElement("button");
btn.textContent = opt;
btn.style.cssText = "display:block;width:100%;text-align:left;padding:10px 14px;margin:6px 0;border:2px solid #e2e8f0;border-radius:8px;background:#fff;cursor:pointer;font-size:.95em;transition:border-color .2s,background .2s;";
btn.onmouseover = () => { if(!card.dataset.answered){ btn.style.borderColor="#667eea";btn.style.background="#f0f0ff"; }};
btn.onmouseout = () => { if(!card.dataset.answered){ btn.style.borderColor="#e2e8f0";btn.style.background="#fff"; }};
btn.onclick = () => {
if(card.dataset.answered) return;
card.dataset.answered = "true";
card.querySelectorAll("button").forEach(b => { b.style.cursor="default"; b.onmouseover=null; b.onmouseout=null; });
if(oi === qq.correct){
btn.style.borderColor="#48bb78";btn.style.background="#f0fff4";
fb.innerHTML = "✅ Correct! " + qq.explanation;
fb.style.color="#276749";fb.style.background="#f0fff4";
} else {
btn.style.borderColor="#fc8181";btn.style.background="#fff5f5";
card.querySelectorAll("button")[qq.correct].style.borderColor="#48bb78";
card.querySelectorAll("button")[qq.correct].style.background="#f0fff4";
fb.innerHTML = "❌ " + qq.explanation;
fb.style.color="#9b2c2c";fb.style.background="#fff5f5";
}
fb.style.padding="10px 14px";fb.style.marginTop="8px";
};
card.appendChild(btn);
});
const fb = document.createElement("div");
fb.style.cssText = "border-radius:8px;font-size:.9em;transition:all .3s;";
card.appendChild(fb);
body.appendChild(card);
});
return outer;
}Code
energyComparison = [
{source: "Sun (per second)", energy: 3.8e26, log: 26.58, color: "#f39c12"},
{source: "World (per day)", energy: 5.0e17, log: 17.70, color: "#3498db"},
{source: "Lightning bolt", energy: 1.0e9, log: 9.0, color: "#9b59b6"},
{source: "1 kg of coal", energy: 2.4e7, log: 7.38, color: "#636e72"},
{source: "Human body (per day)", energy: 8.7e6, log: 6.94, color: "#e74c3c"}
]
Plot.plot({
title: "Energy Comparison (log scale — each bar is 10× the previous gridline!)",
subtitle: "The Sun's output dwarfs everything humans have ever produced",
width: 700,
height: 350,
marginLeft: 150,
x: {label: "Energy (log₁₀ Joules)", grid: true},
y: {label: null},
marks: [
Plot.barX(energyComparison, {
y: "source",
x: "log",
fill: "color",
sort: {y: "-x"}
,
tip: true}),
Plot.text(energyComparison, {
y: "source",
x: "log",
text: d => `10^${d.log.toFixed(1)} J`,
dx: 5,
textAnchor: "start",
fontSize: 11,
fontWeight: "bold"
}),
Plot.ruleX([0])
]
})Code
buildQuiz("energy-scale-quiz", "☀️ Check Your Understanding — Solar Energy Scale", [
{
q: "The Sun's energy output per second is approximately how many times greater than the entire world's daily energy use?",
options: ["About 10 times greater", "About 1,000 times greater", "About 1 billion times greater", "They are roughly equal"],
correct: 2,
explanation: "The Sun outputs ~3.8 × 10²⁶ joules per second, while the world uses ~5 × 10¹⁷ joules per day — a difference of roughly a billion times. No human-scale energy source comes close."
},
{
q: "On the log-scale chart above, each gridline represents what change in energy?",
options: ["Doubling the energy", "Adding 100 more joules", "Multiplying by 10 (one order of magnitude)", "Adding 1 billion joules"],
correct: 2,
explanation: "A logarithmic scale means each step represents a factor of 10. The Sun's bar being ~9 gridlines longer than the human body means it outputs 10⁹ (one billion) times more energy per second."
}
])5 Explore: Investigating Light from the Sun
5.1 🔬 What Can Light Tell Us About the Sun?
We can’t visit the Sun or take a sample of it. So how do scientists know what it’s made of? The answer: spectroscopy — splitting sunlight into its component wavelengths and reading the pattern like a fingerprint.
5.2 How Spectroscopy Works
When light passes through a gas, certain wavelengths get absorbed. Each element absorbs a unique pattern of wavelengths — like a barcode. By matching the Sun’s absorption pattern to lab samples, we can figure out the Sun’s composition.
Code
{
const width = 700;
const height = 340;
const svg = d3.create("svg").attr("width", width).attr("height", height);
svg.append("rect").attr("width", width).attr("height", height).attr("fill", "#1a1a2e").attr("rx", 12);
svg.append("text").attr("x", width/2).attr("y", 25).attr("text-anchor", "middle")
.attr("fill", "white").attr("font-size", 16).attr("font-weight", "bold")
.text("Absorption Spectra — Element Fingerprints");
const colors = ["#FF0000", "#FF4500", "#FFD700", "#ADFF2F", "#00CED1", "#4169E1", "#8B00FF"];
const labels = ["Red", "", "Yellow", "Green", "", "Blue", "Violet"];
// Continuous spectrum
svg.append("text").attr("x", 15).attr("y", 55).attr("fill", "#ccc").attr("font-size", 12).attr("font-weight", "bold").text("Continuous:");
const specW = 500;
for (let i = 0; i < specW; i++) {
const hue = 270 - (i / specW) * 270;
svg.append("rect").attr("x", 130 + i).attr("y", 42).attr("width", 1.5).attr("height", 22)
.attr("fill", `hsl(${hue}, 100%, 50%)`);
}
// Hydrogen lines
const hLines = [0.15, 0.32, 0.52, 0.75];
svg.append("text").attr("x", 15).attr("y", 95).attr("fill", "#ccc").attr("font-size", 12).attr("font-weight", "bold").text("Hydrogen:");
for (let i = 0; i < specW; i++) {
const hue = 270 - (i / specW) * 270;
const pos = i / specW;
const isLine = hLines.some(l => Math.abs(pos - l) < 0.008);
svg.append("rect").attr("x", 130 + i).attr("y", 82).attr("width", 1.5).attr("height", 22)
.attr("fill", isLine ? "#1a1a2e" : `hsl(${hue}, 100%, 50%)`);
}
// Helium lines
const heLines = [0.12, 0.28, 0.45, 0.58, 0.82];
svg.append("text").attr("x", 15).attr("y", 135).attr("fill", "#ccc").attr("font-size", 12).attr("font-weight", "bold").text("Helium:");
for (let i = 0; i < specW; i++) {
const hue = 270 - (i / specW) * 270;
const pos = i / specW;
const isLine = heLines.some(l => Math.abs(pos - l) < 0.008);
svg.append("rect").attr("x", 130 + i).attr("y", 122).attr("width", 1.5).attr("height", 22)
.attr("fill", isLine ? "#1a1a2e" : `hsl(${hue}, 100%, 50%)`);
}
// Sun spectrum (has both H and He lines plus a few more)
const sunLines = [...hLines, ...heLines, 0.38, 0.62, 0.7];
svg.append("text").attr("x", 15).attr("y", 175).attr("fill", "#f39c12").attr("font-size", 12).attr("font-weight", "bold").text("The Sun:");
for (let i = 0; i < specW; i++) {
const hue = 270 - (i / specW) * 270;
const pos = i / specW;
const isLine = sunLines.some(l => Math.abs(pos - l) < 0.008);
svg.append("rect").attr("x", 130 + i).attr("y", 162).attr("width", 1.5).attr("height", 22)
.attr("fill", isLine ? "#1a1a2e" : `hsl(${hue}, 100%, 50%)`);
}
// Key
svg.append("text").attr("x", width/2).attr("y", 210).attr("text-anchor", "middle")
.attr("fill", "#ccc").attr("font-size", 12).text("↑ Dark lines = wavelengths absorbed by specific elements");
// Composition
svg.append("text").attr("x", width/2).attr("y", 245).attr("text-anchor", "middle")
.attr("fill", "white").attr("font-size", 14).attr("font-weight", "bold")
.text("Sun's Composition (by mass)");
const comp = [
{element: "Hydrogen", pct: 73.46, color: "#3498db"},
{element: "Helium", pct: 24.85, color: "#f39c12"},
{element: "Oxygen", pct: 0.77, color: "#e74c3c"},
{element: "Carbon", pct: 0.29, color: "#636e72"},
{element: "Other", pct: 0.63, color: "#9b59b6"}
];
let xPos = 80;
comp.forEach(c => {
const barW = (c.pct / 100) * 540;
svg.append("rect").attr("x", xPos).attr("y", 260).attr("width", Math.max(barW, 3)).attr("height", 30)
.attr("fill", c.color).attr("rx", 3);
if (barW > 30) {
svg.append("text").attr("x", xPos + barW/2).attr("y", 280).attr("text-anchor", "middle")
.attr("fill", "white").attr("font-size", 11).attr("font-weight", "bold")
.text(`${c.element} ${c.pct}%`);
}
xPos += barW;
});
svg.append("text").attr("x", 620 + 20).attr("y", 275).attr("font-size", 10).attr("fill", "#ccc").text("← 1.7% non-H/He");
return svg.node();
}Code
buildQuiz("spectroscopy-quiz", "🔬 Check Your Understanding — Spectroscopy", [
{
q: "How do scientists determine the Sun's chemical composition without visiting it?",
options: ["They collect particles from the solar wind", "They match the Sun's absorption-line pattern to elements tested in labs", "They measure the Sun's mass and infer composition from density", "They send probes into the Sun's corona"],
correct: 1,
explanation: "Spectroscopy splits sunlight into its component wavelengths. Each element absorbs a unique pattern of wavelengths like a barcode. Matching the Sun's dark absorption lines to lab spectra reveals it is 73% hydrogen and 25% helium."
},
{
q: "The Sun is 73% hydrogen by mass. Why is this composition critical for sustaining life on Earth?",
options: ["Hydrogen makes the Sun appear yellow, which plants need", "Hydrogen is the fuel for nuclear fusion — the process that powers the Sun for billions of years", "Hydrogen is lighter than helium, keeping the Sun from collapsing", "Hydrogen reflects more light toward Earth"],
correct: 1,
explanation: "Hydrogen is the fuel for nuclear fusion. Four hydrogen nuclei fuse into helium, releasing enormous energy. The Sun's vast hydrogen supply allows it to shine steadily for ~10 billion years — long enough for complex life to evolve."
},
{
q: "If an exoplanet's star showed absorption lines dominated by iron and carbon instead of hydrogen, what would that suggest?",
options: ["The star is very young and hasn't started fusing yet", "The star is likely near the end of its life and may not be stable enough for life", "Iron and carbon stars burn hotter and are better for life", "The star would have stronger gravity, pulling planets closer"],
correct: 1,
explanation: "A star dominated by heavy elements like iron has likely depleted most of its hydrogen fuel. Such a star is near the end of its life cycle and may be unstable — a red flag for habitability."
}
])6 Explain: The Sun’s Energy Source
6.1 🧠 Nuclear Fusion: Turning Hydrogen into Energy
The Sun is powered by nuclear fusion — smashing hydrogen atoms together to form helium. This process converts a tiny amount of mass directly into enormous amounts of energy, described by Einstein’s famous equation \(E = mc^2\).
6.1.1 💡 Why Fusion Releases So Much Energy
In the Sun’s core (15 million °C, 250 billion atmospheres of pressure):
- 4 hydrogen nuclei (protons) fuse together
- They form 1 helium nucleus (2 protons + 2 neutrons)
- The helium is slightly less massive than the 4 original protons
- That “missing” mass (\(0.7\%\)) converts to energy: \(E = mc^2\)
- Even though \(0.7\%\) sounds tiny, \(c^2\) is enormous (\(9 \times 10^{16}\)), so the energy output is staggering
The Sun converts 600 million tons of hydrogen into helium every second — and has enough fuel to keep going for another 5 billion years.
Code
Code
{
const totalH = 100;
const burnRate = 6.5; // % per billion years (simplified)
const hRemaining = Math.max(0, totalH - sunAge * burnRate);
const heCreated = totalH - hRemaining;
const phase = sunAge < 10 ? "Main Sequence (stable)" :
sunAge < 11 ? "Red Giant (expanding!)" :
"White Dwarf (cooling)";
const phaseColor = sunAge < 10 ? "#f39c12" : sunAge < 11 ? "#e74c3c" : "#bdc3c7";
const width = 700;
const height = 280;
const svg = d3.create("svg").attr("width", width).attr("height", height);
svg.append("rect").attr("width", width).attr("height", height).attr("fill", "#0a0a2e").attr("rx", 12);
svg.append("text").attr("x", width/2).attr("y", 25).attr("text-anchor", "middle")
.attr("fill", "white").attr("font-size", 16).attr("font-weight", "bold")
.text(`The Sun at ${sunAge} Billion Years Old`);
svg.append("text").attr("x", width/2).attr("y", 48).attr("text-anchor", "middle")
.attr("fill", phaseColor).attr("font-size", 14).attr("font-weight", "bold")
.text(`Phase: ${phase}`);
// Sun size visualization
const baseR = 40;
const sunR = sunAge < 10 ? baseR : sunAge < 11 ? baseR * 3 : baseR * 0.3;
svg.append("circle").attr("cx", 150).attr("cy", 160).attr("r", sunR)
.attr("fill", phaseColor).attr("opacity", 0.8);
svg.append("text").attr("x", 150).attr("y", 165).attr("text-anchor", "middle")
.attr("fill", sunAge < 11 ? "white" : "#333").attr("font-size", sunR > 20 ? 14 : 8)
.attr("font-weight", "bold").text("☀️");
// Fuel gauge
svg.append("text").attr("x", 330).attr("y", 85).attr("fill", "white").attr("font-size", 13).attr("font-weight", "bold")
.text("Fuel Remaining:");
svg.append("rect").attr("x", 330).attr("y", 95).attr("width", 300).attr("height", 30)
.attr("fill", "#2c3e50").attr("rx", 6);
svg.append("rect").attr("x", 330).attr("y", 95).attr("width", (hRemaining/100)*300).attr("height", 30)
.attr("fill", "#3498db").attr("rx", 6);
svg.append("text").attr("x", 480).attr("y", 115).attr("text-anchor", "middle")
.attr("fill", "white").attr("font-size", 12).attr("font-weight", "bold")
.text(`Hydrogen: ${hRemaining.toFixed(0)}%`);
svg.append("rect").attr("x", 330).attr("y", 140).attr("width", 300).attr("height", 30)
.attr("fill", "#2c3e50").attr("rx", 6);
svg.append("rect").attr("x", 330).attr("y", 140).attr("width", (heCreated/100)*300).attr("height", 30)
.attr("fill", "#f39c12").attr("rx", 6);
svg.append("text").attr("x", 480).attr("y", 160).attr("text-anchor", "middle")
.attr("fill", "white").attr("font-size", 12).attr("font-weight", "bold")
.text(`Helium: ${heCreated.toFixed(0)}%`);
// Timeline marker
svg.append("text").attr("x", 330).attr("y", 200).attr("fill", "#ccc").attr("font-size", 12)
.text(sunAge <= 4.6 ? "← We are here (4.6 Gyr)" :
sunAge <= 10 ? "Future: Sun still stable" :
sunAge <= 11 ? "⚠️ Sun expands to engulf Earth!" :
"Sun becomes a tiny white dwarf");
// Key facts
svg.append("text").attr("x", 330).attr("y", 235).attr("fill", "#3498db").attr("font-size", 11)
.text(`Fusion rate: ~600 million tons H → He per second`);
svg.append("text").attr("x", 330).attr("y", 255).attr("fill", "#f39c12").attr("font-size", 11)
.text(`Energy output: 3.8 × 10²⁶ watts (stable for billions of years)`);
return svg.node();
}Code
buildQuiz("sun-lifecycle-quiz", "⏱️ Check Your Understanding — The Sun's Life Cycle", [
{
q: "Using the slider, at approximately what age does the Sun transition from Main Sequence to Red Giant?",
options: ["About 5 billion years", "About 10 billion years", "About 7 billion years", "About 12 billion years"],
correct: 1,
explanation: "The Sun will exhaust its core hydrogen fuel at roughly 10 billion years of age, triggering its expansion into a Red Giant. Since it's currently 4.6 billion years old, it has about 5.4 billion years of stable life left."
},
{
q: "What happens to the Sun's physical size when it becomes a Red Giant?",
options: ["It shrinks to a tiny point", "It stays roughly the same size", "It expands enormously — large enough to engulf Earth's orbit", "It splits into two smaller stars"],
correct: 2,
explanation: "When core hydrogen is exhausted, the Sun's outer layers expand dramatically. As a Red Giant, the Sun will swell to roughly 200× its current radius, likely engulfing Mercury, Venus, and possibly Earth."
},
{
q: "The Sun is currently 4.6 billion years old. Approximately how much of its hydrogen fuel has it consumed?",
options: ["About 5%", "About 30%", "About 50%", "About 75%"],
correct: 1,
explanation: "At 4.6 billion years with a ~10 billion year main-sequence lifespan, the Sun has burned through roughly 30% of its core hydrogen. The fuel gauge in the simulation shows this — plenty of fuel remains for billions more years."
}
])7 Elaborate: Scale of Solar Energy
7.1 🌍 Using Evidence of Scale to Understand the Sun
The Sun has been releasing energy at a nearly constant rate for 4.6 billion years. No chemical reaction (like burning coal or gas) could sustain this output — only nuclear fusion explains both the quantity and duration of the Sun’s energy.
Code
durationData = [
{source: "Chemical (burning coal)", duration: 0.005, energy: 0.001, color: "#636e72"},
{source: "Chemical (burning hydrogen)", duration: 0.015, energy: 0.003, color: "#74b9ff"},
{source: "Gravitational contraction", duration: 0.03, energy: 0.01, color: "#a29bfe"},
{source: "Nuclear fission", duration: 0.1, energy: 0.05, color: "#fdcb6e"},
{source: "Nuclear fusion (actual)", duration: 10, energy: 1.0, color: "#f39c12"}
]
Plot.plot({
title: "How Long Could Each Energy Source Power the Sun?",
subtitle: "Only fusion explains billions of years of stable output",
width: 700,
height: 350,
marginLeft: 200,
x: {label: "Duration (billion years)", type: "log", grid: true},
y: {label: null},
marks: [
Plot.barX(durationData, {
y: "source",
x: "duration",
fill: "color",
sort: {y: "x"}
,
tip: true}),
Plot.text(durationData, {
y: "source",
x: "duration",
text: d => d.duration >= 1 ? `${d.duration} billion yr` : `${(d.duration * 1000).toFixed(0)} million yr`,
dx: 5,
textAnchor: "start",
fontSize: 11,
fontWeight: "bold"
}),
Plot.ruleX([4.6], {stroke: "#e74c3c", strokeWidth: 2, strokeDasharray: "5,5"}),
Plot.text([{y: "Nuclear fusion (actual)", x: 4.6}], {
y: "y", x: "x", text: d => "← Sun's current age (4.6 Gyr)",
dx: 5, dy: -15, fontSize: 10, fill: "#e74c3c", fontWeight: "bold"
})
]
})☀️ If the Sun ran on coal, it would have burned out in 5,000 years. If it ran on gravitational contraction, it would last 30 million years. Only nuclear fusion — the same process in a hydrogen bomb — explains how the Sun has been shining for 4.6 BILLION years.
8 Chapter Summary
| Key Concept | Details |
|---|---|
| Sun’s composition | 73% hydrogen, 25% helium — determined by spectroscopy |
| Energy source | Nuclear fusion: \(4H \rightarrow He + energy\) (\(E = mc^2\)) |
| Energy output | \(3.8 \times 10^{26}\) watts — stable for billions of years |
| Sun’s age | 4.6 billion years old, ~5.4 billion years of fuel remaining |
| Why only fusion? | Chemical burning lasts ~5,000 yr; gravitational contraction ~30 Myr. Only fusion explains 4.6 Gyr of steady output |
| Sun’s fate | Main Sequence → Red Giant (~10 Gyr) → White Dwarf |
| Key tool | Spectroscopy — absorption lines reveal composition remotely |
9 Myth or Fact?
☀️ The Sun: Myths vs. Facts
Decide whether each statement is a MYTH or a FACT!
10 End-of-Chapter Quiz
Code
function buildSunQuiz(id, title, questions) {
const outer = html`<div id="${id}" style="font-family:'Inter',sans-serif; max-width:720px; margin:18px auto;"></div>`;
const header = html`<div style="background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);color:#fff;border-radius:14px 14px 0 0;padding:18px 24px;">
<div style="font-size:1.1em;font-weight:700;display:flex;align-items:center;gap:8px;"><span style="font-size:1.2em;">📝</span> ${title}</div>
<div style="font-size:0.85em;opacity:0.85;margin-top:4px;">Select an answer for each question.</div>
</div>`;
const body = html`<div style="border:1.5px solid #c7d2fe;border-top:none;border-radius:0 0 14px 14px;overflow:hidden;background:#f8f9ff;padding:16px;"></div>`;
questions.forEach((qq, qi) => {
const card = document.createElement("div");
card.style.cssText = "background:#fff;border-radius:12px;padding:16px 20px;margin-bottom:14px;box-shadow:0 2px 8px rgba(0,0,0,.08);";
card.innerHTML = `<p style="font-weight:700;margin:0 0 10px;color:#1e1b4b;">${qi+1}. ${qq.q}</p>`;
qq.options.forEach((opt, oi) => {
const btn = document.createElement("button");
btn.textContent = opt;
btn.style.cssText = "display:block;width:100%;text-align:left;padding:10px 14px;margin:6px 0;border:2px solid #e2e8f0;border-radius:8px;background:#fff;color:#1e1b4b;cursor:pointer;font-size:.95em;transition:border-color .2s,background .2s;";
btn.onmouseover = () => { if(!card.dataset.answered){ btn.style.borderColor="#667eea";btn.style.background="#f0f0ff"; }};
btn.onmouseout = () => { if(!card.dataset.answered){ btn.style.borderColor="#e2e8f0";btn.style.background="#fff"; }};
btn.onclick = () => {
if(card.dataset.answered) return;
card.dataset.answered = "true";
card.querySelectorAll("button").forEach(b => {
b.style.cursor="default"; b.onmouseover=null; b.onmouseout=null;
b.style.borderColor="#e2e8f0"; b.style.background="#f8fafc"; b.style.color="#475569";
});
if(oi === qq.correct){
btn.style.borderColor="#48bb78";btn.style.background="#f0fff4";btn.style.color="#276749";btn.style.fontWeight="700";
fb.innerHTML = "✅ Correct! " + qq.explanation;
fb.style.color="#276749";fb.style.background="#f0fff4";
} else {
btn.style.borderColor="#fc8181";btn.style.background="#fff5f5";btn.style.color="#9b2c2c";btn.style.fontWeight="700";
const correctBtn = card.querySelectorAll("button")[qq.correct];
correctBtn.style.borderColor="#48bb78";correctBtn.style.background="#f0fff4";correctBtn.style.color="#276749";correctBtn.style.fontWeight="700";
fb.innerHTML = "❌ " + qq.explanation;
fb.style.color="#9b2c2c";fb.style.background="#fff5f5";
}
fb.style.padding="10px 14px";fb.style.marginTop="8px";fb.style.borderRadius="8px";
};
card.appendChild(btn);
});
const fb = document.createElement("div");
fb.style.cssText = "border-radius:8px;font-size:.9em;transition:all .3s;";
card.appendChild(fb);
body.appendChild(card);
});
outer.appendChild(header);
outer.appendChild(body);
return outer;
}Code
buildSunQuiz("sun-summative-quiz", "☀️ Summative Quiz — How the Sun Works", [
{
q: "What is the Sun's primary energy source?",
options: [
"Chemical combustion of hydrogen gas",
"Gravitational contraction releasing heat",
"Nuclear fusion — combining hydrogen nuclei into helium",
"Radioactive decay of heavy elements in the core"
],
correct: 2,
explanation: "The Sun is powered by nuclear fusion in its core, where 4 hydrogen nuclei combine to form 1 helium nucleus. A small amount of mass is converted to energy via E = mc², producing 3.8 × 10²⁶ watts."
},
{
q: "Why is the equation E = mc² relevant to understanding solar energy?",
options: [
"It shows that the Sun must be moving at the speed of light",
"It explains why the Sun is round",
"It shows that a tiny loss of mass during fusion converts into an enormous amount of energy",
"It measures the gravitational pull between the Sun and Earth"
],
correct: 2,
explanation: "During fusion, the helium product has 0.7% less mass than the four hydrogen inputs. That 'missing' mass converts to energy. Because c² is so large (9 × 10¹⁶ m²/s²), even a small mass loss produces staggering energy."
},
{
q: "What tool do scientists use to determine the Sun's chemical composition from Earth?",
options: [
"Radar imaging of the Sun's surface",
"Spectroscopy — analyzing absorption line patterns in sunlight",
"Measuring the Sun's gravitational pull on planets",
"Collecting solar wind particles with satellites"
],
correct: 1,
explanation: "Spectroscopy splits light into wavelengths. Each element absorbs unique wavelengths, creating dark lines — like a chemical fingerprint. The Sun's spectrum matches hydrogen and helium lab patterns, confirming its 73% H / 25% He composition."
},
{
q: "If a hypothetical energy source could sustain the Sun's luminosity by burning coal, approximately how long would it last?",
options: [
"About 5,000 years",
"About 30 million years",
"About 1 billion years",
"About 10 billion years"
],
correct: 0,
explanation: "A Sun-sized ball of coal burning chemically would exhaust its fuel in roughly 5,000 years. This was known as Lord Kelvin's paradox — geologists knew Earth was far older. Only nuclear fusion, discovered in the 20th century, resolves the discrepancy."
},
{
q: "The Sun is currently 4.6 billion years old. Which statement best describes its current status?",
options: [
"It is near death and about to become a Red Giant",
"It is a young star that just started fusing hydrogen",
"It is roughly middle-aged, with about 5 billion stable years remaining",
"It has already passed through the Red Giant phase"
],
correct: 2,
explanation: "With a main-sequence lifespan of ~10 billion years, the Sun at 4.6 Gyr is roughly middle-aged. It has consumed about 30% of its core hydrogen and will remain stable for approximately 5.4 billion more years."
},
{
q: "What keeps the Sun from collapsing under its own gravity?",
options: [
"Its rapid rotation flings material outward",
"The outward pressure from fusion energy balances the inward pull of gravity",
"The solar wind pushes the outer layers outward",
"Earth's gravitational pull holds the Sun in shape"
],
correct: 1,
explanation: "The Sun exists in hydrostatic equilibrium — the outward radiation and gas pressure from nuclear fusion exactly balances the inward gravitational force. When fusion eventually stops, gravity wins and the core collapses."
},
{
q: "What is the Sun's eventual fate?",
options: [
"It will explode as a supernova, leaving behind a black hole",
"It will expand into a Red Giant, shed its outer layers, and become a white dwarf",
"It will split into a binary star system",
"It will slowly cool and turn into a gas giant planet"
],
correct: 1,
explanation: "Stars of ~1 solar mass do not have enough mass for a supernova. The Sun will exhaust its hydrogen, expand into a Red Giant (engulfing the inner planets), eject its outer layers as a planetary nebula, and leave behind a cooling white dwarf."
},
{
q: "Why is the Sun's long-term stability especially important for life on Earth?",
options: [
"Life needs consistent day/night cycles of exactly 24 hours",
"Complex life took billions of years to evolve, requiring a steady energy source over that entire time",
"Stable stars produce more oxygen than unstable stars",
"Stability means the Sun never produces harmful radiation"
],
correct: 1,
explanation: "Simple life appeared ~3.8 billion years ago, but complex multicellular life only emerged ~600 million years ago. This required billions of years of stable solar energy. A star that burned out or varied wildly in output would not allow complex life to evolve."
},
{
q: "Examining the energy comparison chart, what does a logarithmic scale reveal that a linear scale would hide?",
options: [
"That human energy use is nearly zero compared to the Sun",
"That all energy sources produce exactly the same output",
"The enormous orders-of-magnitude differences between energy sources — from 10⁷ to 10²⁶ joules",
"That the Sun and a lightning bolt produce similar energy"
],
correct: 2,
explanation: "A linear scale would show the Sun's bar stretching far off screen while all other sources appear as invisible slivers. The logarithmic scale compresses this range, letting you compare sources spanning 20 orders of magnitude on a single chart."
},
{
q: "For the performance task: which property of an exoplanet's host star should you check FIRST when evaluating habitability?",
options: [
"The star's color — bluer stars are always better for life",
"Whether the star is on the main sequence with a lifespan > 4 billion years",
"The star's distance from Earth",
"Whether the star has any planets at all"
],
correct: 1,
explanation: "A stable main-sequence star with a lifespan longer than ~4 billion years is essential — complex life needs billions of years of steady energy. Very massive stars (blue/hot) burn out too quickly, and non-main-sequence stars are unstable."
}
])