WILLER SELECT
NEET Chemistry Test Series
Basic Concepts of Chemistry - Test Set 1
Multiple Choice Question (Single Correct)
Question 1 of 100
Explanation & Solution
Test Performance Summary
0
Correct Answers
0
Incorrect Answers
0
Attempted
00:00
Time Taken
${questions[index].text}
`; // Update options const optionsContainer = document.getElementById('options-container'); optionsContainer.innerHTML = ''; questions[index].options.forEach((option, optIndex) => { const optionEl = document.createElement('div'); optionEl.className = 'option'; if (answers[index] === optIndex) { optionEl.classList.add('selected'); } optionEl.innerHTML = ` ${String.fromCharCode(65 + optIndex)}${option}
`;
optionEl.addEventListener('click', () => selectOption(optIndex));
optionsContainer.appendChild(optionEl);
});
// Update explanation
document.getElementById('explanation-content').textContent = questions[index].explanation;
document.getElementById('explanation').classList.toggle('show', answers[index] !== null);
// Update question dots
updateQuestionDots();
// Update counts
updateCounts();
// Update progress bar
updateProgressBar();
}
// Select an option
function selectOption(optionIndex) {
answers[currentQuestion] = optionIndex;
// Update UI
const options = document.querySelectorAll('#options-container .option');
options.forEach((opt, idx) => {
opt.classList.toggle('selected', idx === optionIndex);
});
// Show explanation
document.getElementById('explanation').classList.add('show');
// Update question dots
updateQuestionDots();
// Update counts
updateCounts();
// Update progress bar
updateProgressBar();
}
// Mark current question for review
function markForReview() {
marked[currentQuestion] = !marked[currentQuestion];
updateQuestionDots();
updateCounts();
// Update button text
document.getElementById('mark-btn').innerHTML = marked[currentQuestion] ?
' Marked' :
' Mark for Review';
}
// Update question dots
function updateQuestionDots() {
const dots = document.querySelectorAll('.question-dot');
dots.forEach((dot, index) => {
dot.classList.remove('current', 'answered', 'marked');
if (index === currentQuestion) {
dot.classList.add('current');
}
if (answers[index] !== null) {
dot.classList.add('answered');
}
if (marked[index]) {
dot.classList.add('marked');
}
});
}
// Update counts in summary
function updateCounts() {
const answeredCount = answers.filter(a => a !== null).length;
const markedCount = marked.filter(m => m).length;
const correctCount = answers.reduce((count, ans, idx) => {
return ans === questions[idx].correct ? count + 1 : count;
}, 0);
document.getElementById('answered-count').textContent = answeredCount;
document.getElementById('marked-count').textContent = markedCount;
document.getElementById('score-display').textContent = (correctCount * 4) - ((answeredCount - correctCount) * 1);
}
// Update progress bar
function updateProgressBar() {
const progress = ((currentQuestion + 1) / questions.length) * 100;
document.getElementById('progress-bar').style.width = `${progress}%`;
}
// Start timer
function startTimer() {
const totalMinutes = 90;
let seconds = totalMinutes * 60;
timerInterval = setInterval(() => {
seconds--;
const minutes = Math.floor(seconds / 60);
const secs = seconds % 60;
document.getElementById('timer-display').textContent =
`${minutes.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
if (seconds <= 0) {
clearInterval(timerInterval);
submitTest();
}
}, 1000);
}
// Submit test
function submitTest() {
clearInterval(timerInterval);
// Calculate results
const answeredCount = answers.filter(a => a !== null).length;
const correctCount = answers.reduce((count, ans, idx) => {
return ans === questions[idx].correct ? count + 1 : count;
}, 0);
const incorrectCount = answeredCount - correctCount;
const score = (correctCount * 4) - (incorrectCount * 1);
// Calculate time taken
const endTime = Date.now();
const timeTaken = Math.floor((endTime - startTime) / 1000);
const minutes = Math.floor(timeTaken / 60);
const seconds = timeTaken % 60;
// Show results
document.getElementById('correct-count').textContent = correctCount;
document.getElementById('incorrect-count').textContent = incorrectCount;
document.getElementById('attempted-count').textContent = answeredCount;
document.getElementById('time-taken').textContent =
`${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
document.getElementById('performance-preview').style.display = 'block';
// Disable submit button
document.getElementById('submit-btn').innerHTML = ' Test Submitted';
document.getElementById('submit-btn').style.backgroundColor = '#64748b';
document.getElementById('submit-btn').style.pointerEvents = 'none';
}
// Navigation
document.getElementById('prev-btn').addEventListener('click', () => {
if (currentQuestion > 0) {
showQuestion(currentQuestion - 1);
}
});
document.getElementById('next-btn').addEventListener('click', () => {
if (currentQuestion < questions.length - 1) {
showQuestion(currentQuestion + 1);
}
});
document.getElementById('mark-btn').addEventListener('click', markForReview);
document.getElementById('submit-btn').addEventListener('click', submitTest);
// Initialize the test
window.onload = initTest;