Molecular Structure and Bonding Test 1
Molecular Structure and Bonding Test
QUAIDIANPOINT — Kamran King’s Strategy Module
Student Registration
${q.text}
Rationale (Kamran King Strategy): ${q.rationale}
`; questionsContainer.appendChild(qCard); });
}
// Option Selection & Immediate Feedback Rationale
function selectOption(qIdx, optIdx) { if (userAnswers[qIdx] !== undefined) return; // Prevent changing once answered userAnswers[qIdx] = optIdx; const q = questions[qIdx]; const optionsContainer = document.getElementById(`options-${qIdx}`); const buttons = optionsContainer.getElementsByClassName('option-btn'); const rationaleDiv = document.getElementById(`rationale-${qIdx}`); // Disable all option buttons for this question for (let btn of buttons) { btn.disabled = true; } // Apply High-Contrast Feedback Colors if (optIdx === q.correct) { buttons[optIdx].classList.add('correct'); } else { buttons[optIdx].classList.add('incorrect'); buttons[q.correct].classList.add('correct'); // Highlight correct answer } // Reveal Rationale Immediately rationaleDiv.style.display = 'block';
}
// Timer Functionality
function startTimer() { timerInterval = setInterval(() => { timeRemaining--; let mins = Math.floor(timeRemaining / 60); let secs = timeRemaining % 60; timerDisplay.textContent = `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`; if (timeRemaining <= 0) { clearInterval(timerInterval); alert("Time is up! Submitting your assessment automatically."); submitQuiz(); } }, 1000);
}
// Submit Quiz
submitBtn.addEventListener('click', function() { if (Object.keys(userAnswers).length < questions.length) { if (!confirm(`You have answered ${Object.keys(userAnswers).length} of 40 questions. Are you sure you want to submit?`)) { return; } } submitQuiz();
});
function submitQuiz() { clearInterval(timerInterval); let score = 0; questions.forEach((q, idx) => { if (userAnswers[idx] === q.correct) { score++; } }); const timeSpentSeconds = (40 * 60) - timeRemaining; const minsSpent = Math.floor(timeSpentSeconds / 60); const secsSpent = timeSpentSeconds % 60; quizSection.classList.add('hidden'); resultsCard.classList.remove('hidden'); document.getElementById('final-score').textContent = `${score} / 40`; document.getElementById('time-taken-text').textContent = `Time Taken: ${minsSpent} minute(s) and ${secsSpent} second(s).`; window.scrollTo({ top: 0, behavior: 'smooth' });
}