Pandyas of Madurai free mock test 1
 |
Pandyas kings of madurai free mock tests |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pandyas of Madurai free Interactive Quiz - Test Your Knowledge | [www.osmanian.com]</title>
<meta name="description" content="Take this interactive quiz to test your knowledge on Panyas of Madurai. Enter your name, answer questions, and share your results!">
<meta name="keywords" content="interactive quiz, knowledge test, online quiz, trivia challenge">
<meta property="og:title" content="Pandyas of Madurai free Interactive Quiz - Test Your Knowledge">
<meta property="og:description" content="Challenge yourself with this Pandyas of Madurai free interactive quiz. Share your score with friends!">
<meta property="og:type" content="www.osmanian.com">
<meta property="og:url" content="https://yourwebsite.com/quiz">
<meta property="og:image" content="https://yourwebsite.com/quiz-image.jpg">
<link rel="canonical" href="https://yourwebsite.com/quiz">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
@font-face {
font-family: 'Mallanna';
src: url('https://fonts.googleapis.com/css2?family=Mallanna&display=swap');
}
@font-face {
font-family: 'Garamond';
src: local('Garamond'), serif;
}
body {
font-family: 'Garamond', serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
.telugu {
font-family: 'Mallanna', sans-serif;
}
.quiz-container {
display: none;
}
.start-container {
text-align: center;
margin-top: 50px;
}
#question {
font-weight: bold;
}
.option {
padding: 10px;
margin: 5px;
border: 2px solid #666;
cursor: pointer;
}
.correct {
background-color: #90ee90;
}
.wrong {
background-color: #ff9999;
}
.question-numbers {
display: flex;
flex-wrap: wrap;
gap: 5px;
margin-top: 20px;
max-width: 800px;
overflow-x: auto;
}
.q-number {
width: 30px;
height: 30px;
line-height: 30px;
text-align: center;
border: 1px solid #ccc;
cursor: pointer;
}
.q-number.correct {
background-color: #90ee90;
font-weight: bold;
}
.q-number.wrong {
background-color: #ff9999;
font-weight: bold;
}
.results {
border: 2px solid #333;
padding: 20px;
margin-top: 20px;
background-color: #FFF8E7;
}
.nav-buttons {
margin: 20px 0;
}
.stats {
margin: 10px 0;
color: #008080;
}
.whatsapp-btn {
background-color: #25D366;
color: white;
padding: 10px 15px;
border: none;
border-radius: 5px;
cursor: pointer;
display: flex;
align-items: center;
gap: 5px;
}
</style>
</head>
<body>
<header class="start-container">
<h1>Enter Your Name to Start the Interactive Quiz</h1>
<input type="text" id="userName" placeholder="Your Name">
<button onclick="startQuiz()">Start Quiz</button>
</header>
<main class="quiz-container">
<section class="stats">
Questions Attempted: <span id="attempted">0</span> |
Correct Answers: <span id="correctCount">0</span> |
Percentage: <span id="percentage">0%</span>
</section>
<section>
<div id="question"></div>
<img id="questionImage" style="max-width: 100%; display: none;" alt="Quiz question illustration">
<div id="options"></div>
</section>
<nav class="nav-buttons">
<button onclick="prevQuestion()">Previous</button>
<button onclick="nextQuestion()">Next</button>
</nav>
<div class="question-numbers" id="questionNumbers"></div>
</main>
<section id="results" class="results" style="display: none;"></section>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Quiz",
"name": "Interactive Knowledge Quiz",
"description": "A fun and engaging quiz to test your general knowledge.",
"educationalLevel": "Beginner",
"numberOfItems": 2,
"author": {
"@type": "Organization",
"name": "[Your Website Name]"
}
}
</script>
<script>
const questions = [
{
"q": "Who led the invasion
of the Pandya kingdom under Ala-ud-din Khalji?",
"img": "",
"options": ["Ghiyas-ud-din
Tughluq", "Malik Kafur", "Khusrau",
"Prataparudra"],
"answer": 1
},
{
"q": "What was the main
impact of Malik Kafur’s invasion of the Pandya kingdom?",
"img": "",
"options": ["Complete
annexation by the Delhi Sultanate", "Establishment of a new ruling
dynasty", "A plundering raid without serious annexation",
"Formation of a Pandya-Khalji alliance"],
"answer": 2
},
{
"q": "Who temporarily
subjugated the Pandyas in 1312–13?",
"img": "",
"options": ["Vira
Pandya", "Jauna Khan", "Ravivarma Kulasekhara",
"Prataparudra"],
"answer": 2
},
{
"q": "Which ruler helped Vira
Pandya recover some Pandya power?",
"img": "",
"options": ["Malik
Kafur", "Prataparudra", "Ravivarma Kulasekhara",
"Hoyasala ally"],
"answer": 3
},
{
"q": "Which external ruler
occupied a part of the Pandya kingdom?",
"img": "",
"options": ["Ghiyas-ud-din
Tughluq", "Prataparudra", "Mubarak Khalji",
"Ravivarma Kulasekhara"],
"answer": 1
},
{
"q": "Who led an expedition
against the Pandyas during the reign of Mubarak Khalji?",
"img": "",
"options": ["Malik
Kafur", "Khusrau", "Jauna Khan",
"Prataparudra"],
"answer": 1
},
{
"q": "In which year did
Jauna Khan conquer Madurai?",
"img": "",
"options": ["1312",
"1315", "1323", "1411"],
"answer": 2
},
{
"q": "What evidence suggests
the Pandya dynasty was not completely extinct after 1323?",
"img": "",
"options": ["Foreign
accounts mentioning them", "Local oral traditions",
"Inscriptions found between 1315–1411", "Chronicles from the
Delhi Sultanate"],
"answer": 2
},
{
"q": "What was a major
factor that weakened the Pandya rule apart from Malik Kafur's invasion?",
"img": "",
"options": ["A great
famine", "War of succession among Pandya princes", "The
rise of the Vijayanagara Empire", "A treaty with the Delhi
Sultanate"],
"answer": 1
},
{
"q": "What encouraged some
feudatories to declare independence from the Pandyas?",
"img": "",
"options": ["Economic
prosperity", "Support from the Delhi Sultanate", "Factional
strife among Pandya princes", "Foreign alliances"],
"answer": 2
},
{
"q": "Who finally conquered
Madurai in 1323?",
"img": "",
"options": ["Ravivarma
Kulasekhara", "Malik Kafur", "Jauna Khan",
"Prataparudra"],
"answer": 2
},
{
"q": "Who was Jauna
Khan?",
"img": "",
"options": ["Son of
Ghiyas-ud-din Tughluq", "Commander under Ala-ud-din Khalji",
"King of the Kakatiya dynasty", "A Pandya ruler"],
"answer": 0
},
{
"q": "Which Delhi Sultanate
ruler's reign saw an expedition against the Pandyas led by Khusrau?",
"img": "",
"options": ["Ghiyas-ud-din
Tughluq", "Mubarak Khalji", "Ala-ud-din Khalji",
"Feroz Shah Tughluq"],
"answer": 1
},
{
"q": "Who was the Kakatiya
ruler that occupied a part of the Pandya kingdom?",
"img": "",
"options": ["Rudrama
Devi", "Ganapati Deva", "Prataparudra", "Malik
Kafur"],
"answer": 2
},
{
"q": "Which year marks the
temporary subjugation of the Pandyas by Ravivarma Kulasekhara?",
"img": "",
"options":
["1300–1301", "1312–1313", "1323–1325",
"1411–1415"],
"answer": 1
},
{
"q": "What helped Vira
Pandya recover some of his lost power?",
"img": "",
"options": ["Assistance from
a Hoyasala ally", "Treaty with the Delhi Sultanate",
"Alliance with Kakatiya rulers", "Help from the Vijayanagara Empire"],
"answer": 0
},
{
"q": "Which of the following
is NOT mentioned as a cause of Pandya disintegration?",
"img": "",
"options": ["Invasion by
Malik Kafur", "Factional strife among Pandya princes",
"Strong naval attacks from Sri Lanka", "Invasion by Kakatiya
Prataparudra"],
"answer": 2
},
{
"q": "What suggests that the
Pandya dynasty continued to exist even after Madurai's capture?",
"img": "",
"options": ["Literary texts
from the Vijayanagara Empire", "Inscriptions found from 1315 to
1411", "Coins issued by later Pandya rulers", "Support from
the Chola dynasty"],
"answer": 1
},
{
"q": "What was the primary
reason for Malik Kafur’s invasion of the Pandya kingdom?",
"img": "",
"options": ["To establish
direct Delhi Sultanate rule", "To create an alliance with the
Pandyas", "A plundering raid for wealth", "To support a
Pandya prince in a succession war"],
"answer": 2
},
{
"q": "What effect did the
war of succession among the Pandya princes have on their kingdom?",
"img": "",
"options": ["Strengthened
their rule", "Paved the way for external invasions and internal disintegration",
"Led to a long period of peace and stability", "United the
kingdom under a single ruler"],
"answer": 1
},
{
"q": "Which dynasty did the
Hoyasala rulers belong to?",
"img": "",
"options": ["Chola",
"Kakatiya", "Vijayanagara", "Hoyasala"],
"answer": 3
},
{
"q": "What was the final
major threat to the Pandyas in 1323?",
"img": "",
"options": ["The rise of the
Vijayanagara Empire", "An invasion by Jauna Khan", "The
expansion of the Chola dynasty", "An economic collapse"],
"answer": 1
},
{
"q": "Under whose reign did
Khusrau lead an expedition against the Pandyas?",
"img": "",
"options": ["Ala-ud-din
Khalji", "Mubarak Khalji", "Ghiyas-ud-din Tughluq",
"Jauna Khan"],
"answer": 1
},
{
"q": "How did the Kakatiya
dynasty impact the Pandya kingdom?",
"img": "",
"options": ["They allied
with the Pandyas against the Delhi Sultanate", "They occupied part of
the Pandya kingdom", "They supported the Pandyas in resisting
invasions", "They remained neutral in South Indian conflicts"],
"answer": 1
},
{
"q": "What happened to the
Pandya kingdom after Jauna Khan’s conquest?",
"img": "",
"options": ["It completely
disappeared from history", "Inscriptions suggest some Pandyas
continued ruling in parts of Tamil Nadu", "The kingdom became part of
the Vijayanagara Empire immediately", "The Pandyas fled to Sri Lanka
and ruled from there"],
"answer": 1
},
{
"q": "During which period
were inscriptions of the Pandyas still found?",
"img": "",
"options":
["1200–1300", "1315–1411", "1400–1500",
"1500–1600"],
"answer": 1
},
{
"q": "Which of the following
rulers is NOT associated with an invasion of the Pandya kingdom?",
"img": "",
"options": ["Malik
Kafur", "Prataparudra", "Jauna Khan", "Rajendra
Chola"],
"answer": 3
},
{
"q": "What was the role of Ravivarma
Kulasekhara in the history of the Pandyas?",
"img": "",
"options": ["He invaded and
temporarily subjugated the Pandyas in 1312–13", "He was the last
Pandya ruler", "He defeated the Delhi Sultanate and restored Pandya
rule", "He formed an alliance with Jauna Khan"],
"answer": 0
},
{
"q": "Which external empire
played a role in the weakening of the Pandya rule apart from the Delhi
Sultanate?",
"img": "",
"options": ["Vijayanagara
Empire", "Kakatiya Dynasty", "Chola Dynasty",
"Pallava Dynasty"],
"answer": 1
},
{
"q": "What was the result of
the Pandya feudatories gaining independence?",
"img": "",
"options": ["The Pandya
kingdom expanded into new regions", "It further weakened the Pandya
rule", "It led to a stronger Pandya central authority",
"The feudatories allied with the Pandya rulers"],
"answer": 1
},
{
"q": "What was the main reason
for the decline of Pandya power after Malik Kafur’s invasion?",
"img": "",
"options": ["A prolonged
famine", "War of succession among Pandya princes and external
invasions", "A deadly plague that wiped out their army", "A
peaceful transition to a new dynasty"],
"answer": 1
},
{
"q": "Who was the ruler of
the Delhi Sultanate when Jauna Khan conquered Madurai?",
"img": "",
"options": ["Ala-ud-din
Khalji", "Mubarak Khalji", "Ghiyas-ud-din Tughluq",
"Feroz Shah Tughluq"],
"answer": 2
},
{
"q": "What was the primary
goal of Jauna Khan’s invasion of Madurai?",
"img": "",
"options": ["To establish a
stronghold in South India", "To avenge Malik Kafur’s failed attempt
to annex the region", "To secure trade routes in Tamil Nadu",
"To ally with the Pandyas against the Kakatiyas"],
"answer": 0
},
{
"q": "Which dynasty was
ruling Kerala when Ravivarma Kulasekhara temporarily subjugated the
Pandyas?",
"img": "",
"options": ["Chera
Dynasty", "Chola Dynasty", "Vijayanagara Empire",
"Pallava Dynasty"],
"answer": 0
},
{
"q": "The Hoyasala dynasty,
which supported Vira Pandya, was based in which region?",
"img": "",
"options": ["Tamil
Nadu", "Kerala", "Karnataka", "Andhra
Pradesh"],
"answer": 2
},
{
"q": "What was the major
effect of Khusrau’s expedition against the Pandyas?",
"img": "",
"options": ["Strengthened
Pandya rule", "Led to further weakening of the Pandya kingdom", "Resulted
in an alliance between the Pandyas and the Delhi Sultanate", "Forced
the Pandyas to migrate to Sri Lanka"],
"answer": 1
},
{
"q": "Why did some
feudatories declare independence from the Pandya kingdom?",
"img": "",
"options": ["They supported
the Delhi Sultanate", "They wanted to form alliances with foreign
powers", "They took advantage of internal factional strife",
"They were encouraged by the Cholas"],
"answer": 2
},
{
"q": "Which factor
contributed to the Pandya dynasty’s survival despite Madurai’s conquest?",
"img": "",
"options": ["Pandya rulers
continued ruling in some regions", "They formed an alliance with the
Vijayanagara Empire", "They converted to Islam and retained
power", "They retreated to Sri Lanka and ruled from there"],
"answer": 0
},
{
"q": "Which Sultanate leader
first initiated military campaigns in South India?",
"img": "",
"options": ["Ghiyas-ud-din
Tughluq", "Jauna Khan", "Ala-ud-din Khalji",
"Feroz Shah Tughluq"],
"answer": 2
},
{
"q": "The Pandyas were
primarily rulers of which modern-day Indian state?",
"img": "",
"options":
["Karnataka", "Kerala", "Tamil Nadu",
"Andhra Pradesh"],
"answer": 2
},
{
"q": "What was the fate of
Madurai after Jauna Khan’s conquest?",
"img": "",
"options": ["It became the
capital of a new empire", "It was annexed to the Delhi
Sultanate", "It was abandoned and never ruled again", "It
was given back to the Pandya rulers"],
"answer": 1
},
{
"q": "What was the main
reason why the Pandyas could not recover their lost kingdom?",
"img": "",
"options": ["They lacked a
strong military force", "Constant external invasions and internal
conflicts", "Their rulers migrated to other regions", "They
allied with weak rulers"],
"answer": 1
},
{
"q": "What was the
significance of inscriptions found between 1315–1411?",
"img": "",
"options": ["They prove that
the Pandya dynasty continued in some form", "They were written by
foreign travelers", "They mention the total destruction of the Pandyas",
"They describe the conquest of the Pandyas by the Vijayanagara
Empire"],
"answer": 0
},
{
"q": "Which of the following
rulers did NOT invade or interfere in the Pandya kingdom?",
"img": "",
"options": ["Malik
Kafur", "Ravivarma Kulasekhara", "Rajendra Chola",
"Prithviraj Chauhan"],
"answer": 3
},
{
"q": "The Kakatiya invasion
of the Pandya kingdom was led by whom?",
"img": "",
"options": ["Ganapati
Deva", "Prataparudra", "Rudrama Devi", "Malik
Kafur"],
"answer": 1
},
{
"q": "Which Pandya ruler
made an attempt to recover the kingdom after 1313?",
"img": "",
"options": ["Sundara
Pandya", "Vira Pandya", "Maravarman Kulasekhara",
"Rajendra Pandya"],
"answer": 1
},
{
"q": "Who was the founder of
the Tughluq dynasty under whom Jauna Khan invaded Madurai?",
"img": "",
"options": ["Feroz Shah
Tughluq", "Muhammad bin Tughluq", "Ghiyas-ud-din
Tughluq", "Balban"],
"answer": 2
},
{
"q": "What role did the
Vijayanagara Empire later play in South India after the fall of the
Pandyas?",
"img": "",
"options": ["They took
control of Madurai and resisted further Delhi Sultanate invasions",
"They allied with the Delhi Sultanate against the Cholas", "They
helped restore Pandya rule", "They remained neutral in Tamil Nadu
affairs"],
"answer": 0
},
{
"q": "Who was the last major
ruler of the Kakatiya dynasty who invaded the Pandya kingdom?",
"img": "",
"options": ["Rudrama
Devi", "Prataparudra", "Ganapati Deva", "Malik
Kafur"],
"answer": 1
},
{
"q": "Which factor played
the biggest role in weakening the Pandya kingdom?",
"img": "",
"options": ["The rise of the
Vijayanagara Empire", "Repeated invasions and internal conflicts",
"Economic decline due to trade restrictions", "Natural disasters
like floods and earthquakes"],
"answer": 1
},
{
"q": "When was Madurai
annexed to the Delhi Sultanate?",
"img": "",
"options": ["During
Ala-ud-din Khalji’s reign", "During Ghiyas-ud-din Tughluq’s
reign", "During Balban’s reign", "During Feroz Shah
Tughluq’s reign"],
"answer": 1
},
{
"q": "Who declared
independence from the Delhi Sultanate and became the first Sultan of
Madurai?",
"img": "",
"options": ["Ghiyas-ud-din
Damghan Shah", "Ala-ud-din Khalji", "Jalal-ud-din Ahsan
Shah", "Muhammad bin Tughluq"],
"answer": 2
},
{
"q": "In which year did
Jalal-ud-din Ahsan Shah rule Madurai?",
"img": "",
"options":
["1320–1330", "1334–1340", "1345–1350",
"1370–1377"],
"answer": 1
},
{
"q": "Who was the famous
traveler that visited the Sultanate of Madurai during Jalal-ud-din Ahsan Shah’s
reign?",
"img": "",
"options": ["Marco
Polo", "Ibn Battutah", "Al-Biruni",
"Fa-Hien"],
"answer": 1
},
{
"q": "Who succeeded
Jalal-ud-din Ahsan Shah as the Sultan of Madurai?",
"img": "",
"options": ["Ghiyas-ud-din
Damghan Shah", "Bukka I", "Vira Ballala III",
"Muhammad bin Tughluq"],
"answer": 0
},
{
"q": "Which Hoyasala ruler
was defeated and killed by Ghiyas-ud-din Damghan Shah?",
"img": "",
"options": ["Vishnuvardhana",
"Narasimha II", "Vira Ballala III",
"Someshvara"],
"answer": 2
},
{
"q": "Which kingdom
benefited the most from the Hoyasala defeat?",
"img": "",
"options": ["Delhi
Sultanate", "Vijayanagara Empire", "Chola Dynasty",
"Kakatiya Dynasty"],
"answer": 1
},
{
"q": "Who ultimately
defeated the Sultanate of Madurai?",
"img": "",
"options": ["Malik
Kafur", "Bukka I of Vijayanagar", "Ala-ud-din Khalji",
"Feroz Shah Tughluq"],
"answer": 1
},
{
"q": "According to the
historian Afif, what happened to the Sultan of Madurai?",
"img": "",
"options": ["He was exiled
to Delhi", "He fled to the Maldives", "He was captured and
killed", "He surrendered and joined the Vijayanagara Empire"],
"answer": 2
},
{
"q": "What does numismatic
evidence suggest about the Sultans of Madurai?",
"img": "",
"options": ["They ruled
until 1377", "They were completely wiped out by 1350",
"They formed an alliance with the Vijayanagara Empire", "They
ruled only until 1345"],
"answer": 0
}
];
const quizTitle = "Interactive Knowledge Quiz"; // Define quiz title as a constant
let currentQuestion = 0;
let userAnswers = new Array(questions.length).fill(-1);
let userName = "";
let startTime;
function startQuiz() {
userName = document.getElementById("userName").value.trim();
if (!userName) {
alert("Please enter your name!");
return;
}
document.querySelector(".start-container").style.display = "none";
document.querySelector(".quiz-container").style.display = "block";
startTime = new Date();
loadQuestion();
generateQuestionNumbers();
}
function loadQuestion() {
const q = questions[currentQuestion];
const questionEl = document.getElementById("question");
questionEl.innerHTML = `${currentQuestion + 1}. ${q.q}`;
if (q.q.includes("Telugu")) questionEl.classList.add("telugu");
const imgEl = document.getElementById("questionImage");
if (q.img) {
imgEl.src = q.img;
imgEl.style.display = "block";
} else {
imgEl.style.display = "none";
}
const optionsEl = document.getElementById("options");
optionsEl.innerHTML = "";
q.options.forEach((opt, i) => {
const div = document.createElement("div");
div.className = "option";
div.textContent = opt;
div.onclick = () => selectOption(i);
if (userAnswers[currentQuestion] !== -1) {
if (i === q.answer) div.classList.add("correct");
else if (i === userAnswers[currentQuestion]) div.classList.add("wrong");
div.style.pointerEvents = "none";
}
optionsEl.appendChild(div);
});
updateStats();
}
function selectOption(selected) {
if (userAnswers[currentQuestion] !== -1) return;
userAnswers[currentQuestion] = selected;
const options = document.querySelectorAll(".option");
options.forEach((opt, i) => {
if (i === questions[currentQuestion].answer) {
opt.classList.add("correct");
} else if (i === selected) {
opt.classList.add("wrong");
}
opt.style.pointerEvents = "none";
});
updateQuestionNumbers();
updateStats();
if (currentQuestion < questions.length - 1) {
setTimeout(() => {
currentQuestion++;
loadQuestion();
}, 3000);
} else {
setTimeout(showResults, 3000);
}
}
function generateQuestionNumbers() {
const numbersEl = document.getElementById("questionNumbers");
numbersEl.innerHTML = "";
questions.forEach((_, i) => {
const num = document.createElement("div");
num.className = "q-number";
num.textContent = i + 1;
num.onclick = () => {
currentQuestion = i;
loadQuestion();
};
if (userAnswers[i] !== -1) {
num.classList.add(userAnswers[i] === questions[i].answer ? "correct" : "wrong");
}
numbersEl.appendChild(num);
});
}
function updateQuestionNumbers() {
const numbers = document.querySelectorAll(".q-number");
numbers[currentQuestion].classList.add(
userAnswers[currentQuestion] === questions[currentQuestion].answer ? "correct" : "wrong"
);
}
function updateStats() {
const attempted = userAnswers.filter(a => a !== -1).length;
const correct = userAnswers.reduce((sum, ans, i) =>
sum + (ans === questions[i].answer ? 1 : 0), 0);
const percent = questions.length ? (correct / questions.length * 100).toFixed(2) : 0;
document.getElementById("attempted").textContent = attempted;
document.getElementById("correctCount").textContent = correct;
document.getElementById("percentage").textContent = percent + "%";
}
function prevQuestion() {
if (currentQuestion > 0) {
currentQuestion--;
loadQuestion();
}
}
function nextQuestion() {
if (currentQuestion < questions.length - 1) {
currentQuestion++;
loadQuestion();
}
}
function showResults() {
const endTime = new Date();
const timeTaken = Math.round((endTime - startTime) / 1000);
const correct = userAnswers.reduce((sum, ans, i) =>
sum + (ans === questions[i].answer ? 1 : 0), 0);
const percent = (correct / questions.length * 100).toFixed(2);
let performance, color;
if (percent == 100) { performance = "GENIUS"; color = 'green'; }
else if (percent >= 90) { performance = "EXCELLENT"; color = 'orange'; }
else if (percent >= 70) { performance = "GOOD"; color = 'yellow'; }
else if (percent >= 50) { performance = "AVERAGE"; color = 'brown'; }
else { performance = "POOR"; color = 'red'; }
const resultsEl = document.getElementById("results");
resultsEl.innerHTML = ''; // Clear existing content
// Create and append elements programmatically
const title = document.createElement('h2');
title.textContent = 'Quiz Results';
resultsEl.appendChild(title);
const quizTitleEl = document.createElement('p');
quizTitleEl.innerHTML = `<strong>Quiz Title:</strong> ${quizTitle}`;
resultsEl.appendChild(quizTitleEl);
const nameEl = document.createElement('p');
nameEl.innerHTML = `<strong>Name:</strong> ${userName}`;
resultsEl.appendChild(nameEl);
const scoreEl = document.createElement('p');
scoreEl.innerHTML = `<strong>Score:</strong> ${correct}/${questions.length}`;
resultsEl.appendChild(scoreEl);
const percentEl = document.createElement('p');
percentEl.innerHTML = `<strong>Percentage:</strong> ${percent}%`;
resultsEl.appendChild(percentEl);
const timeEl = document.createElement('p');
timeEl.innerHTML = `<strong>Time Taken:</strong> ${timeTaken} seconds`;
resultsEl.appendChild(timeEl);
const perfEl = document.createElement('p');
perfEl.innerHTML = `<strong>Performance:</strong> <span style="color: ${color}">${performance}</span>`;
resultsEl.appendChild(perfEl);
const shareText = document.createElement('p');
shareText.textContent = 'Share your results on WhatsApp:';
resultsEl.appendChild(shareText);
const button = document.createElement('button');
button.className = 'whatsapp-btn';
button.onclick = shareOnWhatsApp;
button.innerHTML = `
<span>Share on WhatsApp</span>
<svg width="20" height="20" viewBox="0 0 24 24" fill="white">
<path d="M12.04 2C6.58 2 2.13 6.45 2.13 11.91c0 1.76.58 3.39 1.58 4.73L2.5 22l5.47-1.19c1.31.89 2.83 1.37 4.47 1.37 5.46 0 9.91-4.45 9.91-9.91S17.5 2 12.04 2zm4.83 14.92c-.23.65-.67 1.17-1.31 1.5-.54.28-1.23.42-2.04.25-1.13-.23-2.15-.92-2.98-1.75-.94-.94-1.71-2.06-2.19-3.33-.31-.83-.08-1.73.54-2.29.27-.25.61-.38.96-.38.25 0 .49.09.69.23.23.15.42.46.5.75.15.5.27 1.02.38 1.54.08.38 0 .77-.19 1.13-.15.27-.08.58.17.83.23.23.5.42.77.65 1.02.85 2.19 1.52 3.52 1.71.77.12 1.52-.04 2.19-.42.58-.31 1.02-.85 1.27-1.46.19-.46.23-.96.12-1.44-.08-.38-.31-.73-.65-.96z"/>
</svg>
`;
resultsEl.appendChild(button);
document.querySelector(".quiz-container").style.display = "none";
resultsEl.style.display = "block";
}
function shareOnWhatsApp() {
const url = window.location.href;
const message = `${userName} scored ${userAnswers.reduce((sum, ans, i) => sum + (ans === questions[i].answer ? 1 : 0), 0)}/${questions.length} in the ${quizTitle}! Can you beat my score? Try it now: ${url}`;
window.open(`https://api.whatsapp.com/send?text=${encodeURIComponent(message)}`);
}
</script>
</body>
</html>
Indian History Free Mock Tests
Pandyas of Madurai free mock test 2