ÿþ<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>NEET Physics Section Test</title> <link href="logo1.jpg" rel="icon"> <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"> <style> :root { --primary-color: #4361ee; --secondary-color: #3a0ca3; --accent-color: #4cc9f0; --light-color: #f8f9fa; --dark-color: #212529; --success-color: #38b000; --danger-color: #ff3333; --warning-color: #ff9e00; --info-color: #4895ef; --background-gradient: linear-gradient(135deg, #f0f4ff 0%, #e6f0ff 100%); --card-shadow: 0 10px 30px rgba(67, 97, 238, 0.15); --button-hover-shadow: 0 6px 12px rgba(67, 97, 238, 0.25); } * { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Poppins', sans-serif; } body { background: var(--background-gradient); min-height: 100vh; padding: 20px; } .hidden { display: none; } .container { background-color: #fff; padding: 30px; border-radius: 15px; box-shadow: var(--card-shadow); width: 100%; max-width: 1000px; margin: 20px auto; transition: all 0.3s ease; } h1, h2, h3, h4 { color: var(--dark-color); margin-bottom: 20px; } h1 { text-align: center; color: var(--primary-color); font-size: 2.2rem; margin-bottom: 30px; position: relative; padding-bottom: 10px; } h1::after { content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 100px; height: 3px; background: var(--accent-color); border-radius: 3px; } h2 { font-size: 1.5rem; color: var(--secondary-color); margin-top: 10px; } select, input[type="checkbox"], input[type="radio"] { margin-right: 10px; } select { width: 100%; padding: 12px 15px; border: 2px solid #ddd; border-radius: 8px; font-size: 1rem; transition: all 0.3s; margin-bottom: 20px; } select:focus { border-color: var(--primary-color); outline: none; box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2); } label { display: inline-flex; align-items: center; margin-bottom: 12px; cursor: pointer; transition: all 0.2s; padding: 8px 12px; border-radius: 8px; } label:hover { background-color: rgba(67, 97, 238, 0.05); } input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--primary-color); } .btn { padding: 12px 25px; border: none; background-color: var(--primary-color); color: white; border-radius: 8px; cursor: pointer; font-size: 1rem; font-weight: 500; transition: all 0.3s; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); display: inline-block; text-align: center; margin: 10px 5px; } .btn:hover { background-color: var(--secondary-color); transform: translateY(-2px); box-shadow: var(--button-hover-shadow); } .btn:active { transform: translateY(0); } .btn-secondary { background-color: var(--info-color); } .btn-secondary:hover { background-color: #3a7bd5; } .btn-danger { background-color: var(--danger-color); } .btn-danger:hover { background-color: #e60000; } .btn-success { background-color: var(--success-color); } .btn-success:hover { background-color: #32a000; } .navigation-buttons { display: flex; justify-content: space-between; margin-top: 30px; } .question { margin-bottom: 25px; padding: 20px; background-color: #f8f9fa; border-radius: 10px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); border-left: 4px solid var(--primary-color); } .question p { font-size: 1.1rem; margin-bottom: 15px; font-weight: 500; color: var(--dark-color); } .option { display: flex; align-items: center; margin-bottom: 10px; padding: 10px 15px; border-radius: 8px; background-color: white; border: 1px solid #eee; transition: all 0.2s; } .option:hover { border-color: var(--accent-color); background-color: rgba(76, 201, 240, 0.05); } .option input[type="radio"]:checked + label { font-weight: 600; color: var(--primary-color); } #timer { font-size: 1.3rem; font-weight: 600; padding: 10px 20px; background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%); color: white; border-radius: 50px; display: inline-block; margin-bottom: 20px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); } #time.warning { color: var(--warning-color); animation: pulse 1s infinite; } #time.danger { color: var(--danger-color); animation: pulse 0.5s infinite; } @keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } } .divider { height: 2px; background: linear-gradient(to right, transparent, var(--accent-color), transparent); margin: 20px 0; border: none; } .results-card { background-color: white; border-radius: 15px; padding: 30px; box-shadow: var(--card-shadow); margin-bottom: 30px; text-align: center; border-top: 5px solid var(--primary-color); } .score { font-size: 3rem; font-weight: 700; color: var(--primary-color); margin: 20px 0; } .progress-container { width: 100%; height: 20px; background-color: #e9ecef; border-radius: 10px; margin: 20px 0; overflow: hidden; } .progress-bar { height: 100%; background: linear-gradient(to right, var(--accent-color), var(--primary-color)); border-radius: 10px; transition: width 0.5s ease; } .summary-item { margin-bottom: 30px; padding: 20px; background-color: white; border-radius: 10px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); border-left: 3px solid var(--primary-color); } .correct-answer { color: var(--success-color); font-weight: 600; } .user-correct { color: var(--success-color); font-weight: 600; } .user-incorrect { color: var(--danger-color); font-weight: 600; text-decoration: line-through; } .chapter-selection-container { background-color: white; padding: 25px; border-radius: 15px; box-shadow: var(--card-shadow); margin-bottom: 30px; } .chapter-list { columns: 2; column-gap: 30px; } .marks-list { background-color: #f8f9fa; padding: 20px; border-radius: 10px; margin: 20px 0; } .marks-list label { display: block; margin-bottom: 15px; padding: 15px; background-color: white; border-radius: 8px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); transition: all 0.3s; } .marks-list label:hover { transform: translateX(5px); box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1); } /* Graphics Section */ .graphics-section { display: flex; flex-wrap: wrap; justify-content: space-around; margin: 30px 0; gap: 20px; } .graphic-card { background: white; border-radius: 10px; padding: 20px; width: 150px; text-align: center; box-shadow: var(--card-shadow); transition: transform 0.3s; border-top: 3px solid var(--primary-color); } .graphic-card:hover { transform: translateY(-5px); } .graphic-icon { font-size: 2.5rem; color: var(--primary-color); margin-bottom: 10px; } .graphic-title { font-size: 0.9rem; font-weight: 500; color: var(--dark-color); } .slogan { text-align: center; font-size: 1.2rem; font-style: italic; color: var(--secondary-color); margin: 30px 0; padding: 15px; background: rgba(67, 97, 238, 0.1); border-radius: 8px; border-left: 4px solid var(--primary-color); } /* Exam Type Selection */ .exam-type-selection { background-color: white; padding: 25px; border-radius: 15px; box-shadow: var(--card-shadow); margin-top: 20px; } /* Selected Chapters Display */ .selected-chapters-display { background-color: #f8f9fa; padding: 15px; border-radius: 8px; margin: 15px 0; } .selected-chapter { display: inline-block; background-color: var(--primary-color); color: white; padding: 5px 10px; border-radius: 15px; margin: 5px; font-size: 0.9rem; } /* Next Button for Chapter Selection */ .chapter-next-btn { text-align: center; margin-top: 20px; } /* Subject Selection Cards */ .subject-selection-container { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; margin: 30px 0; } .subject-card { width: 150px; height: 150px; background: white; border-radius: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; transition: all 0.3s; box-shadow: var(--card-shadow); border: 3px solid transparent; } .subject-card:hover { transform: translateY(-5px); box-shadow: var(--button-hover-shadow); } .subject-card.selected { border-color: var(--primary-color); background-color: rgba(67, 97, 238, 0.05); } .subject-icon { font-size: 3rem; margin-bottom: 10px; color: var(--primary-color); } .subject-name { font-weight: 500; text-align: center; } .selected-subjects-display { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; justify-content: center; } .selected-subject-chip { background-color: var(--primary-color); color: white; padding: 8px 15px; border-radius: 20px; display: flex; align-items: center; gap: 8px; } .selected-subject-chip i { cursor: pointer; } /* Responsive styles */ @media (max-width: 768px) { .container { padding: 20px; } h1 { font-size: 1.8rem; } .chapter-list { columns: 1; } .navigation-buttons { flex-direction: column; } .btn { width: 100%; margin: 5px 0; } .question { padding: 15px; } .graphics-section { gap: 10px; } .graphic-card { width: 120px; padding: 15px; } .subject-card { width: 120px; height: 120px; } } @media (max-width: 480px) { body { padding: 10px; } .container { padding: 15px; } h1 { font-size: 1.5rem; } .score { font-size: 2rem; } .graphic-card { width: 100px; padding: 10px; } .graphic-icon { font-size: 2rem; } .subject-card { width: 100px; height: 100px; } .subject-icon { font-size: 2rem; } } </style> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4930137336556867" crossorigin="anonymous"></script> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-KMZ9RJ62EY"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-KMZ9RJ62EY'); </script> </head> <body> <div class="container"> <h1>NEET Physics Section Test</h1> <!-- Subject Selection Screen --> <div id="subject-selection"> <h2>Select Physics Chapters</h2> <p>Select one or more chapters to include in your Physics exam</p> <div class="subject-selection-container"> <div class="subject-card selected" data-subject="Physics"> <div class="subject-icon"><i class="fas fa-atom"></i></div> <div class="subject-name">Physics</div> </div> </div> <div class="selected-subjects-display" id="selected-subjects-display"> <div class="selected-subject-chip"> Physics </div> </div> <!-- Graphics Section --> <div class="graphics-section"> <div class="graphic-card"> <div class="graphic-icon"><i class="fas fa-brain"></i></div> <div class="graphic-title">Concept Testing</div> </div> <div class="graphic-card"> <div class="graphic-icon"><i class="fas fa-stopwatch"></i></div> <div class="graphic-title">Timed Exams</div> </div> <div class="graphic-card"> <div class="graphic-icon"><i class="fas fa-chart-line"></i></div> <div class="graphic-title">Performance Analysis</div> </div> <div class="graphic-card"> <div class="graphic-icon"><i class="fas fa-book"></i></div> <div class="graphic-title">Chapter-wise</div> </div> <div class="graphic-card"> <div class="graphic-icon"><i class="fas fa-trophy"></i></div> <div class="graphic-title">Competitive Edge</div> </div> </div> <div class="slogan"> "Test Your Physics Knowledge, Master Key Concepts, Achieve Your NEET Goals" </div> <center> <button id="subject-next" class="btn">Next</button> </center> </div> <!-- Chapter Selection (Hidden Initially) --> <div id="chapter-selection" class="hidden"> <div class="chapter-selection-container"> <h2>Select Physics Chapters</h2> <p>Select one or more chapters to include in your Physics exam</p> <hr class="divider"> <div id="chapter-list" class="chapter-list"></div> </div> <div class="chapter-next-btn"> <button id="chapter-next" class="btn">Next</button> </div> </div> <!-- Exam Configuration (Hidden Initially) --> <div id="exam-configuration" class="hidden"> <div class="selected-chapters-display"> <h3>Selected Subject: <span id="display-subjects">Physics</span></h3> <h4>Selected Chapters:</h4> <div id="selected-chapters-list"></div> </div> <div class="exam-type-selection"> <h2>Select Exam Type</h2> <div class="marks-list"> <label><input type="radio" name="exam-type" value="10" checked> TEST TYPE I - 10 Questions, 10 Minutes, 10 Marks</label> <label><input type="radio" name="exam-type" value="20"> TEST TYPE II - 15 Questions, 15 Minutes, 15 Marks</label> <label><input type="radio" name="exam-type" value="30"> TEST TYPE III - 20 Questions, 20 Minutes, 20 Marks</label> </div> <center> <button id="load-quiz" class="btn btn-success">Start Physics Exam</button> </center> </div> </div> <!-- Exam Screen (Hidden Initially) --> <div id="exam-screen" class="hidden"> <center> <div id="timer"> <i class="fas fa-clock"></i> Time remaining: <span id="time"></span> </div> </center> <div id="quiz"></div> <div class="navigation-buttons"> <button id="previous" class="btn btn-secondary">Previous</button> <button id="next" class="btn btn-secondary">Next</button> </div> <center> <button id="submit" class="btn btn-danger">Submit Physics Exam</button> </center> </div> <!-- Results Screen (Hidden Initially) --> <div id="results" class="hidden"></div> <div id="summary" class="hidden"></div> </div> <script> const subjects = { Physics: [ "Chapter 1: Units and Measurement", "Chapter 2: Motion in a Straight Line", "Chapter 3: Motion in a Plane", "Chapter 4: Laws of Motion", "Chapter 5: Work, Energy and Power", "Chapter 6: System of Particles and Rotational Motion", "Chapter 7: Gravitation", "Chapter 8: Mechanical Properties of Solids", "Chapter 9: Mechanical Properties of Fluids", "Chapter 10: Thermal Properties of Matter", "Chapter 11: Thermodynamics", "Chapter 12: Kinetic Theory", "Chapter 13: Oscillations", "Chapter 14: Waves", "Chapter 15: Electric Charge and Fields", "Chapter 16: Electrostatic Potential and Capacitance", "Chapter 17: Current Electricity", "Chapter 18: Moving Charges and Magnetism", "Chapter 19: Magnetism and Matter", "Chapter 20: Electromagnetic Induction", "Chapter 21: Alternating Current", "Chapter 22: Electromagnetic Wave", "Chapter 23: Ray Optics and Optical Instruments", "Chapter 24: Wave Optics", "Chapter 25: Dual Nature of Radiation and Matter", "Chapter 26: Atoms", "Chapter 27: Nuclei", "Chapter 28: Semiconductor Electronics, Materials, Devices and Simple Circuits" ] }; const questions = { "Chapter 1: Units and Measurement": [ { question: "Which of the following is a fundamental unit?", options: ["Newton", "Joule", "Second", "Watt"], answer: "Second" }, { question: "The dimensional formula for force is:", options: ["[MLT^-2]", "[ML^2T^-2]", "[MLT^-1]", "[ML^2T^-1]"], answer: "[MLT^-2]" }, { question: "Which of the following is not a unit of length?", options: ["Parsec", "Light year", "Angstrom", "Newton"], answer: "Newton" }, { question: "The number of significant figures in 0.0025 is:", options: ["1", "2", "3", "4"], answer: "2" } ], "Chapter 2: Motion in a Straight Line": [ { question: "What is the SI unit of acceleration?", options: ["m/s", "m/s²", "m²/s", "m/s³"], answer: "m/s²" }, { question: "A body is moving with uniform velocity. Its acceleration is:", options: ["Zero", "Constant", "Increasing", "Decreasing"], answer: "Zero" }, { question: "The slope of a velocity-time graph gives:", options: ["Distance", "Displacement", "Acceleration", "Speed"], answer: "Acceleration" } ], "Chapter 3: Motion in a Plane": [ { question: "The path of a projectile is:", options: ["Straight line", "Circle", "Parabola", "Hyperbola"], answer: "Parabola" }, { question: "For a projectile, the horizontal range is maximum when the angle of projection is:", options: ["30°", "45°", "60°", "90°"], answer: "45°" } ], "Chapter 4: Laws of Motion": [ { question: "Newton's first law of motion is also called:", options: ["Law of inertia", "Law of momentum", "Law of force", "Law of acceleration"], answer: "Law of inertia" }, { question: "The SI unit of force is:", options: ["Joule", "Newton", "Watt", "Pascal"], answer: "Newton" } ], "Chapter 5: Work, Energy and Power": [ { question: "The SI unit of work is:", options: ["Newton", "Joule", "Watt", "Pascal"], answer: "Joule" }, { question: "Power is defined as:", options: ["Force × velocity", "Work/time", "Energy/time", "Both B and C"], answer: "Both B and C" } ], "Chapter 6: System of Particles and Rotational Motion": [ { question: "The moment of inertia depends on:", options: ["Mass distribution", "Axis of rotation", "Both A and B", "Neither A nor B"], answer: "Both A and B" } ], "Chapter 7: Gravitation": [ { question: "The value of acceleration due to gravity:", options: ["Increases with height", "Decreases with height", "Remains constant", "First increases then decreases"], answer: "Decreases with height" } ], "Chapter 8: Mechanical Properties of Solids": [ { question: "Young's modulus is the ratio of:", options: ["Stress to strain", "Strain to stress", "Force to area", "Area to force"], answer: "Stress to strain" } ], "Chapter 9: Mechanical Properties of Fluids": [ { question: "Pascal's law is applicable to:", options: ["Solids", "Liquids", "Gases", "Both B and C"], answer: "Both B and C" } ], "Chapter 10: Thermal Properties of Matter": [ { question: "The SI unit of specific heat capacity is:", options: ["J kg{ ¹ K{ ¹", "J kg K", "J kg{ ¹", "J K{ ¹"], answer: "J kg{ ¹ K{ ¹" } ], "Chapter 11: Thermodynamics": [ { question: "The first law of thermodynamics is based on:", options: ["Conservation of momentum", "Conservation of energy", "Conservation of mass", "Conservation of charge"], answer: "Conservation of energy" } ], "Chapter 12: Kinetic Theory": [ { question: "The average kinetic energy of gas molecules is proportional to:", options: ["Pressure", "Volume", "Absolute temperature", "Density"], answer: "Absolute temperature" } ], "Chapter 13: Oscillations": [ { question: "The time period of a simple pendulum depends on:", options: ["Mass of bob", "Length of pendulum", "Material of bob", "Amplitude of oscillation"], answer: "Length of pendulum" } ], "Chapter 14: Waves": [ { question: "Sound waves are:", options: ["Transverse", "Longitudinal", "Electromagnetic", "None of these"], answer: "Longitudinal" } ], "Chapter 15: Electric Charge and Fields": [ { question: "Which one of the following is the unit of electric field?", options: ["Coulomb", "Newton", "Volt", "N/C"], answer: "N/C" }, { question: "The surface considered for Gauss's law is called", options: ["Closed surface", "Spherical surface", "Gaussian surface", "Plane surface"], answer: "Gaussian surface" } ], "Chapter 16: Electrostatic Potential and Capacitance": [ { question: "The SI unit of capacitance is:", options: ["Ohm", "Farad", "Henry", "Tesla"], answer: "Farad" } ], "Chapter 17: Current Electricity": [ { question: "Ohm's law states that:", options: ["V " I", "V " 1/I", "I " R", "R " V"], answer: "V " I" } ], "Chapter 18: Moving Charges and Magnetism": [ { question: "The SI unit of magnetic field is:", options: ["Weber", "Tesla", "Henry", "Gauss"], answer: "Tesla" } ], "Chapter 19: Magnetism and Matter": [ { question: "The magnetic moment of a current loop is:", options: ["IA", "I/A", "I²A", "I/A²"], answer: "IA" } ], "Chapter 20: Electromagnetic Induction": [ { question: "Faraday's law relates induced emf to:", options: ["Change in current", "Change in resistance", "Change in magnetic flux", "Change in charge"], answer: "Change in magnetic flux" } ], "Chapter 21: Alternating Current": [ { question: "The rms value of AC is related to peak value by:", options: ["I_rms = I_0/"2", "I_rms = I_0"2", "I_rms = I_0/2", "I_rms = I_0"], answer: "I_rms = I_0/"2" } ], "Chapter 22: Electromagnetic Wave": [ { question: "Which of the following has the shortest wavelength?", options: ["Radio waves", "Microwaves", "X-rays", "Gamma rays"], answer: "Gamma rays" } ], "Chapter 23: Ray Optics and Optical Instruments": [ { question: "The power of a lens is measured in:", options: ["Joule", "Watt", "Dioptre", "Newton"], answer: "Dioptre" } ], "Chapter 24: Wave Optics": [ { question: "In Young's double slit experiment, the fringe width is:", options: ["Directly proportional to wavelength", "Inversely proportional to wavelength", "Independent of wavelength", "Proportional to square of wavelength"], answer: "Directly proportional to wavelength" } ], "Chapter 25: Dual Nature of Radiation and Matter": [ { question: "The photoelectric effect demonstrates:", options: ["Wave nature of light", "Particle nature of light", "Both wave and particle nature", "None of these"], answer: "Particle nature of light" } ], "Chapter 26: Atoms": [ { question: "Rutherford's alpha particle scattering experiment led to the discovery of:", options: ["Electron", "Proton", "Atomic nucleus", "Neutron"], answer: "Atomic nucleus" } ], "Chapter 27: Nuclei": [ { question: "The nuclear force is:", options: ["Strong and short range", "Weak and short range", "Strong and long range", "Weak and long range"], answer: "Strong and short range" } ], "Chapter 28: Semiconductor Electronics, Materials, Devices and Simple Circuits": [ { question: "A p-n junction diode allows current to flow:", options: ["In both directions", "Only in forward bias", "Only in reverse bias", "In no direction"], answer: "Only in forward bias" } ] }; let selectedChapters = []; let selectedMarks = 0; let quizQuestions = []; let currentQuestionIndex = 0; let timer; let timeLeft; let selectedSubjects = ["Physics"]; let allSelectedChapters = {}; // Automatically select Physics document.addEventListener('DOMContentLoaded', function() { document.querySelector('.subject-card').classList.add('selected'); updateSelectedSubjectsDisplay(); }); function updateSelectedSubjectsDisplay() { const display = document.getElementById('selected-subjects-display'); display.innerHTML = ''; selectedSubjects.forEach(subject => { const chip = document.createElement('div'); chip.className = 'selected-subject-chip'; chip.innerHTML = ` ${subject} `; display.appendChild(chip); }); } document.getElementById('subject-next').addEventListener('click', function() { // Populate chapters for Physics const chapterList = document.getElementById('chapter-list'); chapterList.innerHTML = ''; selectedSubjects.forEach(subject => { const subjectHeader = document.createElement('h3'); subjectHeader.textContent = subject; chapterList.appendChild(subjectHeader); subjects[subject].forEach(chapter => { const div = document.createElement('div'); div.className = 'option'; const checkbox = document.createElement('input'); checkbox.type = 'checkbox'; checkbox.value = chapter; checkbox.id = chapter; checkbox.dataset.subject = subject; const label = document.createElement('label'); label.htmlFor = chapter; label.textContent = chapter; div.appendChild(checkbox); div.appendChild(label); chapterList.appendChild(div); }); }); // Show chapter selection and hide subject selection document.getElementById('subject-selection').classList.add('hidden'); document.getElementById('chapter-selection').classList.remove('hidden'); }); document.getElementById('chapter-next').addEventListener('click', function() { // Get selected chapters const chapterCheckboxes = document.querySelectorAll('#chapter-list input[type="checkbox"]'); selectedChapters = Array.from(chapterCheckboxes) .filter(cb => cb.checked) .map(cb => cb.value); if (selectedChapters.length === 0) { alert('Please select at least one chapter to continue.'); return; } // Group chapters by subject for display allSelectedChapters = {}; selectedChapters.forEach(chapter => { const subject = document.querySelector(`input[value="${chapter}"]`).dataset.subject; if (!allSelectedChapters[subject]) { allSelectedChapters[subject] = []; } allSelectedChapters[subject].push(chapter); }); // Update display document.getElementById('display-subjects').textContent = selectedSubjects.join(', '); const selectedChaptersList = document.getElementById('selected-chapters-list'); selectedChaptersList.innerHTML = ''; for (const subject in allSelectedChapters) { const subjectDiv = document.createElement('div'); subjectDiv.innerHTML = `<strong>${subject}:</strong>`; selectedChaptersList.appendChild(subjectDiv); allSelectedChapters[subject].forEach(chapter => { const chip = document.createElement('span'); chip.className = 'selected-chapter'; chip.textContent = chapter; selectedChaptersList.appendChild(chip); }); } // Show exam configuration and hide chapter selection document.getElementById('chapter-selection').classList.add('hidden'); document.getElementById('exam-configuration').classList.remove('hidden'); }); document.getElementById('load-quiz').addEventListener('click', function() { const selectedExamType = document.querySelector('input[name="exam-type"]:checked'); if (selectedChapters.length > 0 && selectedExamType) { selectedMarks = parseInt(selectedExamType.value); quizQuestions = []; // Gather questions from selected chapters selectedChapters.forEach(chapter => { if (questions[chapter]) { quizQuestions = quizQuestions.concat(questions[chapter]); } }); // Shuffle questions and select based on test type quizQuestions = quizQuestions.sort(() => Math.random() - 0.5) .slice(0, selectedMarks); if (quizQuestions.length === 0) { alert('No questions available for selected chapters. Please try different chapters.'); return; } // Start the exam currentQuestionIndex = 0; document.getElementById('exam-configuration').classList.add('hidden'); document.getElementById('exam-screen').classList.remove('hidden'); displayQuestion(); startTimer(); } }); function displayQuestion() { const quizDiv = document.getElementById('quiz'); quizDiv.innerHTML = ''; const currentQuestion = quizQuestions[currentQuestionIndex]; const questionElement = document.createElement('div'); questionElement.className = 'question'; questionElement.innerHTML = ` <p>Question ${currentQuestionIndex + 1} of ${quizQuestions.length}</p> <p>${currentQuestion.question}</p> `; currentQuestion.options.forEach((option, index) => { const optionDiv = document.createElement('div'); optionDiv.className = 'option'; const radio = document.createElement('input'); radio.type = 'radio'; radio.name = 'option'; radio.id = `option-${currentQuestionIndex}-${index}`; radio.value = option; radio.checked = currentQuestion.selectedOption === option; const label = document.createElement('label'); label.htmlFor = `option-${currentQuestionIndex}-${index}`; label.textContent = option; optionDiv.appendChild(radio); optionDiv.appendChild(label); questionElement.appendChild(optionDiv); }); quizDiv.appendChild(questionElement); updateNavigationButtons(); } function updateNavigationButtons() { document.getElementById('previous').classList.toggle('hidden', currentQuestionIndex === 0); document.getElementById('next').classList.toggle('hidden', currentQuestionIndex === quizQuestions.length - 1); } document.getElementById('previous').addEventListener('click', function() { saveAnswer(); if (currentQuestionIndex > 0) { currentQuestionIndex--; displayQuestion(); } }); document.getElementById('next').addEventListener('click', function() { saveAnswer(); if (currentQuestionIndex < quizQuestions.length - 1) { currentQuestionIndex++; displayQuestion(); } }); document.getElementById('submit').addEventListener('click', function() { if (confirm('Are you sure you want to submit your Physics exam?')) { saveAnswer(); clearInterval(timer); showResults(); } }); function saveAnswer() { const selectedOption = document.querySelector('#quiz input[name="option"]:checked'); if (selectedOption) { quizQuestions[currentQuestionIndex].selectedOption = selectedOption.value; } } function startTimer() { timeLeft = selectedMarks === 10 ? 600 : selectedMarks === 20 ? 900 : 1200; updateTimerDisplay(); timer = setInterval(function() { timeLeft--; updateTimerDisplay(); if (timeLeft <= 0) { clearInterval(timer); alert('Time is up! Your Physics exam will be submitted automatically.'); showResults(); } }, 1000); } function updateTimerDisplay() { const timeElement = document.getElementById('time'); timeElement.textContent = formatTime(timeLeft); // Change color based on remaining time if (timeLeft <= 60) { timeElement.className = 'danger'; } else if (timeLeft <= 180) { timeElement.className = 'warning'; } else { timeElement.className = ''; } } function formatTime(seconds) { const minutes = Math.floor(seconds / 60); const secs = seconds % 60; return `${minutes}:${secs < 10 ? '0' : ''}${secs}`; } function showResults() { // Calculate results const correctCount = quizQuestions.reduce((acc, q) => acc + (q.selectedOption === q.answer ? 1 : 0), 0); const percentage = Math.round((correctCount / quizQuestions.length) * 100); // Hide exam screen document.getElementById('exam-screen').classList.add('hidden'); // Display results card const resultsDiv = document.getElementById('results'); resultsDiv.innerHTML = ` <div class="results-card"> <h2>Physics Exam Results</h2> <p>Subject: Physics</p> <div class="score">${correctCount}/${quizQuestions.length}</div> <div class="progress-container"> <div class="progress-bar" style="width: ${percentage}%"></div> </div> <p>You scored ${percentage}%</p> <button id="view-details" class="btn">View Detailed Results</button> </div> `; // Show results resultsDiv.classList.remove('hidden'); // Prepare summary const summaryDiv = document.getElementById('summary'); summaryDiv.innerHTML = ` <h3>Physics Exam Summary</h3> <p>Total questions: ${quizQuestions.length}</p> <p>Attempted: ${quizQuestions.filter(q => q.selectedOption).length}</p> <p>Correct answers: ${correctCount}</p> <p>Incorrect answers: ${quizQuestions.filter(q => q.selectedOption && q.selectedOption !== q.answer).length}</p> <p>Unattempted: ${quizQuestions.filter(q => !q.selectedOption).length}</p> `; // Add detailed question review quizQuestions.forEach((q, index) => { const questionDiv = document.createElement('div'); questionDiv.className = 'summary-item'; let statusClass = ''; if (q.selectedOption === q.answer) { statusClass = 'user-correct'; } else if (q.selectedOption && q.selectedOption !== q.answer) { statusClass = 'user-incorrect'; } questionDiv.innerHTML = ` <p><strong>Question ${index + 1}:</strong> ${q.question}</p> <p class="${statusClass}">Your answer: ${q.selectedOption || 'Not attempted'}</p> <p class="correct-answer">Correct answer: ${q.answer}</p> `; summaryDiv.appendChild(questionDiv); }); // Show details button functionality document.getElementById('view-details').addEventListener('click', function() { summaryDiv.classList.toggle('hidden'); this.textContent = summaryDiv.classList.contains('hidden') ? 'View Detailed Results' : 'Hide Detailed Results'; }); } </script> </body> </html>