World Capitals Quiz — How Many Do You Know?

📌

Complete guide: Facts

.wcq-wrap { –wcq-navy: #0f172a; –wcq-blue: #1d4ed8; –wcq-blue-dark: #1e3a8a; –wcq-green: #166534; –wcq-red: #991b1b; –wcq-soft: #f8fafc; –wcq-line: #cbd5e1; –wcq-card: #ffffff; –wcq-muted: #475569; max-width: 1080px; margin: 0 auto; color: var(–wcq-navy); line-height: 1.65; }.wcq-wrap * { box-sizing: border-box; }.wcq-panel { background: var(–wcq-card); border: 1px solid var(–wcq-line); border-radius: 18px; padding: 24px; margin: 24px 0; box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06); }.wcq-hero { background: linear-gradient(135deg, #eff6ff 0%, #ffffff 56%, #f8fafc 100%); border: 1px solid var(–wcq-line); border-radius: 22px; padding: 28px; margin: 0 0 26px; }.wcq-wrap h2 { color: var(–wcq-blue-dark); font-size: 1.55rem; line-height: 1.25; margin: 0 0 14px; padding-bottom: 8px; border-bottom: 2px solid #bfdbfe; }.wcq-wrap h3 { color: #1e293b; font-size: 1.18rem; margin: 22px 0 10px; }.wcq-wrap h4 { color: #334155; font-size: 1.02rem; margin: 18px 0 8px; }.wcq-wrap p { margin: 0 0 14px; }.wcq-highlight { color: var(–wcq-blue-dark); font-weight: 800; }.wcq-soft-text { color: var(–wcq-muted); }.wcq-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 18px 0 0; }.wcq-stat { background: #f8fafc; border: 1px solid #dbeafe; border-radius: 14px; padding: 14px; }.wcq-stat strong { display: block; color: var(–wcq-blue-dark); font-size: 1.35rem; line-height: 1.2; }.wcq-stat span { color: var(–wcq-muted); font-size: 0.95rem; }.wcq-quiz-box { background: #f8fafc; border: 1px solid #dbeafe; border-radius: 18px; padding: 20px; }.wcq-controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; margin-bottom: 18px; }.wcq-field label { display: block; color: #334155; font-weight: 800; margin-bottom: 6px; font-size: 0.95rem; }.wcq-field select { width: 100%; border: 1px solid #94a3b8; border-radius: 12px; padding: 10px 12px; background: #ffffff; color: #0f172a; min-height: 44px; }.wcq-btn { border: 0; border-radius: 12px; padding: 12px 16px; min-height: 44px; background: var(–wcq-blue); color: #ffffff; font-weight: 900; cursor: pointer; transition: transform 0.15s ease, background 0.15s ease; }.wcq-btn:hover, .wcq-btn:focus { background: var(–wcq-blue-dark); transform: translateY(-1px); }.wcq-btn:disabled { background: #94a3b8; cursor: not-allowed; transform: none; }.wcq-btn-secondary { background: #334155; }.wcq-btn-secondary:hover, .wcq-btn-secondary:focus { background: #1e293b; }.wcq-status-row { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; margin: 12px 0 18px; }.wcq-meter { height: 12px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }.wcq-meter span { display: block; height: 100%; width: 0; background: var(–wcq-blue); border-radius: 999px; transition: width 0.2s ease; }.wcq-scoreline { color: #334155; font-weight: 900; white-space: nowrap; }.wcq-question-card { background: #ffffff; border: 1px solid var(–wcq-line); border-radius: 16px; padding: 18px; }.wcq-question-meta { color: var(–wcq-muted); font-size: 0.95rem; margin-bottom: 6px; }.wcq-question { font-size: 1.35rem; font-weight: 900; line-height: 1.3; margin: 0 0 16px; }.wcq-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }.wcq-option { width: 100%; text-align: left; border: 1px solid #94a3b8; border-radius: 14px; background: #ffffff; color: #0f172a; padding: 13px 14px; font-weight: 800; cursor: pointer; }.wcq-option:hover, .wcq-option:focus { border-color: var(–wcq-blue); box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.16); }.wcq-option.wcq-correct { border-color: #16a34a; background: #dcfce7; color: #14532d; }.wcq-option.wcq-wrong { border-color: #dc2626; background: #fee2e2; color: #7f1d1d; }.wcq-feedback { margin-top: 14px; min-height: 30px; font-weight: 800; }.wcq-feedback.wcq-good { color: var(–wcq-green); }.wcq-feedback.wcq-bad { color: var(–wcq-red); }.wcq-next-row { margin-top: 14px; display: flex; justify-content: flex-end; }.wcq-results { background: #ffffff; border: 1px solid var(–wcq-line); border-radius: 16px; padding: 18px; margin-top: 16px; }.wcq-results strong { color: var(–wcq-blue-dark); }.wcq-review-list { margin: 12px 0 0; padding-left: 20px; }.wcq-review-list li { margin: 8px 0; }.wcq-list { padding-left: 20px; margin: 12px 0; }.wcq-list li { margin: 7px 0; }.wcq-note { border-left: 4px solid var(–wcq-blue); background: #eff6ff; padding: 14px 16px; border-radius: 12px; margin: 16px 0; }.wcq-table-wrap { overflow-x: auto; margin-top: 14px; }.wcq-table { width: 100%; border-collapse: collapse; min-width: 720px; }.wcq-table caption { text-align: left; font-weight: 900; color: var(–wcq-blue-dark); margin-bottom: 8px; }.wcq-table th, .wcq-table td { border: 1px solid var(–wcq-line); padding: 10px 12px; vertical-align: top; }.wcq-table th { background: #eff6ff; color: #1e3a8a; text-align: left; }.wcq-table tbody tr:nth-child(even) { background: #f8fafc; }.wcq-tag { display: inline-block; background: #dbeafe; color: #1e3a8a; border-radius: 999px; padding: 3px 9px; font-size: 0.86rem; font-weight: 800; }.wcq-hidden { display: none; }@media (max-width: 820px) { .wcq-grid, .wcq-controls, .wcq-options, .wcq-status-row { grid-template-columns: 1fr; }.wcq-hero, .wcq-panel { padding: 18px; }.wcq-question { font-size: 1.18rem; } }

Start The Quiz

World Mix Easy Famous Capitals Tricky Capitals Africa Only Americas Only Asia Only Europe Only Oceania Only
Country to Capital Capital to Country Mixed
10 Questions 20 Questions 30 Questions 50 Questions Full Selected Set
Score: 0

Your Result

Answer Review

    This World Capitals Quiz tests how well you know capital cities across Africa, the Americas, Asia, Europe, and Oceania. Choose a region, select the question direction, and see how many capitals you can remember.

    The quiz includes 140+ country and capital entries, with a mix of easy, medium, and tricky questions. It works as a quick geography game, a classroom warm-up, or a self-study practice tool.

    140+ Capital entries
    5 Regional quiz modes
    3 Question styles

    What This Quiz Covers

    World capital quizzes are simple at first, but they become harder when a country has a famous largest city, a separate administrative capital, or a capital name that learners often confuse.

    Data Note: This quiz is designed for general geography practice. Some countries have political, administrative, judicial, or disputed capital details. The quiz uses one standard answer for fast multiple-choice practice and gives short notes for common confusion points.
    • Australia: Canberra is the capital, not Sydney or Melbourne.
    • Brazil: Brasilia is the capital, not Rio de Janeiro or Sao Paulo.
    • Canada: Ottawa is the capital, not Toronto.
    • South Africa: Pretoria is used here as the executive capital answer.
    • Sri Lanka: Sri Jayawardenepura Kotte is used as the official capital answer.
    • Malaysia: Kuala Lumpur is used here; Putrajaya is the federal administrative centre.
    • Indonesia: Jakarta is used here for standard quiz practice.

    Quiz Technical Data

    Available Quiz Settings
    SettingOptionsBest For
    Quiz ScopeWorld, easy, tricky, Africa, Americas, Asia, Europe, OceaniaPracticing all capitals or focusing on one region.
    Question DirectionCountry to capital, capital to country, mixedBuilding recall in both directions.
    Question Count10, 20, 30, 50, or full selected setQuick games, classroom rounds, or longer practice sessions.
    ScoringInstant feedback, progress bar, final review listSeeing exactly which capitals need more practice.
    Saved ResultBest score stored in the current browserTracking improvement across repeat attempts.

    Full Practice List

    Use this reference list before starting the quiz, or return to it after your result to review missed answers.

    Countries and Capitals Used In The Quiz
    CountryCapitalRegionDifficulty
    (function () { const root = document.getElementById(“world-capitals-quiz”); if (!root) return;const data = [ { country: “Afghanistan”, capital: “Kabul”, region: “Asia”, difficulty: “medium”, note: “Kabul is the capital of Afghanistan.” }, { country: “Albania”, capital: “Tirana”, region: “Europe”, difficulty: “medium”, note: “Tirana is the capital of Albania.” }, { country: “Algeria”, capital: “Algiers”, region: “Africa”, difficulty: “easy”, note: “Algiers is the capital of Algeria.” }, { country: “Andorra”, capital: “Andorra la Vella”, region: “Europe”, difficulty: “hard”, note: “Andorra la Vella is the capital of Andorra.” }, { country: “Angola”, capital: “Luanda”, region: “Africa”, difficulty: “medium”, note: “Luanda is the capital of Angola.” }, { country: “Argentina”, capital: “Buenos Aires”, region: “Americas”, difficulty: “easy”, note: “Buenos Aires is the capital of Argentina.” }, { country: “Armenia”, capital: “Yerevan”, region: “Asia”, difficulty: “medium”, note: “Yerevan is the capital of Armenia.” }, { country: “Australia”, capital: “Canberra”, region: “Oceania”, difficulty: “medium”, note: “Canberra is the capital of Australia, not Sydney or Melbourne.” }, { country: “Austria”, capital: “Vienna”, region: “Europe”, difficulty: “easy”, note: “Vienna is the capital of Austria.” }, { country: “Azerbaijan”, capital: “Baku”, region: “Asia”, difficulty: “medium”, note: “Baku is the capital of Azerbaijan.” }, { country: “Bahamas”, capital: “Nassau”, region: “Americas”, difficulty: “medium”, note: “Nassau is the capital of the Bahamas.” }, { country: “Bahrain”, capital: “Manama”, region: “Asia”, difficulty: “medium”, note: “Manama is the capital of Bahrain.” }, { country: “Bangladesh”, capital: “Dhaka”, region: “Asia”, difficulty: “easy”, note: “Dhaka is the capital of Bangladesh.” }, { country: “Belarus”, capital: “Minsk”, region: “Europe”, difficulty: “medium”, note: “Minsk is the capital of Belarus.” }, { country: “Belgium”, capital: “Brussels”, region: “Europe”, difficulty: “easy”, note: “Brussels is the capital of Belgium.” }, { country: “Belize”, capital: “Belmopan”, region: “Americas”, difficulty: “hard”, note: “Belmopan is the capital of Belize.” }, { country: “Bhutan”, capital: “Thimphu”, region: “Asia”, difficulty: “hard”, note: “Thimphu is the capital of Bhutan.” }, { country: “Bolivia”, capital: “Sucre”, region: “Americas”, difficulty: “hard”, note: “Sucre is the constitutional capital of Bolivia.” }, { country: “Bosnia and Herzegovina”, capital: “Sarajevo”, region: “Europe”, difficulty: “medium”, note: “Sarajevo is the capital of Bosnia and Herzegovina.” }, { country: “Botswana”, capital: “Gaborone”, region: “Africa”, difficulty: “medium”, note: “Gaborone is the capital of Botswana.” }, { country: “Brazil”, capital: “Brasilia”, region: “Americas”, difficulty: “medium”, note: “Brasilia is the capital of Brazil, not Rio de Janeiro or Sao Paulo.” }, { country: “Brunei”, capital: “Bandar Seri Begawan”, region: “Asia”, difficulty: “hard”, note: “Bandar Seri Begawan is the capital of Brunei.” }, { country: “Bulgaria”, capital: “Sofia”, region: “Europe”, difficulty: “medium”, note: “Sofia is the capital of Bulgaria.” }, { country: “Cambodia”, capital: “Phnom Penh”, region: “Asia”, difficulty: “medium”, note: “Phnom Penh is the capital of Cambodia.” }, { country: “Cameroon”, capital: “Yaounde”, region: “Africa”, difficulty: “medium”, note: “Yaounde is the capital of Cameroon.” }, { country: “Canada”, capital: “Ottawa”, region: “Americas”, difficulty: “medium”, note: “Ottawa is the capital of Canada, not Toronto.” }, { country: “Chile”, capital: “Santiago”, region: “Americas”, difficulty: “easy”, note: “Santiago is the capital of Chile.” }, { country: “China”, capital: “Beijing”, region: “Asia”, difficulty: “easy”, note: “Beijing is the capital of China.” }, { country: “Colombia”, capital: “Bogota”, region: “Americas”, difficulty: “easy”, note: “Bogota is the capital of Colombia.” }, { country: “Costa Rica”, capital: “San Jose”, region: “Americas”, difficulty: “medium”, note: “San Jose is the capital of Costa Rica.” }, { country: “Croatia”, capital: “Zagreb”, region: “Europe”, difficulty: “medium”, note: “Zagreb is the capital of Croatia.” }, { country: “Cuba”, capital: “Havana”, region: “Americas”, difficulty: “easy”, note: “Havana is the capital of Cuba.” }, { country: “Cyprus”, capital: “Nicosia”, region: “Asia”, difficulty: “medium”, note: “Nicosia is the capital of Cyprus.” }, { country: “Czechia”, capital: “Prague”, region: “Europe”, difficulty: “easy”, note: “Prague is the capital of Czechia.” }, { country: “Democratic Republic of the Congo”, capital: “Kinshasa”, region: “Africa”, difficulty: “medium”, note: “Kinshasa is the capital of the Democratic Republic of the Congo.” }, { country: “Denmark”, capital: “Copenhagen”, region: “Europe”, difficulty: “easy”, note: “Copenhagen is the capital of Denmark.” }, { country: “Dominican Republic”, capital: “Santo Domingo”, region: “Americas”, difficulty: “medium”, note: “Santo Domingo is the capital of the Dominican Republic.” }, { country: “Ecuador”, capital: “Quito”, region: “Americas”, difficulty: “medium”, note: “Quito is the capital of Ecuador.” }, { country: “Egypt”, capital: “Cairo”, region: “Africa”, difficulty: “easy”, note: “Cairo is the capital of Egypt.” }, { country: “Estonia”, capital: “Tallinn”, region: “Europe”, difficulty: “medium”, note: “Tallinn is the capital of Estonia.” }, { country: “Ethiopia”, capital: “Addis Ababa”, region: “Africa”, difficulty: “medium”, note: “Addis Ababa is the capital of Ethiopia.” }, { country: “Fiji”, capital: “Suva”, region: “Oceania”, difficulty: “hard”, note: “Suva is the capital of Fiji.” }, { country: “Finland”, capital: “Helsinki”, region: “Europe”, difficulty: “easy”, note: “Helsinki is the capital of Finland.” }, { country: “France”, capital: “Paris”, region: “Europe”, difficulty: “easy”, note: “Paris is the capital of France.” }, { country: “Georgia”, capital: “Tbilisi”, region: “Asia”, difficulty: “medium”, note: “Tbilisi is the capital of Georgia.” }, { country: “Germany”, capital: “Berlin”, region: “Europe”, difficulty: “easy”, note: “Berlin is the capital of Germany.” }, { country: “Ghana”, capital: “Accra”, region: “Africa”, difficulty: “medium”, note: “Accra is the capital of Ghana.” }, { country: “Greece”, capital: “Athens”, region: “Europe”, difficulty: “easy”, note: “Athens is the capital of Greece.” }, { country: “Guatemala”, capital: “Guatemala City”, region: “Americas”, difficulty: “medium”, note: “Guatemala City is the capital of Guatemala.” }, { country: “Guyana”, capital: “Georgetown”, region: “Americas”, difficulty: “medium”, note: “Georgetown is the capital of Guyana.” }, { country: “Hungary”, capital: “Budapest”, region: “Europe”, difficulty: “easy”, note: “Budapest is the capital of Hungary.” }, { country: “Iceland”, capital: “Reykjavik”, region: “Europe”, difficulty: “medium”, note: “Reykjavik is the capital of Iceland.” }, { country: “India”, capital: “New Delhi”, region: “Asia”, difficulty: “easy”, note: “New Delhi is the capital of India.” }, { country: “Indonesia”, capital: “Jakarta”, region: “Asia”, difficulty: “medium”, note: “Jakarta is used here as Indonesia’s standard capital quiz answer.” }, { country: “Iran”, capital: “Tehran”, region: “Asia”, difficulty: “easy”, note: “Tehran is the capital of Iran.” }, { country: “Iraq”, capital: “Baghdad”, region: “Asia”, difficulty: “easy”, note: “Baghdad is the capital of Iraq.” }, { country: “Ireland”, capital: “Dublin”, region: “Europe”, difficulty: “easy”, note: “Dublin is the capital of Ireland.” }, { country: “Israel”, capital: “Jerusalem”, region: “Asia”, difficulty: “medium”, note: “Jerusalem is used here as the quiz answer for Israel.” }, { country: “Italy”, capital: “Rome”, region: “Europe”, difficulty: “easy”, note: “Rome is the capital of Italy.” }, { country: “Ivory Coast”, capital: “Yamoussoukro”, region: “Africa”, difficulty: “hard”, note: “Yamoussoukro is the capital of Ivory Coast; Abidjan is its largest city.” }, { country: “Jamaica”, capital: “Kingston”, region: “Americas”, difficulty: “medium”, note: “Kingston is the capital of Jamaica.” }, { country: “Japan”, capital: “Tokyo”, region: “Asia”, difficulty: “easy”, note: “Tokyo is the capital of Japan.” }, { country: “Jordan”, capital: “Amman”, region: “Asia”, difficulty: “medium”, note: “Amman is the capital of Jordan.” }, { country: “Kazakhstan”, capital: “Astana”, region: “Asia”, difficulty: “hard”, note: “Astana is the capital of Kazakhstan.” }, { country: “Kenya”, capital: “Nairobi”, region: “Africa”, difficulty: “easy”, note: “Nairobi is the capital of Kenya.” }, { country: “Kiribati”, capital: “South Tarawa”, region: “Oceania”, difficulty: “hard”, note: “South Tarawa is the capital of Kiribati.” }, { country: “Kosovo”, capital: “Pristina”, region: “Europe”, difficulty: “medium”, note: “Pristina is the capital of Kosovo.” }, { country: “Kuwait”, capital: “Kuwait City”, region: “Asia”, difficulty: “medium”, note: “Kuwait City is the capital of Kuwait.” }, { country: “Kyrgyzstan”, capital: “Bishkek”, region: “Asia”, difficulty: “hard”, note: “Bishkek is the capital of Kyrgyzstan.” }, { country: “Laos”, capital: “Vientiane”, region: “Asia”, difficulty: “hard”, note: “Vientiane is the capital of Laos.” }, { country: “Latvia”, capital: “Riga”, region: “Europe”, difficulty: “medium”, note: “Riga is the capital of Latvia.” }, { country: “Lebanon”, capital: “Beirut”, region: “Asia”, difficulty: “medium”, note: “Beirut is the capital of Lebanon.” }, { country: “Lithuania”, capital: “Vilnius”, region: “Europe”, difficulty: “medium”, note: “Vilnius is the capital of Lithuania.” }, { country: “Luxembourg”, capital: “Luxembourg”, region: “Europe”, difficulty: “medium”, note: “Luxembourg is both the country name and the capital name.” }, { country: “Madagascar”, capital: “Antananarivo”, region: “Africa”, difficulty: “hard”, note: “Antananarivo is the capital of Madagascar.” }, { country: “Malaysia”, capital: “Kuala Lumpur”, region: “Asia”, difficulty: “medium”, note: “Kuala Lumpur is used here; Putrajaya is the federal administrative centre.” }, { country: “Maldives”, capital: “Male”, region: “Asia”, difficulty: “hard”, note: “Male is the capital of Maldives.” }, { country: “Malta”, capital: “Valletta”, region: “Europe”, difficulty: “medium”, note: “Valletta is the capital of Malta.” }, { country: “Marshall Islands”, capital: “Majuro”, region: “Oceania”, difficulty: “hard”, note: “Majuro is the capital of the Marshall Islands.” }, { country: “Mexico”, capital: “Mexico City”, region: “Americas”, difficulty: “easy”, note: “Mexico City is the capital of Mexico.” }, { country: “Micronesia”, capital: “Palikir”, region: “Oceania”, difficulty: “hard”, note: “Palikir is the capital of Micronesia.” }, { country: “Moldova”, capital: “Chisinau”, region: “Europe”, difficulty: “medium”, note: “Chisinau is the capital of Moldova.” }, { country: “Mongolia”, capital: “Ulaanbaatar”, region: “Asia”, difficulty: “hard”, note: “Ulaanbaatar is the capital of Mongolia.” }, { country: “Montenegro”, capital: “Podgorica”, region: “Europe”, difficulty: “medium”, note: “Podgorica is the capital of Montenegro.” }, { country: “Morocco”, capital: “Rabat”, region: “Africa”, difficulty: “medium”, note: “Rabat is the capital of Morocco.” }, { country: “Mozambique”, capital: “Maputo”, region: “Africa”, difficulty: “medium”, note: “Maputo is the capital of Mozambique.” }, { country: “Myanmar”, capital: “Nay Pyi Taw”, region: “Asia”, difficulty: “hard”, note: “Nay Pyi Taw is the capital of Myanmar, not Yangon.” }, { country: “Nauru”, capital: “Yaren”, region: “Oceania”, difficulty: “hard”, note: “Yaren is commonly used as Nauru’s capital district answer.” }, { country: “Nepal”, capital: “Kathmandu”, region: “Asia”, difficulty: “medium”, note: “Kathmandu is the capital of Nepal.” }, { country: “Netherlands”, capital: “Amsterdam”, region: “Europe”, difficulty: “easy”, note: “Amsterdam is the capital of the Netherlands.” }, { country: “New Zealand”, capital: “Wellington”, region: “Oceania”, difficulty: “medium”, note: “Wellington is the capital of New Zealand, not Auckland.” }, { country: “Nigeria”, capital: “Abuja”, region: “Africa”, difficulty: “medium”, note: “Abuja is the capital of Nigeria, not Lagos.” }, { country: “North Korea”, capital: “Pyongyang”, region: “Asia”, difficulty: “medium”, note: “Pyongyang is the capital of North Korea.” }, { country: “North Macedonia”, capital: “Skopje”, region: “Europe”, difficulty: “medium”, note: “Skopje is the capital of North Macedonia.” }, { country: “Norway”, capital: “Oslo”, region: “Europe”, difficulty: “easy”, note: “Oslo is the capital of Norway.” }, { country: “Oman”, capital: “Muscat”, region: “Asia”, difficulty: “medium”, note: “Muscat is the capital of Oman.” }, { country: “Pakistan”, capital: “Islamabad”, region: “Asia”, difficulty: “medium”, note: “Islamabad is the capital of Pakistan.” }, { country: “Palau”, capital: “Ngerulmud”, region: “Oceania”, difficulty: “hard”, note: “Ngerulmud is the capital of Palau.” }, { country: “Panama”, capital: “Panama City”, region: “Americas”, difficulty: “medium”, note: “Panama City is the capital of Panama.” }, { country: “Papua New Guinea”, capital: “Port Moresby”, region: “Oceania”, difficulty: “medium”, note: “Port Moresby is the capital of Papua New Guinea.” }, { country: “Paraguay”, capital: “Asuncion”, region: “Americas”, difficulty: “medium”, note: “Asuncion is the capital of Paraguay.” }, { country: “Peru”, capital: “Lima”, region: “Americas”, difficulty: “easy”, note: “Lima is the capital of Peru.” }, { country: “Philippines”, capital: “Manila”, region: “Asia”, difficulty: “medium”, note: “Manila is the capital of the Philippines.” }, { country: “Poland”, capital: “Warsaw”, region: “Europe”, difficulty: “easy”, note: “Warsaw is the capital of Poland.” }, { country: “Portugal”, capital: “Lisbon”, region: “Europe”, difficulty: “easy”, note: “Lisbon is the capital of Portugal.” }, { country: “Qatar”, capital: “Doha”, region: “Asia”, difficulty: “medium”, note: “Doha is the capital of Qatar.” }, { country: “Romania”, capital: “Bucharest”, region: “Europe”, difficulty: “medium”, note: “Bucharest is the capital of Romania.” }, { country: “Rwanda”, capital: “Kigali”, region: “Africa”, difficulty: “medium”, note: “Kigali is the capital of Rwanda.” }, { country: “Samoa”, capital: “Apia”, region: “Oceania”, difficulty: “hard”, note: “Apia is the capital of Samoa.” }, { country: “Saudi Arabia”, capital: “Riyadh”, region: “Asia”, difficulty: “easy”, note: “Riyadh is the capital of Saudi Arabia.” }, { country: “Senegal”, capital: “Dakar”, region: “Africa”, difficulty: “medium”, note: “Dakar is the capital of Senegal.” }, { country: “Serbia”, capital: “Belgrade”, region: “Europe”, difficulty: “medium”, note: “Belgrade is the capital of Serbia.” }, { country: “Singapore”, capital: “Singapore”, region: “Asia”, difficulty: “medium”, note: “Singapore is both the country name and the capital name.” }, { country: “Slovakia”, capital: “Bratislava”, region: “Europe”, difficulty: “medium”, note: “Bratislava is the capital of Slovakia.” }, { country: “Slovenia”, capital: “Ljubljana”, region: “Europe”, difficulty: “medium”, note: “Ljubljana is the capital of Slovenia.” }, { country: “Solomon Islands”, capital: “Honiara”, region: “Oceania”, difficulty: “hard”, note: “Honiara is the capital of the Solomon Islands.” }, { country: “South Africa”, capital: “Pretoria”, region: “Africa”, difficulty: “hard”, note: “Pretoria is used here as South Africa’s executive capital answer.” }, { country: “South Korea”, capital: “Seoul”, region: “Asia”, difficulty: “easy”, note: “Seoul is the capital of South Korea.” }, { country: “Spain”, capital: “Madrid”, region: “Europe”, difficulty: “easy”, note: “Madrid is the capital of Spain.” }, { country: “Sri Lanka”, capital: “Sri Jayawardenepura Kotte”, region: “Asia”, difficulty: “hard”, note: “Sri Jayawardenepura Kotte is the official capital answer used here.” }, { country: “Suriname”, capital: “Paramaribo”, region: “Americas”, difficulty: “hard”, note: “Paramaribo is the capital of Suriname.” }, { country: “Sweden”, capital: “Stockholm”, region: “Europe”, difficulty: “easy”, note: “Stockholm is the capital of Sweden.” }, { country: “Switzerland”, capital: “Bern”, region: “Europe”, difficulty: “medium”, note: “Bern is the federal capital of Switzerland.” }, { country: “Tajikistan”, capital: “Dushanbe”, region: “Asia”, difficulty: “hard”, note: “Dushanbe is the capital of Tajikistan.” }, { country: “Tanzania”, capital: “Dodoma”, region: “Africa”, difficulty: “hard”, note: “Dodoma is the capital of Tanzania.” }, { country: “Thailand”, capital: “Bangkok”, region: “Asia”, difficulty: “easy”, note: “Bangkok is the capital of Thailand.” }, { country: “Tonga”, capital: “Nuku’alofa”, region: “Oceania”, difficulty: “hard”, note: “Nuku’alofa is the capital of Tonga.” }, { country: “Tunisia”, capital: “Tunis”, region: “Africa”, difficulty: “medium”, note: “Tunis is the capital of Tunisia.” }, { country: “Turkiye”, capital: “Ankara”, region: “Asia”, difficulty: “medium”, note: “Ankara is the capital of Turkiye, not Istanbul.” }, { country: “Turkmenistan”, capital: “Ashgabat”, region: “Asia”, difficulty: “hard”, note: “Ashgabat is the capital of Turkmenistan.” }, { country: “Tuvalu”, capital: “Funafuti”, region: “Oceania”, difficulty: “hard”, note: “Funafuti is the capital of Tuvalu.” }, { country: “Uganda”, capital: “Kampala”, region: “Africa”, difficulty: “medium”, note: “Kampala is the capital of Uganda.” }, { country: “Ukraine”, capital: “Kyiv”, region: “Europe”, difficulty: “medium”, note: “Kyiv is the capital of Ukraine.” }, { country: “United Arab Emirates”, capital: “Abu Dhabi”, region: “Asia”, difficulty: “medium”, note: “Abu Dhabi is the capital of the United Arab Emirates.” }, { country: “United Kingdom”, capital: “London”, region: “Europe”, difficulty: “easy”, note: “London is the capital of the United Kingdom.” }, { country: “United States”, capital: “Washington, D.C.”, region: “Americas”, difficulty: “easy”, note: “Washington, D.C. is the capital of the United States.” }, { country: “Uruguay”, capital: “Montevideo”, region: “Americas”, difficulty: “medium”, note: “Montevideo is the capital of Uruguay.” }, { country: “Uzbekistan”, capital: “Tashkent”, region: “Asia”, difficulty: “hard”, note: “Tashkent is the capital of Uzbekistan.” }, { country: “Vanuatu”, capital: “Port Vila”, region: “Oceania”, difficulty: “hard”, note: “Port Vila is the capital of Vanuatu.” }, { country: “Vatican City”, capital: “Vatican City”, region: “Europe”, difficulty: “medium”, note: “Vatican City is both the state name and the capital name.” }, { country: “Venezuela”, capital: “Caracas”, region: “Americas”, difficulty: “medium”, note: “Caracas is the capital of Venezuela.” }, { country: “Vietnam”, capital: “Hanoi”, region: “Asia”, difficulty: “medium”, note: “Hanoi is the capital of Vietnam.” }, { country: “Yemen”, capital: “Sanaa”, region: “Asia”, difficulty: “medium”, note: “Sanaa is the capital answer commonly used in geography lists.” }, { country: “Zambia”, capital: “Lusaka”, region: “Africa”, difficulty: “medium”, note: “Lusaka is the capital of Zambia.” }, { country: “Zimbabwe”, capital: “Harare”, region: “Africa”, difficulty: “medium”, note: “Harare is the capital of Zimbabwe.” } ];const scopeEl = root.querySelector(“#wcq-scope”); const directionEl = root.querySelector(“#wcq-direction”); const lengthEl = root.querySelector(“#wcq-length”); const startBtn = root.querySelector(“#wcq-start”); const nextBtn = root.querySelector(“#wcq-next”); const restartBtn = root.querySelector(“#wcq-restart”); const statusEl = root.querySelector(“#wcq-status”); const progressEl = root.querySelector(“#wcq-progress”); const scorelineEl = root.querySelector(“#wcq-scoreline”); const cardEl = root.querySelector(“#wcq-card”); const metaEl = root.querySelector(“#wcq-meta”); const questionEl = root.querySelector(“#wcq-question”); const optionsEl = root.querySelector(“#wcq-options”); const feedbackEl = root.querySelector(“#wcq-feedback”); const resultsEl = root.querySelector(“#wcq-results”); const resultTextEl = root.querySelector(“#wcq-result-text”); const bestTextEl = root.querySelector(“#wcq-best-text”); const reviewEl = root.querySelector(“#wcq-review”); const referenceBody = root.querySelector(“#wcq-reference-body”);let activePool = []; let questions = []; let review = []; let score = 0; let index = 0; let answered = false; const storageName = “worldCapitalsQuizBestV1”;function escapeText(value) { return String(value) .replace(/&/g, “&”) .replace(//g, “>”) .replace(/”/g, “"”) .replace(/’/g, “'”); }function shuffle(items) { const copy = items.slice(); for (let i = copy.length – 1; i > 0; i–) { const j = Math.floor(Math.random() * (i + 1)); const temp = copy[i]; copy[i] = copy[j]; copy[j] = temp; } return copy; }function getPool() { const scope = scopeEl.value; if (scope === “easy”) return data.filter(item => item.difficulty === “easy”); if (scope === “tricky”) return data.filter(item => item.difficulty === “hard”); if (scope === “africa”) return data.filter(item => item.region === “Africa”); if (scope === “americas”) return data.filter(item => item.region === “Americas”); if (scope === “asia”) return data.filter(item => item.region === “Asia”); if (scope === “europe”) return data.filter(item => item.region === “Europe”); if (scope === “oceania”) return data.filter(item => item.region === “Oceania”); return data.slice(); }function getQuestionType() { const direction = directionEl.value; if (direction === “mixed”) { return Math.random() > 0.5 ? “countryToCapital” : “capitalToCountry”; } return direction; }function makeQuestion(item) { const type = getQuestionType(); const answer = type === “countryToCapital” ? item.capital : item.country; const prompt = type === “countryToCapital” ? “What is the capital of ” + item.country + “?” : item.capital + ” is the capital of which country?”;const answerPool = activePool .map(entry => type === “countryToCapital” ? entry.capital : entry.country) .filter(value => value !== answer);const choices = shuffle([answer].concat(shuffle(answerPool).slice(0, 3)));return { prompt: prompt, answer: answer, choices: choices, item: item, type: type }; }function makeQuestionSet() { activePool = getPool(); const requested = lengthEl.value === “full” ? activePool.length : Number(lengthEl.value); const count = Math.min(requested, activePool.length); const selected = shuffle(activePool).slice(0, count); return selected.map(makeQuestion); }function setProgress() { const done = questions.length ? Math.round((index / questions.length) * 100) : 0; progressEl.style.width = done + “%”; scorelineEl.textContent = “Score: ” + score + ” / ” + questions.length; }function renderQuestion() { answered = false; nextBtn.disabled = true; feedbackEl.textContent = “”; feedbackEl.className = “wcq-feedback”; optionsEl.innerHTML = “”;const q = questions[index]; metaEl.textContent = “Question ” + (index + 1) + ” of ” + questions.length + ” • ” + q.item.region + ” • ” + q.item.difficulty; questionEl.textContent = q.prompt;q.choices.forEach(choice => { const button = document.createElement(“button”); button.type = “button”; button.className = “wcq-option”; button.textContent = choice; button.addEventListener(“click”, function () { chooseAnswer(button, choice, q); }); optionsEl.appendChild(button); });setProgress(); }function chooseAnswer(button, choice, q) { if (answered) return; answered = true;const isCorrect = choice === q.answer; if (isCorrect) score++;const optionButtons = optionsEl.querySelectorAll(“.wcq-option”); optionButtons.forEach(option => { option.disabled = true; if (option.textContent === q.answer) option.classList.add(“wcq-correct”); });if (!isCorrect) button.classList.add(“wcq-wrong”);feedbackEl.textContent = isCorrect ? “Correct. ” + q.item.note : “Not quite. The correct answer is ” + q.answer + “. ” + q.item.note;feedbackEl.className = isCorrect ? “wcq-feedback wcq-good” : “wcq-feedback wcq-bad”;review.push({ question: q.prompt, chosen: choice, answer: q.answer, correct: isCorrect });scorelineEl.textContent = “Score: ” + score + ” / ” + questions.length; nextBtn.disabled = false; }function startQuiz() { questions = makeQuestionSet(); review = []; score = 0; index = 0;resultsEl.classList.add(“wcq-hidden”); statusEl.classList.remove(“wcq-hidden”); cardEl.classList.remove(“wcq-hidden”);renderQuestion(); }function getBestScore() { try { return Number(localStorage.getItem(storageName) || 0); } catch (error) { return 0; } }function saveBestScore(percent) { try { localStorage.setItem(storageName, String(percent)); } catch (error) {} }function showResults() { cardEl.classList.add(“wcq-hidden”); resultsEl.classList.remove(“wcq-hidden”); progressEl.style.width = “100%”;const percent = Math.round((score / questions.length) * 100); let message = “Good practice round. Review the missed answers and try again.”; if (percent >= 90) message = “Excellent work. You know world capitals very well.”; else if (percent >= 70) message = “Strong result. A few capitals may need one more review.”; else if (percent >= 50) message = “Solid start. The review list will help you close the gaps.”;resultTextEl.innerHTML = “You scored ” + score + ” out of ” + questions.length + “ (” + percent + “%). ” + message;const previousBest = getBestScore(); if (percent > previousBest) { saveBestScore(percent); bestTextEl.innerHTML = “New best score on this browser: ” + percent + “%.”; } else { bestTextEl.innerHTML = “Best score saved on this browser: ” + previousBest + “%.”; }reviewEl.innerHTML = “”; review.forEach(item => { const li = document.createElement(“li”); li.innerHTML = item.correct ? “Correct: ” + escapeText(item.question) + ” Answer: ” + escapeText(item.answer) + “.” : “Missed: ” + escapeText(item.question) + ” Your answer: ” + escapeText(item.chosen) + “. Correct answer: ” + escapeText(item.answer) + “.”; reviewEl.appendChild(li); }); }function renderReferenceTable() { const sorted = data.slice().sort(function (a, b) { if (a.region !== b.region) return a.region.localeCompare(b.region); return a.country.localeCompare(b.country); });referenceBody.innerHTML = sorted.map(function (item) { return “” + “” + escapeText(item.country) + “” + “” + escapeText(item.capital) + “” + “” + escapeText(item.region) + “” + “” + escapeText(item.difficulty.charAt(0).toUpperCase() + item.difficulty.slice(1)) + “” + ““; }).join(“”); }startBtn.addEventListener(“click”, startQuiz);nextBtn.addEventListener(“click”, function () { index++; if (index >= questions.length) { showResults(); } else { renderQuestion(); } });restartBtn.addEventListener(“click”, startQuiz);renderReferenceTable(); })();

    Leave a Comment

    Your email address will not be published. Required fields are marked *

    Scroll to Top