KNOWLEDGE CHALLENGE

Test Your Knowledge!

Answer the questions below and see how much you know.

Question 1 of 5 Score: 0

Question will appear here

#quiz-container { max-width: 650px; margin: 25px auto; padding: 25px; background: #ffffff; border: 1px solid #e5e7eb; border-radius: 16px; box-shadow: 0 5px 25px rgba(0,0,0,0.07); font-family: Arial, sans-serif; color: #222; } #quiz-container * { box-sizing: border-box; } .quiz-header { text-align: center; margin-bottom: 25px; } .quiz-tag { background: #eef2ff; color: #5145cd; padding: 7px 13px; border-radius: 20px; font-size: 11px; font-weight: bold; } .quiz-header h2 { font-size: 27px; margin: 17px 0 8px; } .quiz-header p { color: #666; font-size: 14px; } .quiz-progress { height: 9px; background: #e9e9ef; border-radius: 20px; overflow: hidden; margin: 20px 0; } #progress-bar { height: 100%; width: 0%; background: #6255df; transition: width .3s; } .quiz-info { display: flex; justify-content: space-between; font-size: 13px; color: #666; margin-bottom: 25px; } #question { font-size: 20px; line-height: 1.5; margin-bottom: 20px; } .quiz-option { display: block; width: 100%; padding: 15px; margin: 10px 0; border: 1px solid #ddd; border-radius: 10px; background: #fff; text-align: left; font-size: 15px; cursor: pointer; transition: .2s; color: #222; } .quiz-option:hover:not(:disabled) { border-color: #6255df; background: #f5f4ff; } .quiz-option.correct { background: #e5f8ed; border-color: #21a45b; color: #16743e; } .quiz-option.wrong { background: #fff0f0; border-color: #e34b4b; color: #bd2929; } .quiz-option:disabled { cursor: default; } #feedback { font-size: 14px; font-weight: bold; min-height: 20px; margin: 15px 0; } #next-btn, #quiz-result button { width: 100%; padding: 14px; border: none; border-radius: 9px; background: #6255df; color: white; font-size: 16px; font-weight: bold; cursor: pointer; margin-top: 10px; } #next-btn:disabled { opacity: .45; cursor: not-allowed; } #quiz-result { text-align: center; padding: 20px 0; } .result-icon { font-size: 55px; } #quiz-result h2 { font-size: 26px; } @media(max-width:480px) { #quiz-container { padding: 18px; } .quiz-header h2 { font-size: 23px; } #question { font-size: 18px; } } (function() { const questions = [ { question: “Which planet is known as the Red Planet?”, options: [“Earth”, “Mars”, “Jupiter”, “Venus”], answer: 1 }, { question: “How many days are there in a leap year?”, options: [“364”, “365”, “366”, “367”], answer: 2 }, { question: “Which is the largest ocean on Earth?”, options: [“Atlantic Ocean”, “Indian Ocean”, “Arctic Ocean”, “Pacific Ocean”], answer: 3 }, { question: “What is the chemical symbol for water?”, options: [“CO2”, “H2O”, “O2”, “NaCl”], answer: 1 }, { question: “Which gas do plants absorb from the atmosphere?”, options: [“Oxygen”, “Nitrogen”, “Carbon Dioxide”, “Hydrogen”], answer: 2 } ]; let current = 0; let score = 0; let answered = false; const container = document.getElementById(“quiz-container”); const questionEl = container.querySelector(“#question”); const optionsEl = container.querySelector(“#options”); const feedbackEl = container.querySelector(“#feedback”); const nextBtn = container.querySelector(“#next-btn”); function loadQuestion() { answered = false; const q = questions[current]; container.querySelector(“#question-count”).textContent = `Question ${current + 1} of ${questions.length}`; container.querySelector(“#score-display”).textContent = `Score: ${score}`; container.querySelector(“#progress-bar”).style.width = `${(current / questions.length) * 100}%`; questionEl.textContent = q.question; optionsEl.innerHTML = “”; feedbackEl.textContent = “”; nextBtn.disabled = true; nextBtn.textContent = current === questions.length – 1 ? “See Results →” : “Next Question →”; q.options.forEach((option, index) => { const button = document.createElement(“button”); button.className = “quiz-option”; button.textContent = `${String.fromCharCode(65 + index)}. ${option}`; button.addEventListener(“click”, () => selectAnswer(index)); optionsEl.appendChild(button); }); } function selectAnswer(index) { if (answered) return; answered = true; const q = questions[current]; const buttons = optionsEl.querySelectorAll(“button”); buttons.forEach((button, i) => { button.disabled = true; if (i === q.answer) { button.classList.add(“correct”); } if (i === index && index !== q.answer) { button.classList.add(“wrong”); } }); if (index === q.answer) { score++; feedbackEl.textContent = “✓ Correct Answer! Well done.”; feedbackEl.style.color = “#168447”; } else { feedbackEl.textContent = “✗ Incorrect! The correct answer is ” + q.options[q.answer] + “.”; feedbackEl.style.color = “#c53030”; } container.querySelector(“#score-display”).textContent = `Score: ${score}`; nextBtn.disabled = false; } function showResult() { container.querySelector(“#quiz-content”).style.display = “none”; container.querySelector(“.quiz-progress”).style.display = “none”; container.querySelector(“.quiz-info”).style.display = “none”; const percentage = Math.round((score / questions.length) * 100); container.querySelector(“#quiz-result”).style.display = “block”; container.querySelector(“#progress-bar”).style.width = “100%”; container.querySelector(“#final-score”).textContent = `Your Score: ${score}/${questions.length} (${percentage}%)`; let message = percentage >= 80 ? “Excellent! You have great knowledge!” : percentage >= 50 ? “Good job! Keep learning and improving.” : “Keep practicing! You can do better next time.”; container.querySelector(“#result-message”).textContent = message; } function restartQuiz() { current = 0; score = 0; container.querySelector(“#quiz-result”).style.display = “none”; container.querySelector(“#quiz-content”).style.display = “block”; container.querySelector(“.quiz-progress”).style.display = “block”; container.querySelector(“.quiz-info”).style.display = “flex”; loadQuestion(); } nextBtn.addEventListener(“click”, () => { if (!answered) return; if (current < questions.length – 1) { current++; loadQuestion(); } else { showResult(); } }); window.restartQuiz = restartQuiz; loadQuestion(); })();