Victorian Age Quiz
Literature Quiz body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; max-width: 600px; margin: 0 auto; padding: 20px; } h1, h2 { color: #2c3e50; } .question { margin-bottom: 20px; } button { display: block; width: 100%; padding: 10px; margin-bottom: 10px; background-color: #3498db; color: white; border: none; border-radius: 5px; cursor: pointer; transition: background-color 0.3s; } button:hover { background-color: #2980b9; } input[type="text"] { width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid #ddd; border-radius: 5px; } #result { font-weight: bold; margin-top: 20px; } #correctAnswers { margin-top: 20px; } Literature Quiz Welcome to the Literature Quiz! Start Quiz const questions = [ { question: "Who wrote the poem \"In Memoriam\"?", options: ["Robert Browning", "Alfred Lord Tennyson", "Elizabeth Barrett Browning", "Dante Gabriel Rossetti"], correctAnswer: 1 }, { question: "Which of the following works is NOT written by Robert Browning?", options: ["\"My Last Duchess\"", "\"The Ring and the Book\"", "\"Aurora Leigh\"", "\"Fra Lippo Lippi\""], correctAnswer: 2 }, { question: "Elizabeth Barrett Browning is best known for which of the following works?", options: ["\"The Princess\"", "\"Sonnets from the Portuguese\"", "\"The Lady of Shalott\"", "\"The Last Ride Together\""], correctAnswer: 1 }, { question: "Dante Gabriel Rossetti was associated with which artistic movement?", options: ["Romanticism", "Pre-Raphaelitism", "Modernism", "Symbolism"], correctAnswer: 1 }, { question: "Which poem by Christina Rossetti begins with \"When I am dead, my dearest\"?", options: ["\"Goblin Market\"", "\"Remember\"", "\"In the Bleak Midwinter\"", "\"The Goblin Market\""], correctAnswer: 1 }, { question: "William Morris is known for his contributions to which field?", options: ["Poetry", "Textile design", "Both a and b", "None of the above"], correctAnswer: 2 }, { question: "A.C. Swinburne is famous for his poem \"The Garden of Proserpine.\" What is its main theme?", options: ["Death and resurrection", "Love and loss", "Nature and beauty", "The inevitability of death"], correctAnswer: 3 }, { question: "G.M. Hopkins is known for developing which poetic form?", options: ["The sonnet", "The curtal sonnet", "The villanelle", "The ballad"], correctAnswer: 1 }, { question: "Edward Fitzgerald is best known for his translation of which work?", options: ["The Iliad", "The Rubaiyat of Omar Khayyam", "The Divine Comedy", "The Aeneid"], correctAnswer: 1 }, { question: "Which of the following novels was written by Charles Dickens?", options: ["\"Middlemarch\"", "\"David Copperfield\"", "\"Jane Eyre\"", "\"Wuthering Heights\""], correctAnswer: 1 }, { question: "William Makepeace Thackeray is known for which of the following novels?", options: ["\"Vanity Fair\"", "\"Pride and Prejudice\"", "\"The Mill on the Floss\"", "\"Great Expectations\""], correctAnswer: 0 }, { question: "George Eliot's real name was:", options: ["Mary Ann Evans", "Charlotte Bronte", "Mary Shelley", "Elizabeth Gaskell"], correctAnswer: 0 }, { question: "Which of the following works is written by Anthony Trollope?", options: ["\"The Warden\"", "\"Middlemarch\"", "\"The Tenant of Wildfell Hall\"", "\"North and South\""], correctAnswer: 0 }, { question: "Charlotte Bronte's novel \"Jane Eyre\" is primarily about:", options: ["The life of a governess", "A love story between a vampire and a human", "The adventures of a young boy", "A historical figure"], correctAnswer: 0 }, { question: "Which of the following is a work by Emily Bronte?", options: ["\"Wuthering Heights\"", "\"The Tenant of Wildfell Hall\"", "\"The Mill on the Floss\"", "\"Pride and Prejudice\""], correctAnswer: 0 } ]; let currentQuestion = 0; let score = 0; let userName = ""; function startQuiz() { userName = document.getElementById("name").value.trim(); if (userName !== "") { document.getElementById("start").style.display = "none"; document.getElementById("question").style.display = "block"; loadQuestion(); } else { alert("Please enter your name to start the quiz."); } } function loadQuestion() { const questionData = questions[currentQuestion]; document.getElementById("questionText").textContent = `Question ${currentQuestion + 1}: ${questionData.question}`; const optionsHtml = questionData.options.map((option, index) => `<button onclick="selectAnswer(${index})">${option}</button>` ).join(""); document.getElementById("options").innerHTML = optionsHtml; } function selectAnswer(selectedIndex) { if (selectedIndex === questions[currentQuestion].correctAnswer) { score++; } currentQuestion++; if (currentQuestion < questions.length) { loadQuestion(); } else { showResult(); } } function showResult() { document.getElementById("question").style.display = "none"; document.getElementById("result").style.display = "block"; document.getElementById("result").innerHTML = ` <h2>Quiz Completed!</h2> <p>${userName}, you scored ${score} out of ${questions.length}</p> <button onclick="restartQuiz()">Restart Quiz</button> `; showCorrectAnswers(); } function showCorrectAnswers() { let correctAnswersHtml = "<h3>Correct Answers:</h3>"; questions.forEach((q, index) => { correctAnswersHtml += `<p>${index + 1}. ${q.options[q.correctAnswer]}</p>`; }); document.getElementById("correctAnswers").innerHTML = correctAnswersHtml; document.getElementById("correctAnswers").style.display = "block"; } function restartQuiz() { currentQuestion = 0; score = 0; document.getElementById("result").style.display = "none"; document.getElementById("correctAnswers").style.display = "none"; document.getElementById("start").style.display = "block"; document.getElementById("name").value = ""; }
The post Victorian Age Quiz first appeared on Ronald Hadrian.
Published on August 03, 2024 04:33
No comments have been added yet.


