<html lang="en">
<head>
    <meta charset="UTF-8"></meta>
    <meta content="width=device-width, initial-scale=1.0" name="viewport"></meta>
    <title>Grade 8, English, Public Services: worksheet</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 primary objective of public services?", "options": ["To earn profits for the government", "To generate qualitative development in living conditions", "To reduce taxes for citizens", "To promote private sector investments"], "a": "To generate qualitative development in living conditions"},
    {"q": "Which of the following is NOT an example of a public service?", "options": ["Education", "Water supply", "Entertainment streaming platforms", "Postal service"], "a": "Entertainment streaming platforms"},
    {"q": "Public services can be classified as:", "options": ["Free, concessional, or charged services", "Domestic and international services", "Urban and rural services", "Private and cooperative services"], "a": "Free, concessional, or charged services"},
    {"q": "What percentage of Earth’s water is usable as drinking water?", "options": ["50%", "10%", "Less than 1%", "25%"], "a": "Less than 1%"},
    {"q": "Which organization supplies drinking water in Sri Lanka?", "options": ["Department of Water Resources", "Ministry of Agriculture", "National Water Supply and Drainage Board", "Central Water Authority"], "a": "National Water Supply and Drainage Board"},
    {"q": "What is a major cause of water pollution?", "options": ["Overpopulation in urban areas", "Use of agrochemicals and factory waste", "Excessive rainfall", "Deforestation"], "a": "Use of agrochemicals and factory waste"},
    {"q": "Which disease has been completely eradicated in Sri Lanka according to the WHO?", "options": ["Tuberculosis", "Polio", "Malaria", "Dengue"], "a": "Malaria"},
    {"q": "What is the primary function of Sri Lanka’s health service?", "options": ["Generating profit from medical treatments", "Treating patients and preventing diseases", "Conducting private medical research", "Providing only indigenous treatments"], "a": "Treating patients and preventing diseases"},
    {"q": "Which of the following is NOT a medical system practiced in Sri Lanka?", "options": ["Ayurveda", "Unani", "Allopathy", "Acupuncture"], "a": "Acupuncture"},
    {"q": "Who introduced free education in Sri Lanka?", "options": ["King Parakramabahu", "Dr. C.W.W. Kannangara", "Mahatma Gandhi", "Sir Ponnambalam Ramanathan"], "a": "Dr. C.W.W. Kannangara"},
    {"q": "Until what age is education compulsory in Sri Lanka?", "options": ["10 years", "14 years", "16 years", "18 years"], "a": "16 years"},
    {"q": "What is the main objective of education as a public service?", "options": ["To create useful citizens", "To increase literacy rates only", "To limit access to higher education", "To provide employment opportunities"], "a": "To create useful citizens"},
    {"q": "Which service is specifically designed for school children?", "options": ["Gami Sariya", "Sisu Sariya", "Intercity Express", "Luxury Buses"], "a": "Sisu Sariya"},
    {"q": "What is a benefit of using public transport?", "options": ["It reduces fuel efficiency", "It decreases traffic congestion", "It increases travel costs", "It promotes private car ownership"], "a": "It decreases traffic congestion"},
    {"q": "Which organization provides train services in Sri Lanka?", "options": ["Ceylon Railway Authority", "Department of Railways", "National Transport Authority", "Sri Lanka Transport Board"], "a": "Department of Railways"},
    {"q": "Which organization supplies electricity to most of Sri Lanka?", "options": ["Lanka Electricity Company (Private) Limited", "Sri Lanka Power Authority", "Ceylon Electricity Board", "Ministry of Energy"], "a": "Ceylon Electricity Board"},
    {"q": "What percentage of Sri Lankan households had electricity by 2015?", "options": ["85%", "90%", "98.5%", "100%"], "a": "98.5%"},
    {"q": "Which is NOT a function of electricity?", "options": ["Lighting streets", "Supporting communication systems", "Polluting water sources", "Powering industries"], "a": "Polluting water sources"},
    {"q": "Why are communication services essential?", "options": ["To limit international relationships", "To meet busy schedules and expand relationships", "To reduce social connections", "To prevent technological advancements"], "a": "To meet busy schedules and expand relationships"},
    {"q": "Which is NOT an example of mass media?", "options": ["Television", "Newspapers", "Internet", "Textbooks"], "a": "Textbooks"},
    {"q": "What is the primary task of the Sri Lanka Police?", "options": ["Collecting taxes", "Conducting educational programs", "Ensuring public security and law enforcement", "Running public transport services"], "a": "Ensuring public security and law enforcement"},
    {"q": "Which security force is responsible for protecting the country from external threats?", "options": ["Sri Lanka Police", "Sri Lanka Navy", "Civil Security Force", "Ministry of Transport"], "a": "Sri Lanka Navy"},
    {"q": "What special section exists in police stations to address complaints from women and children?", "options": ["Family Support Unit", "Women and Children’s Desk", "Child Welfare Authority", "Community Service Unit"], "a": "Women and Children’s Desk"},
    {"q": "Which institution is responsible for protecting Sri Lanka’s wildlife?", "options": ["Central Environmental Authority", "Ministry of Agriculture", "Department of Wildlife Conservation", "Geological Survey and Mines Bureau"], "a": "Department of Wildlife Conservation"},
    {"q": "What is a major reason for environmental pollution?", "options": ["Urban afforestation", "Voluntary cleanup programs", "Human activities", "Increased rainfall"], "a": "Human activities"},
    {"q": "What is the motto of cooperatives in Sri Lanka?", "options": ["Unity in Diversity", "One for All and All for One", "Progress through Service", "Service Above Self"], "a": "One for All and All for One"},
    {"q": "What are the main functions of the Central Environmental Authority?", "options": ["Managing international trade", "Regulating environmental laws and policies", "Monitoring technological advancements", "Coordinating educational programs"], "a": "Regulating environmental laws and policies"},
    {"q": "Which service helps protect the coastlines of Sri Lanka?", "options": ["Geological Survey Bureau", "Coast Conservation Department", "Marine Biology Institute", "Wildlife Protection Unit"], "a": "Coast Conservation Department"},
    {"q": "How can citizens contribute to environmental conservation?", "options": ["Avoiding participation in environmental programs", "Supporting laws that protect the environment", "Ignoring waste disposal regulations", "Focusing only on urban development"], "a": "Supporting laws that protect the environment"},
    {"q": "Which government program focuses on providing housing for low-income families?", "options": ["Samurdhi Program", "Udagama Program", "Gami Saviya Program", "Shelter First Program"], "a": "Udagama Program"},
    {"q": "What is the primary responsibility of the Sri Lanka Transport Board (SLTB)?", "options": ["Managing luxury hotels", "Providing affordable public transport", "Operating private buses", "Importing vehicles"], "a": "Providing affordable public transport"},
    {"q": "Which of the following is a major focus of Sri Lanka’s health education programs?", "options": ["Teaching about non-communicable diseases", "Creating herbal medicines", "Conducting fitness camps", "Managing hospital finances"], "a": "Teaching about non-communicable diseases"},
    {"q": "What is the purpose of the \"Sisu Sariya\" program?", "options": ["To provide free textbooks", "To offer free transport for students", "To create new schools", "To fund university education"], "a": "To offer free transport for students"},
    {"q": "What role does the \"Family Health Bureau\" play?", "options": ["Preventing family disputes", "Promoting maternal and child health", "Conducting traffic safety programs", "Managing public libraries"], "a": "Promoting maternal and child health"},
    {"q": "Which type of cooperative society focuses on agricultural products?", "options": ["Credit Cooperative Societies", "Agro Producers' Cooperative Societies", "Housing Cooperative Societies", "Hospital Cooperative Societies"], "a": "Agro Producers' Cooperative Societies"},
    {"q": "Which government service helps in disaster relief efforts?", "options": ["Ministry of Education", "Civil Security Force", "Ministry of Tourism", "Department of Agriculture"], "a": "Civil Security Force"},
    {"q": "What is one key responsibility of the National Dengue Control Unit?", "options": ["Promoting immunizations for children", "Controlling dengue outbreaks", "Providing herbal medicines", "Conducting traffic safety awareness programs"], "a": "Controlling dengue outbreaks"},
    {"q": "Which organization oversees marine environmental protection?", "options": ["Central Environmental Authority", "Geological Survey Bureau", "Marine Environmental Protection Authority", "Department of Forestry"], "a": "Marine Environmental Protection Authority"},
    {"q": "What is the main benefit of the \"Gami Sariya\" program?", "options": ["Providing luxury travel services", "Offering transport in rural areas", "Promoting train journeys", "Reducing transport fares in urban areas"], "a": "Offering transport in rural areas"},
    {"q": "What should citizens do to support public health services?", "options": ["Ignore medical advice", "Follow good health habits", "Consume processed food", "Avoid using health services"], "a": "Follow good health habits"}
]

        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, English, Public Services: worksheet</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>
