ch7 part8
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>š§ Gravitational Potential Energy 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;
line-height: 1.6;
}
.options label {
display: block;
margin: 8px 0;
padding: 10px;
border-radius: 6px;
border: 1px solid #ccc;
cursor: pointer;
transition: 0.3s;
line-height: 1.5;
}
.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;
line-height: 1.6;
}
.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: 90%;
max-width: 350px;
border: 1px solid #ccc;
border-radius: 6px;
margin-bottom: 10px;
}
</style>
</head>
<body>
<div class="quiz-container">
<h2>š§ Gravitational Potential Energy Quiz ā APICAL CLASSES</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. Gravitational potential energy mainly kis system ki wajah se hoti hai?",
options: [
"A. Ball aur air system",
"B. Earth aur ball system",
"C. Ball aur water system",
"D. Earth aur Sun system"
],
correct: 1,
explanation: "Gravitational potential energy Earth aur object ke beech gravitational force ki wajah se store hoti hai. Isliye ise Earth-object system ki energy kaha jaata hai."
},
{
question: "2. Earth-ball system mein Earth ball ki taraf bahut kam kyun move karti hai?",
options: [
"A. Earth ka temperature kam hai",
"B. Earth ka shape fixed hai",
"C. Earth ka mass ball se bahut zyada hai",
"D. Ball Earth ko attract nahi karti"
],
correct: 2,
explanation: "Earth bahut massive hai, isliye gravitational attraction ke bawajood ball ki taraf uski movement practically negligible hoti hai."
},
{
question: "3. Activity 7.1 mein heavy ball ko sand ke upar se drop karne par sand mein depression kyun banta hai?",
options: [
"A. Ball mein stored energy hoti hai jo impact par work karti hai",
"B. Sand ball ko attract karti hai",
"C. Ball ka temperature badh jata hai",
"D. Sand ka mass kam ho jata hai"
],
correct: 0,
explanation: "Height par ball ke paas gravitational potential energy hoti hai. Girne par ye energy sand par work karti hai aur depression banati hai."
},
{
question: "4. Activity 7.1 mein agar ball ko 1 m aur 2 m ki height se drop kiya jaye, to sabse deep depression kab banega?",
options: [
"A. 1 m se drop karne par",
"B. 2 m se drop karne par",
"C. Dono mein same depression banega",
"D. Ball ko ground par rakhne par"
],
correct: 1,
explanation: "Same ball aur same sand conditions mein greater height par ball ki gravitational potential energy zyada hoti hai. Isliye impact par deeper depression ban sakta hai."
},
{
question: "5. Kisi object ko Earth ki surface se greater height tak raise karne ke liye kya hota hai?",
options: [
"A. Less work required hota hai",
"B. No work required hota hai",
"C. More work required hota hai",
"D. Work negative ho jata hai"
],
correct: 2,
explanation: "Object ko greater height tak lift karne ke liye gravitational force ke against more work karna padta hai. Ye work potential energy increase karta hai."
},
{
question: "6. Kisi object ko gradually height h tak raise karne ke liye applied force approximately kitna hota hai?",
options: [
"A. m/h",
"B. mg",
"C. mh",
"D. g/h"
],
correct: 1,
explanation: "Object ko gradually raise karte waqt, negligible acceleration ki condition mein applied force gravitational force ke equal hota hai, yani F = mg."
},
{
question: "7. Agar mass m ke object ko height h tak raise kiya jaye, to uski gravitational potential energy kya hogi?",
options: [
"A. U = mh",
"B. U = mg",
"C. U = mgh",
"D. U = m/g"
],
correct: 2,
explanation: "Gravitational potential energy ka formula U = mgh hai, jahan m = mass, g = gravitational acceleration aur h = reference level se height."
},
{
question: "8. Ek 2 kg object ko 5 m ki height tak raise kiya gaya. Agar g = 10 m/s² ho, to uski potential energy kitni hogi?",
options: [
"A. 20 J",
"B. 50 J",
"C. 100 J",
"D. 200 J"
],
correct: 2,
explanation: "Formula: U = mgh. U = 2 Ć 10 Ć 5 = 100 J. Isliye correct answer 100 Joule hai."
},
{
question: "9. Gravitational potential energy ka SI unit kya hai?",
options: [
"A. Newton",
"B. Watt",
"C. Joule",
"D. Pascal"
],
correct: 2,
explanation: "Potential energy ka SI unit Joule (J) hai, jo work done aur kinetic energy ka bhi SI unit hai."
},
{
question: "10. Object ko height h tak raise karne mein kiya gaya work kis mein appear hota hai?",
options: [
"A. Change in potential energy",
"B. Change in mass",
"C. Change in temperature only",
"D. Change in volume"
],
correct: 0,
explanation: "Object ko height tak raise karne mein gravitational force ke against kiya gaya work uski gravitational potential energy mein increase ke roop mein store hota hai."
}
];
let currentQuestion = 0;
let score = 0;
let userAnswers = [];
let userName = "";
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>
<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;">
<strong>Explanation:</strong> ${q.explanation}
</div>
<hr>
`;
});
document.querySelector(".controls").style.display = "none";
document.getElementById("result").innerHTML = `
<h3>Your Score: ${score} / ${questions.length}</h3>
<p>${score >= 8 ? "Excellent Performance! š" :
score >= 5 ? "Good Attempt! Keep Practising." :
"Keep Learning and Try Again!"}</p>
`;
}
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>