← Class 6
HomeClass 6Practice Generator
Home Class 6 Class 9 Practice Competitive About
Practice Questions
Configure options on the left and generate a Bloom's-tagged practice questions instantly.
📋
No questions yet
Select a class, subject, and chapters,
then click Generate to create your practice questions.
Time remaining
00:00
Timed Test
`); win.document.close(); } /* ── TIMED TEST ── */ function showState(state){ var states = ['empty-state','progress-state','results-state','error-state','timed-test-wrapper','score-screen']; states.forEach(function(s){ var el = document.getElementById(s); if(!el) return; if(s === 'timed-test-wrapper' || s === 'score-screen'){ el.style.display = (s === state) ? 'block' : 'none'; } else { el.style.display = (s === state) ? '' : 'none'; } }); } function renderTimedTest(){ showState('timed-test-wrapper'); totalSeconds = selectedTimerMins * 60; remainingSeconds = totalSeconds; testStartTime = Date.now(); studentAnswers = {}; document.getElementById('timer-meta-title').textContent = (currentMeta.class||'') + ' - ' + (currentMeta.subject||''); document.getElementById('timer-meta-sub').textContent = questions.length + ' questions - ' + selectedTimerMins + ' min'; var el = document.getElementById('test-questions'); el.innerHTML = ''; var pillsEl = document.getElementById('test-pills'); pillsEl.innerHTML = ''; questions.forEach(function(q, i){ var hasOpts = q.options && Object.keys(q.options).length > 0; var bc = bloomColors[q.bloomLevel] || {color:'var(--ink-muted)',bg:'var(--cream)',name:q.bloomLevel}; var optsHtml = ''; if(q.type === 'SA' || q.type === 'FIB'){ optsHtml = ''; } else if(hasOpts){ optsHtml = '
' + Object.entries(q.options).map(function(entry){ var letter = entry[0]; var text = entry[1]; return '
' + letter + '
' + text + '
'; }).join('') + '
'; } el.innerHTML += '
' + '
Q' + (i+1) + ' of ' + questions.length + '' + '' + q.bloomLevel + ' - ' + (q.bloomName||bc.name||'') + ' - ' + q.type + '
' + '
' + q.question + '
' + optsHtml + '
'; var pill = document.createElement('div'); pill.className = 'q-pill'; pill.id = 'pill-' + i; pill.textContent = i + 1; pill.onclick = (function(idx){ return function(){ document.getElementById('tqc-'+idx).scrollIntoView({behavior:'smooth',block:'center'}); }; })(i); pillsEl.appendChild(pill); }); startTimer(); } function selectOpt(qIdx, letter){ var q = questions[qIdx]; if(q.options){ Object.keys(q.options).forEach(function(l){ var o=document.getElementById('topt-'+qIdx+'-'+l); if(o) o.classList.remove('selected'); }); } var el = document.getElementById('topt-' + qIdx + '-' + letter); if(el) el.classList.add('selected'); studentAnswers[qIdx] = letter; markPillAnswered(qIdx); } function markPillAnswered(idx){ var pill = document.getElementById('pill-' + idx); if(pill) pill.classList.add('answered'); } function startTimer(){ updateTimerDisplay(); timerInterval = setInterval(function(){ remainingSeconds--; updateTimerDisplay(); if(remainingSeconds <= 0){ clearInterval(timerInterval); submitTest(true); } }, 1000); } function stopTimer(){ if(timerInterval){ clearInterval(timerInterval); timerInterval = null; } } function updateTimerDisplay(){ var mins = Math.floor(remainingSeconds/60); var secs = remainingSeconds % 60; var display = (mins<10?'0':'')+mins+':'+(secs<10?'0':'')+secs; var el = document.getElementById('timer-display'); el.textContent = display; el.className = 'timer-display'; if(remainingSeconds <= 60) el.classList.add('danger'); else if(totalSeconds > 0 && remainingSeconds <= totalSeconds * 0.25) el.classList.add('warning'); var pct = totalSeconds > 0 ? (remainingSeconds/totalSeconds)*100 : 0; document.getElementById('timer-progress-fill').style.width = pct + '%'; } function submitTest(timeUp){ stopTimer(); var timeTaken = Math.round((Date.now() - testStartTime) / 1000); var correct = 0, wrong = 0; questions.forEach(function(q, i){ if(q.type === 'SA' || q.type === 'FIB'){ var inp = document.getElementById('ans-' + i); if(inp && inp.value.trim()) correct++; } else { if(studentAnswers[i] === q.correctAnswer) correct++; else if(studentAnswers[i]) wrong++; } }); var total = questions.length; var pct = Math.round((correct/total)*100); document.getElementById('timed-test-wrapper').style.display = 'none'; document.getElementById('score-screen').style.display = 'block'; document.getElementById('review-section').style.display = 'none'; var scoreEl = document.getElementById('score-pct'); scoreEl.textContent = pct + '%'; scoreEl.style.color = pct>=80?'var(--green)':pct>=50?'var(--amber)':'var(--red)'; var msg = timeUp ? 'Time is up! ' : ''; msg += pct>=80?'Excellent — outstanding performance!':pct>=60?'Good work — review the missed questions.':pct>=40?'Fair — go back and revise weak concepts.':'Keep practising and revising!'; document.getElementById('score-msg').textContent = msg + ' (' + correct + '/' + total + ' correct)'; document.getElementById('sc-correct').textContent = correct; document.getElementById('sc-wrong').textContent = wrong; var m = Math.floor(timeTaken/60), s = timeTaken%60; document.getElementById('sc-time').textContent = (m<10?'0':'')+m+':'+(s<10?'0':'')+s; window.scrollTo(0,0); } function abandonTest(){ stopTimer(); showState('empty-state'); } function retakeTest(){ document.getElementById('score-screen').style.display = 'none'; studentAnswers = {}; renderTimedTest(); } function showReview(){ var el = document.getElementById('review-list'); el.innerHTML = ''; questions.forEach(function(q,i){ var sAns = studentAnswers[i] || null; var isCorrect = sAns === q.correctAnswer; var bc = bloomColors[q.bloomLevel]||{color:'var(--ink-muted)',bg:'var(--cream)',name:q.bloomLevel}; var hasOpts = q.options && Object.keys(q.options).length > 0; var optsHtml = ''; if(hasOpts){ optsHtml = '
' + Object.entries(q.options).map(function(entry){ var l=entry[0]; var t=entry[1]; var extra = (l===q.correctAnswer?' correct':'') + (l===sAns&&l!==q.correctAnswer?' wrong':''); return '
' + l + '.' + t + (l===q.correctAnswer?' checkmark':'') + (l===sAns&&l!==q.correctAnswer?' (your answer)':'') + '
'; }).join('') + '
'; } else if(q.correctAnswer){ optsHtml = '
Correct answer: ' + q.correctAnswer + '
'; } el.innerHTML += '
' + '
' + '
Q'+(i+1)+'
' + q.question + '
' + '
'+q.bloomLevel+'' + ''+( isCorrect?'Correct':'Wrong')+'
' + '
' + optsHtml + '
Explanation
'+(q.explanation||'')+'
' + '
Concept: '+(q.concept||'')+'
'; }); document.getElementById('review-section').style.display = 'block'; document.getElementById('review-section').scrollIntoView({behavior:'smooth'}); } function startTimedTestFromResults(){ if(!questions.length) return; renderTimedTest(); }