NEET Biology Challenge Set 1 | Willer Academy

NEET Biology Challenge Set 1

NEET Biology MCQ Set 1

Candidate:
Time: 60:00
Progress 0/100

    Test Results

    0%

    Correct Answers: 0

    Incorrect Answers: 0

    Total Questions: 100

    Accuracy: 0%

    Time Taken: 60:00

    ...Array.from({length: 80}, (_,i) => ({ q: `PYQ-style NEET Biology MCQ #${i+21}`, opts: [`Option A`, `Option B`, `Option C`, `Option D`], ans: 1, exp: `Correct answer is Option B for question #${i+21}. This is consistent with NCERT and PYQ analysis.` })) ]; // State Variables let currentQ = 0; let userAnswers = new Array(questions.length).fill(null); let timerInterval; let startTime; let totalTime = 60 * 60; // 60 minutes in seconds // DOM Elements const accessScreen = document.getElementById('accessScreen'); const quizScreen = document.getElementById('quiz'); const resultScreen = document.getElementById('result'); const candidateNameSpan = document.getElementById('candidateName'); const accessCodeInput = document.getElementById('accessCodeInput'); const nameInput = document.getElementById('nameInput'); const accessError = document.getElementById('accessError'); const timerDisplay = document.getElementById('timer'); const progressText = document.getElementById('progressText'); const progressFill = document.getElementById('progressFill'); const timeTakenSpan = document.getElementById('timeTaken'); // Quiz Elements const qtext = document.getElementById('qtext'); const optionsList = document.getElementById('optionsList'); const prevBtn = document.getElementById('prevBtn'); const nextBtn = document.getElementById('nextBtn'); const pagination = document.getElementById('pagination'); const submitQuizBtn = document.getElementById('submitQuiz'); const scorePercent = document.getElementById('scorePercent'); const correctCountSpan = document.getElementById('correctCount'); const incorrectCountSpan = document.getElementById('incorrectCount'); const accuracyPercent = document.getElementById('accuracyPercent'); const reviewAnswersBtn = document.getElementById('reviewAnswers'); const answerReviewDiv = document.getElementById('answerReview'); // Start Test Button Handler document.getElementById('startBtn').addEventListener('click', () => { const code = accessCodeInput.value.trim(); const name = nameInput.value.trim(); if (!code || !name) { accessError.textContent = 'Please enter both access code and full name.'; return; } accessError.textContent = ''; candidateNameSpan.textContent = name; accessScreen.style.display = 'none'; quizScreen.style.display = 'block'; // Start the timer startTime = new Date(); startTimer(); renderQuestion(); renderPagination(); updateProgress(); }); // Timer function function startTimer() { let remaining = totalTime; timerInterval = setInterval(() => { remaining--; if (remaining <= 0) { clearInterval(timerInterval); showResult(); return; } const minutes = Math.floor(remaining / 60); const seconds = remaining % 60; timerDisplay.textContent = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`; }, 1000); } function stopTimer() { clearInterval(timerInterval); const endTime = new Date(); const timeTaken = Math.floor((endTime - startTime) / 1000); const minutes = Math.floor(timeTaken / 60); const seconds = timeTaken % 60; timeTakenSpan.textContent = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`; } // Render current question function renderQuestion() { const q = questions[currentQ]; qtext.textContent = `Q${currentQ + 1}. ${q.q}`; optionsList.innerHTML = q.opts.map((opt, i) => `
  • `).join(''); // Disable Previous button on first question prevBtn.disabled = (currentQ === 0); // Disable Next button on last question nextBtn.disabled = (currentQ === questions.length-1); // Update progress updateProgress(); } function updateProgress() { const answered = userAnswers.filter(ans => ans !== null).length; progressText.textContent = `${answered}/${questions.length}`; const percent = (answered / questions.length) * 100; progressFill.style.width = `${percent}%`; } optionsList.addEventListener('change', e => { if (e.target.name === 'option') { userAnswers[currentQ] = Number(e.target.value); renderPagination(); updateProgress(); // Auto-advance to next question on mobile if not last if (window.innerWidth <= 768 && currentQ < questions.length - 1) { setTimeout(() => { currentQ++; renderQuestion(); }, 500); } } }); prevBtn.addEventListener('click', () => { if (currentQ > 0) { currentQ--; renderQuestion(); scrollToQuestion(); } }); nextBtn.addEventListener('click', () => { if (currentQ < questions.length - 1) { currentQ++; renderQuestion(); scrollToQuestion(); } }); function scrollToQuestion() { document.getElementById('questionPanel').scrollIntoView({ behavior: 'smooth', block: 'start' }); } // Render pagination buttons with "answered" and "current" highlight function renderPagination() { pagination.innerHTML = ''; for (let i = 0; i < questions.length; i++) { const btn = document.createElement('button'); btn.textContent = i + 1; btn.classList.add(userAnswers[i] !== null ? 'answered' : ''); if (i === currentQ) btn.classList.add('current'); btn.addEventListener('click', () => { currentQ = i; renderQuestion(); scrollToQuestion(); }); pagination.appendChild(btn); } } // Submit Quiz handler submitQuizBtn.addEventListener('click', () => { // Confirm at least one question answered if (!userAnswers.some(ans => ans !== null)) { alert('You have not answered any question. Please attempt at least one or confirm submission.'); if (!confirm('Submit test with zero answers?')) return; } stopTimer(); showResult(); }); // Calculate and display result function showResult() { let correct = 0, incorrect = 0; for (let i = 0; i < questions.length; i++) { if (userAnswers[i] !== null) { if (userAnswers[i] === questions[i].ans) correct++; else incorrect++; } } quizScreen.style.display = 'none'; resultScreen.style.display = 'block'; const accuracy = Math.round(correct / questions.length * 100); scorePercent.textContent = accuracy + '%'; correctCountSpan.textContent = correct; incorrectCountSpan.textContent = incorrect; accuracyPercent.textContent = accuracy + '%'; answerReviewDiv.innerHTML = ''; } // Review detailed answers reviewAnswersBtn.addEventListener('click', () => { let html = '

    Answer Review

    '; for (let i = 0; i < questions.length; i++) { const q = questions[i]; const userAns = userAnswers[i]; html += `
    Q${i + 1}. ${q.q}
    `; html += '
      '; for (let j = 0; j < 4; j++) { let cls = ''; let indicator = ''; if (j === q.ans) { cls = 'style="background:#e1f7e1; border-color:#4caf50;"'; indicator = '✓ Correct'; } else if(j === userAns && j !== q.ans) { cls = 'style="background:#ffebee; border-color:#f44336;"'; indicator = '✗ Your Answer'; } html += `
    • ${String.fromCharCode(65 + j)}. ${q.opts[j]} ${indicator}
    • `; } html += '
    '; html += `
    Explanation: ${q.exp}
    `; } answerReviewDiv.innerHTML = html; answerReviewDiv.scrollIntoView({behavior: "smooth"}); });

    Comments

    subscribe

    Popular posts from this blog