Test Your General Knowledge as Global Citizens

Common Knowledge Quiz

body {
font-family: Arial, sans-serif;
}
.quiz-container {
margin-bottom: 20px;
}
.question {
margin-bottom: 5px;
}
.answers {
margin-bottom: 10px;
}
button {
padding: 10px;
margin-top: 10px;
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
button:hover {
opacity: 0.8;
}
.score {
margin-top: 20px;
}
.answer-key {
margin-top: 20px;
display: none;
}

Submit Answers

Answer Key:

var questions = [
“The Earth is almost a perfect sphere.”,
“Vitamin C is essential for the body’s healing process.”,
“Lightning never strikes the same place twice.”,
“Humans have five senses.”,
“The Great Wall of China is visible from space.”,
“Sharks are mammals.”,
“The human skeleton is made up of less than 200 bones.”,
“Water boils at 100 degrees Celsius at sea level.”,
“The currency of France is the Euro.”,
“Mount Everest is the tallest mountain in the world.”,
“The internet and the World Wide Web are the same.”,
“Albert Einstein was awarded the Nobel Prize in Physics for the theory of relativity.”,
“Humans can distinguish between over a trillion different smells.”,
“The adult human body has 206 bones.”,
“The chemical symbol for gold is Au.”,
“Olympus Mons is a large volcanic mountain on Earth.”,
“An octopus has three hearts.”,
“Buzz Aldrin was the first man to walk on the moon.”,
“The capital of Australia is Sydney.”,
“Photosynthesis is a process that only occurs in animals.”
];

var answers = [
“False”,
“True”,
“False”,
“False”,
“False”,
“False”,
“False”,
“True”,
“True”,
“True”,
“False”,
“False”,
“True”,
“True”,
“True”,
“False”,
“True”,
“False”,
“False”,
“False”
];

function createQuiz() {
var quizForm = document.getElementById(‘quiz-form’);
questions.forEach(function(question, index) {
var questionWrapper = document.createElement(‘div’);
questionWrapper.className = ‘question’;
questionWrapper.innerHTML = `

${index + 1}. ${question}

True

False

`;
quizForm.appendChild(questionWrapper);
});
}

function submitQuiz() {
var score = 0;
var result = document.getElementById(‘result’);
var answerList = document.getElementById(‘answer-list’);
var answerKeyDiv = document.getElementById(‘answer-key’);

questions.forEach(function(question, index) {
var userAnswer = document.querySelector(`input[name=”question${index}”]:checked`);
if (userAnswer && userAnswer.value === answers[index]) {
score++;
}

// Add answer key item
var answerItem = document.createElement(‘li’);
answerItem.textContent = `${index + 1}. ${question} – Correct Answer: ${answers[index]}`;
answerList.appendChild(answerItem);
});

result.textContent = `You answered ${score} out of ${questions.length} questions correctly.`;
answerKeyDiv.style.display = ‘block’; // Show the answer key
document.getElementById(‘quiz-container’).style.display = ‘none’; // Hide the quiz after submission
}

createQuiz(); // Initialize the quiz

Leave a comment