.quiz-container {
font-family: “Roboto”, sans-serif;
max-width: 900px;
margin: 0 auto;
padding: 16px;
display: none;
color: #000;
}
.quiz-container .timer {
font-weight: bold;
text-align: right;
}
.timer.danger {
color: red;
}
.quiz-container h2.question {
font-size: 20px;
background: #d0ecff;
padding: 16px;
border-radius: 8px;
font-weight: normal;
line-height: 1.6;
}
.quiz-container .options {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px;
margin-bottom: 20px;
}
.quiz-container .option {
border: none;
padding: 24px 32px;
font-size: 18px;
background: #1d3557;
color: #fff;
}
.quiz-container button {
cursor: pointer;
}
.disabled {
pointer-events: none;
}
.option.correct {
background: #51e351;
color: #222;
}
.option.incorrect {
background: #e63946;
}
.quiz-container .next-btn,
.quiz-result .retake-btn {
background: #222;
color: #fff;
border: none;
padding: 12px 32px;
font-size: 20px;
text-transform: uppercase;
font-weight: bold;
letter-spacing: 3px;
cursor: pointer;
width: fit-content;
}
.quiz-result {
display: none;
flex-direction: column;
gap: 24px;
max-width: 900px;
margin: 0 auto;
font-family: “Roboto”, sans-serif;
padding: 16px;
color: #000;
}
.quiz-result .question-container {
padding: 12px;
border: 1px solid #eee;
display: flex;
flex-direction: column;
gap: 10px;
}
.quiz-result .question-container.incorrect {
background: #e63946;
color: #fff;
}
.question-number {
font-size: 16px;
margin-right: 16px;
background: #1d3557;
color: #fff;
padding: 8px;
border-radius: 8px;
}
@media (max-width: 700px) {
.quiz-container .options {
grid-template-columns: 1fr;
}
}
.start-btn-container {
font-family: “Roboto”, sans-serif;
display: flex;
flex-direction: column;
align-items: center;
color: #000;
}
.start-btn-container h2 {
font-size: 40px;
margin: 0;
}
.start-btn-container .start-btn {
background: #e63946;
color: #fff;
padding: 8px 32px;
border-radius: 8px;
border: none;
font-size: 24px;
cursor: pointer;
text-transform: uppercase;
font-weight: bold;
}
Dimasa GK MCQs
let quizData = [
{
question: “Who is the first Dimasa IPS officer?”,
options: [“Dr. Sujoy Lal Thaosen”, “Dr. Sanjay Lal Thaosen”, “Dr. J.L Thaosen”, “None of the above”],
correct: “Dr. Sanjay Lal Thaosen”,
},
{
question: “Who is the first CEM of Dima Hasao (NCHAC)?”,
options: [“Debolal Gorlosa”, “Daniel Langthasa”, “Juel Gorlosa”, “None of the above”],
correct: “None of the above”,
},
{
question:
“Who is the first Cabinet Minister of Assam govt. from Dimasa Community?”,
options: [
“Nandita Gorlosa”,
“Joy Bhadra Hagjer”,
“Ranu Langthasa”,
“Dilip Nunisa”,
],
correct: “Nandita Gorlosa”,
},
{
question: “What is the GI tag wine of Assam?”,
options: [
“Desi Daru”,
“Judima”,
“Cholai”,
“Sulai”,
],
correct: “Judima”,
},
{
question: “In which year 𝐉𝐮𝐝𝐢𝐦𝐚 got the GI tag?”,
options: [
“2019”,
“2020”,
“2021”,
“🙄?”,
],
correct: “2021”,
},
{
question: “The Falcon Festival held in which district every year?”,
options: [
“Dima Hasao”,
“Karbi Anglong”,
“Jorhat”,
“Kokrajhar”,
],
correct: “Dima Hasao”,
},
{
question:
“Who is the first Woman IPS officer from Dimasa community?”,
options: [
“Jay Bhadra Hagjer”,
“Diksha Langthasa”,
“Monali Longmailai”,
“Suprita Kemprai”,
],
correct: “Diksha Langthasa”,
},
{
question: “Who was the Dimasa princess?”,
options: [
“Dishrudi Haflongbar”,
“Joya Thaosen”,
“Demalik Kemprai”,
“None of these”,
],
correct: “Dishrudi Haflongbar”,
},
{
question: “Who was the freedom fighter of Dimasa?”,
options: [
“Veer Demalik Kemprai”,
“Joya Thaosen”,
“Veer Sambudhan Phonglo”,
“None of these”,
],
correct: “Veer Sambudhan Phonglo”,
},
{
question: “In which year Dima Halam Daoga founded?”,
options: [
“1996”,
“1997”,
“1998”,
“1999”,
],
correct: “1996”,
},
];
const quizContainer = document.querySelector(“.quiz-container”);
const question = document.querySelector(“.quiz-container .question”);
const options = document.querySelector(“.quiz-container .options”);
const nextBtn = document.querySelector(“.quiz-container .next-btn”);
const quizResult = document.querySelector(“.quiz-result”);
const startBtnContainer = document.querySelector(“.start-btn-container”);
const startBtn = document.querySelector(“.start-btn-container .start-btn”);
let questionNumber = 0;
let score = 0;
const MAX_QUESTIONS = 10;
let timerInterval;
const shuffleArray = (array) => {
return array.slice().sort(() => Math.random() – 0.5);
};
quizData = shuffleArray(quizData);
const resetLocalStorage = () => {
for (i = 0; i {
let userAnswer = e.target.textContent;
if (userAnswer === quizData[questionNumber].correct) {
score++;
e.target.classList.add(“correct”);
} else {
e.target.classList.add(“incorrect”);
}
localStorage.setItem(`userAnswer_${questionNumber}`, userAnswer);
let allOptions = document.querySelectorAll(“.quiz-container .option”);
allOptions.forEach((o) => {
o.classList.add(“disabled”);
});
};
const createQuestion = () => {
clearInterval(timerInterval);
let secondsLeft = 19;
const timerDisplay = document.querySelector(“.quiz-container .timer”);
timerDisplay.classList.remove(“danger”);
timerDisplay.textContent = `Time Left: 20 seconds`;
timerInterval = setInterval(() => {
timerDisplay.textContent = `Time Left: ${secondsLeft
.toString()
.padStart(2, “0”)} seconds`;
secondsLeft–;
if (secondsLeft < 3) {
timerDisplay.classList.add("danger");
}
if (secondsLeft < 0) {
clearInterval(timerInterval);
displayNextQuestion();
}
}, 1000);
options.innerHTML = "";
question.innerHTML = `${
questionNumber + 1
}/${MAX_QUESTIONS}${quizData[questionNumber].question}`;
const shuffledOptions = shuffleArray(quizData[questionNumber].options);
shuffledOptions.forEach((o) => {
const option = document.createElement(“button”);
option.classList.add(“option”);
option.innerHTML = o;
option.addEventListener(“click”, (e) => {
checkAnswer(e);
});
options.appendChild(option);
});
};
const retakeQuiz = () => {
questionNumber = 0;
score = 0;
quizData = shuffleArray(quizData);
resetLocalStorage();
createQuestion();
quizResult.style.display = “none”;
quizContainer.style.display = “block”;
};
const displayQuizResult = () => {
quizResult.style.display = “flex”;
quizContainer.style.display = “none”;
quizResult.innerHTML = “”;
const resultHeading = document.createElement(“h2”);
resultHeading.innerHTML = `You have scored ${score} out of ${MAX_QUESTIONS}.`;
quizResult.appendChild(resultHeading);
for (let i = 0; i < MAX_QUESTIONS; i++) {
const resultItem = document.createElement("div");
resultItem.classList.add("question-container");
const userAnswer = localStorage.getItem(`userAnswer_${i}`);
const correctAnswer = quizData[i].correct;
let answeredCorrectly = userAnswer === correctAnswer;
if (!answeredCorrectly) {
resultItem.classList.add("incorrect");
}
resultItem.innerHTML = `
quizData[i].question
}
`;
quizResult.appendChild(resultItem);
}
const retakeBtn = document.createElement(“button”);
retakeBtn.classList.add(“retake-btn”);
retakeBtn.innerHTML = “Retake Quiz”;
retakeBtn.addEventListener(“click”, retakeQuiz);
quizResult.appendChild(retakeBtn);
};
const displayNextQuestion = () => {
if (questionNumber >= MAX_QUESTIONS – 1) {
displayQuizResult();
return;
}
questionNumber++;
createQuestion();
};
nextBtn.addEventListener(“click”, displayNextQuestion);
startBtn.addEventListener(“click”, () => {
startBtnContainer.style.display = “none”;
quizContainer.style.display = “block”;
createQuestion();
});
