<html lang="en">
<head>
    <meta charset="UTF-8"></meta>
    <meta content="width=device-width, initial-scale=1.0" name="viewport"></meta>
    <title>Grade 8, Geography, The Solar System, worksheet 2</title>
    <style>
    
            h1 {
            font-size: 24px; /* Adjust this value as needed */
            color: green;
        }
        .correct {
            color: green;
        }
        .wrong {
            color: red;
        }
        body, html {
            -webkit-user-select: none; /* Safari */
            -moz-user-select: none; /* Firefox */
            -ms-user-select: none; /* Internet Explorer/Edge */
            user-select: none; /* Non-prefixed version, currently supported by Chrome, Opera, and Edge */
        }
        label {
            font-size: 20px;
        }
        p {
            font-size: 20px;
        }
        .question {
            display: flex;
            align-items: center;
            margin-bottom: 15px;
            font-size: 20px; /* Ensure font size consistency */
        }
        .question label {
            margin-right: 10px;
        }
        .question input[type="text"] {
            width: 50px;
            text-align: center;
            margin-right: 10px;
            font-size: 20px; /* Match font size with the label */
        }
        .question .answer-display {
            font-size: 20px;
            margin-left: 10px;
        }
        .exercise-instructions {
            font-size: 20px;
            margin-bottom: 20px;
            font-weight: bold; /* Make the instructions bold */
        }
        .result-images img {
            width: 50px;
            height: 50px;
        }
        .buttons {
            margin-top: 20px;
        }
        .buttons button {
            font-size: 18px;
            padding: 10px 20px;
            margin: 5px;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }
        .check-button {
            background-color: #4CAF50; /* Green */
        }
        .retry-button {
            background-color: #f44336; /* Red */
        }
        .marks {
            color: blue;
            font-size: 20px;
            font-weight: bold;
        }
    </style>
    <script>
        document.addEventListener('contextmenu', event => event.preventDefault());

        document.addEventListener('keydown', event => {
            if (event.key === "F12" || (event.ctrlKey && event.shiftKey && event.key === 'I') || (event.ctrlKey && event.shiftKey && event.key === 'J') || (event.ctrlKey && event.key === 'U')) {
                event.preventDefault();
            }
        });

        document.addEventListener('copy', event => {
            event.preventDefault();
        });

        function shuffle(array) {
            for (let i = array.length - 1; i > 0; i--) {
                const j = Math.floor(Math.random() * (i + 1));
                [array[i], array[j]] = [array[j], array[i]];
            }
            return array;
        }

const questions1 = [
    {"q": "What is the solar system composed of?", "options": ["Only planets", "Only stars", "The Sun, planets, and other celestial bodies", "Only the Moon"], "a": "The Sun, planets, and other celestial bodies"},
    {"q": "How old is the solar system?", "options": ["100 million years", "4600 million years", "6000 million years", "10,000 million years"], "a": "4600 million years"},
    {"q": "What are stars?", "options": ["Celestial bodies that emit light and heat", "Celestial bodies that reflect light", "Celestial bodies that orbit planets", "Pieces of asteroids"], "a": "Celestial bodies that emit light and heat"},
    {"q": "Why do planets and the Moon shine in the night sky?", "options": ["They emit their own light", "They reflect sunlight", "They are made of burning gas", "They are covered in ice"], "a": "They reflect sunlight"},
    {"q": "What is the Sun?", "options": ["A planet", "A moon", "A star", "An asteroid"], "a": "A star"},
    {"q": "Which celestial body holds 99.86% of the solar system's total mass?", "options": ["Earth", "Jupiter", "The Sun", "Saturn"], "a": "The Sun"},
    {"q": "What are smaller planets called?", "options": ["Natural satellites", "Dwarf planets", "Meteors", "Asteroids"], "a": "Dwarf planets"},
    {"q": "What are asteroids?", "options": ["Fragments of rock left over from the solar system’s formation", "Large stars", "Planets", "Pieces of comets"], "a": "Fragments of rock left over from the solar system’s formation"},
    {"q": "Which of the following is not a dwarf planet?", "options": ["Pluto", "Eris", "Mercury", "Haumea"], "a": "Mercury"},
    {"q": "Where is the Asteroid Belt located?", "options": ["Between Mars and Jupiter", "Between Earth and Venus", "Beyond Neptune", "Between Mercury and Venus"], "a": "Between Mars and Jupiter"},
    {"q": "How many planets are in the solar system?", "options": ["7", "8", "9", "10"], "a": "8"},
    {"q": "Which planet is closest to the Sun?", "options": ["Venus", "Earth", "Mercury", "Mars"], "a": "Mercury"},
    {"q": "Which is the largest planet in the solar system?", "options": ["Earth", "Saturn", "Neptune", "Jupiter"], "a": "Jupiter"},
    {"q": "What is the second planet from the Sun?", "options": ["Mars", "Earth", "Venus", "Mercury"], "a": "Venus"},
    {"q": "What is the only planet known to support life?", "options": ["Mars", "Jupiter", "Earth", "Venus"], "a": "Earth"},
    {"q": "How many moons does Earth have?", "options": ["1", "2", "4", "0"], "a": "1"},
    {"q": "Which planet has the most natural satellites?", "options": ["Earth", "Venus", "Jupiter", "Mars"], "a": "Jupiter"},
    {"q": "What are celestial objects that orbit planets called?", "options": ["Meteoroids", "Comets", "Natural satellites", "Asteroids"], "a": "Natural satellites"},
    {"q": "Which planet has no moons?", "options": ["Earth", "Venus", "Saturn", "Neptune"], "a": "Venus"},
    {"q": "What is the name of Mars’ two moons?", "options": ["Europa and Callisto", "Titan and Enceladus", "Phobos and Deimos", "Io and Ganymede"], "a": "Phobos and Deimos"},
    {"q": "What is Saturn famous for?", "options": ["Its red color", "Its giant storm", "Its rings", "Its slow rotation"], "a": "Its rings"},
    {"q": "Which planet rotates from east to west?", "options": ["Venus", "Earth", "Mars", "Neptune"], "a": "Venus"},
    {"q": "What is Neptune’s color?", "options": ["Red", "Blue", "Yellow", "Brown"], "a": "Blue"},
    {"q": "Which planet is known as the Red Planet?", "options": ["Earth", "Jupiter", "Mars", "Neptune"], "a": "Mars"},
    {"q": "What is the main component of Venus' atmosphere?", "options": ["Oxygen", "Nitrogen", "Carbon dioxide", "Hydrogen"], "a": "Carbon dioxide"},
    {"q": "Who used a telescope for the first time to observe the sky?", "options": ["Isaac Newton", "Galileo Galilei", "Johannes Kepler", "Albert Einstein"], "a": "Galileo Galilei"},
    {"q": "In which year was Pluto reclassified as a dwarf planet?", "options": ["1999", "2006", "2012", "2019"], "a": "2006"},
    {"q": "What does NASA stand for?", "options": ["National Aeronautics and Space Administration", "New Astronomy and Space Academy", "National Air and Space Authority", "None of the above"], "a": "National Aeronautics and Space Administration"},
    {"q": "Who was the first person to walk on the Moon?", "options": ["Yuri Gagarin", "Neil Armstrong", "Buzz Aldrin", "John Glenn"], "a": "Neil Armstrong"},
    {"q": "What festival is celebrated based on the Sun’s movement in Sri Lanka?", "options": ["Christmas", "Sinhala & Hindu New Year", "Deepavali", "Eid"], "a": "Sinhala & Hindu New Year"},
    {"q": "What was the name of the first artificial satellite launched into space?", "options": ["Apollo 11", "Sputnik 1", "Voyager 1", "Hubble"], "a": "Sputnik 1"},
    {"q": "Which planet was recently hypothesized to exist but not yet confirmed?", "options": ["Planet X", "Planet 9", "Eris", "Haumea"], "a": "Planet 9"},
    {"q": "What is the main function of the Hubble Space Telescope?", "options": ["To observe deep space", "To communicate with astronauts", "To land on planets", "To track asteroids"], "a": "To observe deep space"},
    {"q": "What is a solar storm?", "options": ["A hurricane in space", "A large explosion of energy from the Sun", "A storm that occurs only on Jupiter", "A planetary dust storm"], "a": "A large explosion of energy from the Sun"},
    {"q": "The International Space Station (ISS) is mainly used for:", "options": ["Mining asteroids", "Space exploration and research", "Storing satellites", "Fueling rockets"], "a": "Space exploration and research"},
    {"q": "What is the main fuel source for the Sun’s energy?", "options": ["Hydrogen", "Oxygen", "Helium", "Carbon"], "a": "Hydrogen"},
    {"q": "Which scientific organization is responsible for major space research in the USA?", "options": ["ISRO", "NASA", "ESA", "Roscosmos"], "a": "NASA"},
    {"q": "What type of reaction occurs in the Sun’s core to produce energy?", "options": ["Chemical combustion", "Nuclear fission", "Nuclear fusion", "Solar evaporation"], "a": "Nuclear fusion"},
    {"q": "What is the temperature of the Sun’s core?", "options": ["6000°C", "100,000°C", "15 million°C", "100 million°C"], "a": "15 million°C"},
    {"q": "What force keeps planets in orbit around the Sun?", "options": ["Magnetic force", "Friction", "Gravity", "Tension"], "a": "Gravity"},
    {"q": "Which of the following is NOT a dwarf planet?", "options": ["Pluto", "Ceres", "Titan", "Haumea"], "a": "Titan"},
    {"q": "How many dwarf planets are currently recognized?", "options": ["3", "5", "8", "10"], "a": "5"},
    {"q": "Where is Ceres located?", "options": ["Kuiper Belt", "Between Mars and Jupiter", "Beyond Neptune", "In the Andromeda Galaxy"], "a": "Between Mars and Jupiter"},
    {"q": "What is the Kuiper Belt?", "options": ["A region of space between Mars and Jupiter", "A region beyond Neptune filled with icy objects", "A black hole near the Sun", "A type of asteroid field"], "a": "A region beyond Neptune filled with icy objects"},
    {"q": "What are meteoroids?", "options": ["Large asteroids", "Small rocky objects moving in space", "Frozen gases in the Kuiper Belt", "A type of planet"], "a": "Small rocky objects moving in space"},
    {"q": "Which of the following is a belief connected to the Moon and Sun in Sri Lanka?", "options": ["Worshiping them as gods", "Using them for weather predictions", "Organizing farming activities based on them", "All of given answers"], "a": "All of given answers"},
    {"q": "What festival is based on the movement of the Sun in Sri Lanka?", "options": ["Christmas", "Vesak Poya", "Sinhala and Hindu New Year", "Deepavali"], "a": "Sinhala and Hindu New Year"},
    {"q": "What is astrology?", "options": ["The scientific study of celestial bodies", "The belief that celestial movements influence human life", "A method of space exploration", "The study of meteors"], "a": "The belief that celestial movements influence human life"},
    {"q": "What influences traditional farming activities in Sri Lanka?", "options": ["Phases of the Moon", "Positions of the stars", "The movement of Mars", "Earth’s gravity"], "a": "Phases of the Moon"},
    {"q": "Which ancient civilization made significant contributions to early astronomy?", "options": ["Greeks", "Romans", "Egyptians", "All of given answers"], "a": "All of given answers"}
]

        function displayQuestions() {
            shuffle(questions1);

            const questionsContainer1 = document.getElementById('questionsContainer1');
            questionsContainer1.innerHTML = `
                <div class="exercise-instructions">Exercise 1: Choose the correct answer.</div>
            `;
            questions1.forEach((question, index) => {
                const options = shuffle(question.options).map(option => 
                    `<label>
                        <input type="radio" name="question1${index}" value="${option}">
                        ${option}
                    </label><br>`
                ).join('');

                const questionHTML = `
                    <div>
                        <p>${index + 1}. ${question.q}</p>
                        ${options}
                        <p id="feedback1${index}"></p>
                    </div>
                `;
                questionsContainer1.innerHTML += questionHTML;
            });

   





            document.querySelectorAll('#questionsContainer4 .remainder-input').forEach(input => {
                input.addEventListener('keydown', event => {
                    if (event.key === 'Enter') {
                        event.preventDefault();
                        const quotientInputs = Array.from(document.querySelectorAll('#questionsContainer4 .quotient-input'));
                        const currentIndex = quotientInputs.indexOf(input.parentElement.querySelector('.quotient-input'));
                        const nextRowQuotient = quotientInputs[currentIndex + 1];
                        if (nextRowQuotient) {
                            nextRowQuotient.focus();
                        }
                    }
                });
            });
        }

        function checkAnswers() {
            let score1 = 0;

            const totalQuestions1 = questions1.length;


            // Check answers for Exercise 1
            questions1.forEach((question, index) => {
                const selectedAnswer = document.querySelector(`input[name="question1${index}"]:checked`);
                const feedback = document.getElementById(`feedback1${index}`);

                if (selectedAnswer) {
                    if (selectedAnswer.value === question.a) {
                        feedback.innerHTML = '<span class="correct">Correct!</span>';
                        score1++;
                    } else {
                        feedback.innerHTML = `<span class="wrong">Wrong! The correct answer is: ${question.a}</span>`;
                    }
                } else {
                    feedback.innerHTML = `<span class="wrong">No answer selected. The correct answer is: ${question.a}</span>`;
                }
            });

            // Hide the "Check Answers" button after checking the answers

            document.getElementById('checkAnswersButton').style.display = 'none';

            // Calculate percentage
            const totalScore = score1;
            const totalQuestions = totalQuestions1;
            const percentage = (totalScore / totalQuestions) * 100;

            // Display individual and total results
            const resultText = `
                <div class="marks">Exercise 1 Score: ${score1}/${totalQuestions1}</div>

                <div class="marks"><strong>Total Score: ${totalScore}/${totalQuestions} (${percentage.toFixed(2)}%)</strong></div>
                <div>${getGradeFeedback(percentage)}</div>
                ${percentage === 100 ? '<div class="result-images"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2-ubMp9uAa6YdIe_kBJ5KHLm9lvzYdypfXpvij7BtmhFONiFt9j3D7r1V_M4wPnIkIsocug7NzEHIYr35z4J8KqsKIXqw2YCpi_HY6C3OiGkC9ADz9Ee2ne-gO0VgladOU5r5FbSk2jrIy8rdgM0G895UGG_ayI0Bkeh1CU5ZswyoeWQyHsaICeB6Z7k/s1600/star.jpg" alt="Star"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQ6tyya1xafjBJ3poGtUE9T5Tj-YAnRsc1SnByb_1pebaR-LBVZYtBJyZ2y_0BMix1y5byTXw2FDWyRzK7_6gAq3duQofJEibkjoQYhCQ-qGcisr9uR6jJ2IN0P510osrhyphenhyphencjOEYoC9uuYnnnL6L61GTgAoWhtcUHu2sXs5RTwaLZAsIwGlePDW-ZXBb8/s1600/happy%20face.jpg" alt="Happy Face"></div>' : ''}
            `;
            document.getElementById('result').innerHTML = resultText;
            document.getElementById('result').style.fontSize = '20px'; // Ensure font size matches questions
            document.getElementById('result').style.fontWeight = 'bold'; // Make the result text bold
            document.querySelectorAll('.marks').forEach(element => {
                element.style.color = 'blue'; // Set color for all marks
            });
        }

        function getGradeFeedback(percentage) {
            if (percentage <= 25) {
                return 'Keep trying, you are improving! Keep up the effort!';
            } else if (percentage <= 50) {
                return 'Good job! You are doing well, keep practicing!';
            } else if (percentage <= 75) {
                return 'Great work! You are almost there, keep it up!';
            } else if (percentage <= 85) {
                return 'Excellent! You are doing fantastic!';
            } else if (percentage <= 99) {
                return 'Almost perfect! Keep up the great work!';
            } else {
                return 'Perfect score! You did an amazing job!';
            }
        }

        window.onload = function() {
            displayQuestions();

            document.getElementById('checkAnswersButton').addEventListener('click', checkAnswers);
document.getElementById('retryButton').addEventListener('click', () => {
    location.reload(); // This will refresh the page
       document.getElementById('result').innerHTML = '';
                displayQuestions();
            });
        }
    </script>
</head>
<body>
  
   <h1>Grade 8, Geography, The Solar System, worksheet 2</h1> <!-- Add a title heading here -->
  
  
    <div id="questionsContainer1"></div>

    <div id="result"></div>
    <div class="buttons">
        <button class="check-button" id="checkAnswersButton">Check Answers</button>
        <button class="retry-button" id="retryButton">Retry</button>
    </div>
</body>
</html>
