HSSC CET हिन्दी प्रश्नोत्तरी (सेट 2)

HSSC CET Hindi Quiz (Set 2)

HSSC CET हिन्दी प्रश्नोत्तरी (सेट 2)

HSSC CET Hindi Quiz (Set 2)

50 प्रश्नों के साथ अपने हिन्दी ज्ञान का परीक्षण करें। आपके पास 15 मिनट हैं।

Test your Hindi knowledge with 50 questions. You have 15 minutes.

`; questionsContainer.appendChild(questionBlock); }); } function applyLanguage(lang) { selectedLanguage = lang; langSwitcher.value = lang; document.querySelectorAll('.lang-en, .lang-hi').forEach(el => { el.classList.add('hidden'); }); document.querySelectorAll(`.lang-${lang}`).forEach(el => { el.classList.remove('hidden'); }); } function showQuestion(index) { document.querySelectorAll('.question-block').forEach(el => el.classList.remove('active')); const questionToShow = document.querySelector(`.question-block[data-question-id="${index + 1}"]`); if(questionToShow) { questionToShow.classList.add('active'); questionCounter.innerHTML = `Questionप्रश्न ${index + 1} / ${quizData.length}`; progressBar.style.width = `${((index + 1) / quizData.length) * 100}%`; const inputs = questionToShow.querySelectorAll('.options input'); const explanationBox = questionToShow.querySelector('.explanation-box'); questionToShow.querySelectorAll('.options label').forEach(l => l.classList.remove('selected', 'correct', 'incorrect')); inputs.forEach(i => { i.checked = false; i.disabled = reviewMode; }); if (reviewMode) { explanationBox.classList.remove('hidden'); const userAnswer = userAnswers[index]; const correctValue = 'correct'; const correctInput = questionToShow.querySelector(`input[value="${correctValue}"]`); if (correctInput) correctInput.parentElement.classList.add('correct'); if (userAnswer && userAnswer !== correctValue) { const selectedInput = questionToShow.querySelector(`input[value="${userAnswer}"]`); if(selectedInput) selectedInput.parentElement.classList.add('incorrect'); } } else { explanationBox.classList.add('hidden'); if(userAnswers[index] !== null) { const savedAnswerInput = questionToShow.querySelector(`input[value="${userAnswers[index]}"]`); if(savedAnswerInput) { savedAnswerInput.checked = true; savedAnswerInput.parentElement.classList.add('selected'); } } } } updateNavButtons(); applyLanguage(selectedLanguage); } function updateNavButtons() { prevBtn.disabled = currentQuestionIndex === 0; submitBtn.classList.add('hidden'); nextBtn.classList.remove('hidden'); if(reviewMode){ nextBtn.innerHTML = `अगला →`; if (currentQuestionIndex === quizData.length - 1) { nextBtn.innerHTML = `समीक्षा समाप्त करें`; } } else { nextBtn.innerHTML = `अगला →`; if (currentQuestionIndex === quizData.length - 1) { nextBtn.classList.add('hidden'); submitBtn.classList.remove('hidden'); } } } function recordAnswer() { if (reviewMode) return; const currentQuestionBlock = document.querySelector(`.question-block.active`); if (!currentQuestionBlock) return; const selectedOption = currentQuestionBlock.querySelector(`input[name="q${currentQuestionIndex + 1}"]:checked`); userAnswers[currentQuestionIndex] = selectedOption ? selectedOption.value : null; } function startTimer() { timerInterval = setInterval(() => { timeLeft--; const minutes = Math.floor(timeLeft / 60); const seconds = timeLeft % 60; timerDisplay.textContent = `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`; if (timeLeft <= 0) { clearInterval(timerInterval); alert(selectedLanguage === 'en' ? 'Time is up! Your quiz has been submitted automatically.' : 'समय समाप्त! आपकी प्रश्नोत्तरी स्वचालित रूप से जमा कर दी गई है।'); showResults(); } }, 1000); } function showResults() { clearInterval(timerInterval); recordAnswer(); let correctCount = 0; userAnswers.forEach((answer) => { if (answer === 'correct') correctCount++; }); const score = correctCount; const totalMarks = quizData.length; document.getElementById('final-score').textContent = `${score} / ${totalMarks}`; const incorrectCount = userAnswers.filter(a => a !== null && a !== 'correct').length; const unattemptedCount = userAnswers.filter(a => a === null).length; const detailsEn = `Correct: ${correctCount} | Incorrect: ${incorrectCount} | Unattempted: ${unattemptedCount}
(+1 for each correct answer)`; const detailsHi = `सही: ${correctCount} | गलत: ${incorrectCount} | प्रयास नहीं किया: ${unattemptedCount}
(प्रत्येक सही उत्तर के लिए +1)`; document.getElementById('score-details').innerHTML = `${detailsEn}${detailsHi}`; resultModal.classList.remove('hidden'); resultModal.classList.add('show'); applyLanguage(selectedLanguage); } function handleNextQuestion() { if(reviewMode){ if (currentQuestionIndex < quizData.length - 1) { currentQuestionIndex++; showQuestion(currentQuestionIndex); } else { location.reload(); } return; } recordAnswer(); if (currentQuestionIndex < quizData.length - 1) { currentQuestionIndex++; showQuestion(currentQuestionIndex); } } function handlePrevQuestion() { recordAnswer(); if (currentQuestionIndex > 0) { currentQuestionIndex--; showQuestion(currentQuestionIndex); } } langSwitcher.addEventListener('change', (e) => applyLanguage(e.target.value)); startBtn.addEventListener('click', () => { welcomeScreen.classList.add('hidden'); quizArea.classList.remove('hidden'); showQuestion(0); startTimer(); }); nextBtn.addEventListener('click', handleNextQuestion); prevBtn.addEventListener('click', handlePrevQuestion); submitBtn.addEventListener('click', () => { recordAnswer(); const unattempted = userAnswers.filter(a => a === null).length; let confirmMsg = selectedLanguage === 'en' ? `Are you sure you want to submit? You have ${unattempted} unattempted questions.` : `क्या आप निश्चित रूप से जमा करना चाहते हैं? आपके ${unattempted} प्रश्नों का प्रयास नहीं किया गया है।`; if(unattempted > 0 && !confirm(confirmMsg)) { return; } showResults(); }); restartBtn.addEventListener('click', () => location.reload()); reviewBtn.addEventListener('click', () => { reviewMode = true; resultModal.classList.add('hidden'); resultModal.classList.remove('show'); currentQuestionIndex = 0; showQuestion(0); }); closeModalBtn.addEventListener('click', () => { resultModal.classList.add('hidden'); resultModal.classList.remove('show'); }); questionsContainer.addEventListener('change', (e) => { if(e.target.type === 'radio' && !reviewMode) { const qId = e.target.name.substring(1); const currentQuestionBlock = document.querySelector(`.question-block[data-question-id="${qId}"]`); currentQuestionBlock.querySelectorAll('.options label').forEach(l => l.classList.remove('selected')); e.target.parentElement.classList.add('selected'); } }); document.addEventListener('keydown', (e) => { if (!quizArea.classList.contains('hidden') && !resultModal.classList.contains('show')) { if (e.key === 'ArrowRight') nextBtn.click(); if (e.key === 'ArrowLeft') prevBtn.click(); } }); generateQuizHTML(); applyLanguage('hi'); });