<html lang="en">
<head>
    <meta charset="UTF-8"></meta>
    <meta content="width=device-width, initial-scale=1.0" name="viewport"></meta>
    <title>Grade 3, Primary Science, Types of Plants, 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 are the largest plants?", "options": ["Herbs", "Trees", "Shrubs", "Climbers"], "a": "Trees"},
    {"q": "Trees usually have:", "options": ["Soft stems", "A single woody stem", "Many stems", "No stems"], "a": "A single woody stem"},
    {"q": "How do trees grow taller each year?", "options": ["By growing new leaves", "By growing a new coat or skin", "By growing flowers", "By growing roots"], "a": "By growing a new coat or skin"},
    {"q": "Where do trees grow close to each other?", "options": ["In gardens", "In thick forest jungles", "In deserts", "In water"], "a": "In thick forest jungles"},
    {"q": "What do trees need to reach for?", "options": ["Water", "Sunlight", "Soil", "Air"], "a": "Sunlight"},
    {"q": "Climbers have:", "options": ["Strong stems", "Weak stems", "No stems", "Hard stems"], "a": "Weak stems"},
    {"q": "What do climbers climb on?", "options": ["Sticks, walls, or trees", "The ground", "Water", "Rocks"], "a": "Sticks, walls, or trees"},
    {"q": "Creepers grow:", "options": ["Upwards", "Along the ground", "In water", "On trees"], "a": "Along the ground"},
    {"q": "Which plant is a creeper?", "options": ["Grapevine", "Watermelon", "Mint", "Cactus"], "a": "Watermelon"},
    {"q": "Which plant is a climber?", "options": ["Watermelon", "Grapevine", "Mint", "Cactus"], "a": "Grapevine"},
    {"q": "Where do cactuses usually grow?", "options": ["In wet soil", "In dry grasslands or semi-deserts", "In forests", "In water"], "a": "In dry grasslands or semi-deserts"},
    {"q": "What do cactuses have instead of leaves?", "options": ["Flowers", "Spines (thorns)", "Soft stems", "Bark"], "a": "Spines (thorns)"},
    {"q": "Cactuses are adapted to:", "options": ["Cold climates", "Dry climates", "Wet climates", "Dark climates"], "a": "Dry climates"},
    {"q": "What are the spines on a cactus?", "options": ["Modified leaves", "Modified stems", "Modified roots", "Modified flowers"], "a": "Modified leaves"},
    {"q": "Cactuses store water in their:", "options": ["Leaves", "Stems", "Roots", "Flowers"], "a": "Stems"},
    {"q": "Shrubs are:", "options": ["Large plants", "Small plants", "Tall plants", "Water plants"], "a": "Small plants"},
    {"q": "Shrubs have:", "options": ["Soft stems", "Hard stems", "No stems", "Weak stems"], "a": "Hard stems"},
    {"q": "Shrubs grow:", "options": ["Only in water", "Near the ground", "On trees", "In deserts"], "a": "Near the ground"},
    {"q": "Which of these is a shrub?", "options": ["Rose", "Mint", "Watermelon", "Cactus"], "a": "Rose"},
    {"q": "Shrubs are different from herbs because they have:", "options": ["Soft stems", "Hard stems", "No stems", "Weak stems"], "a": "Hard stems"},
    {"q": "Herbs have:", "options": ["Hard stems", "Soft and weak stems", "No stems", "Woody stems"], "a": "Soft and weak stems"},
    {"q": "Herbs are used for:", "options": ["Building houses", "Making medicine and perfumes", "Making furniture", "Making paper"], "a": "Making medicine and perfumes"},
    {"q": "Which of these is an herb?", "options": ["Mint", "Rose", "Cactus", "Tree"], "a": "Mint"},
    {"q": "Weeds are a type of:", "options": ["Tree", "Herb", "Shrub", "Climber"], "a": "Herb"},
    {"q": "Weeds grow:", "options": ["Only in gardens", "Where we don’t want them", "In water", "On trees"], "a": "Where we don’t want them"},
    {"q": "Grasses can be:", "options": ["Only green", "Short or tall, brown, yellow, or green", "Only tall", "Only short"], "a": "Short or tall, brown, yellow, or green"},
    {"q": "Water plants grow:", "options": ["In dry soil", "In water or wet soil", "On trees", "In deserts"], "a": "In water or wet soil"},
    {"q": "Reeds are a type of:", "options": ["Tree", "Grass", "Shrub", "Herb"], "a": "Grass"},
    {"q": "Reeds usually grow:", "options": ["In deserts", "Near or in water", "On mountains", "In forests"], "a": "Near or in water"},
    {"q": "Which of these is a water plant?", "options": ["Cactus", "Lily", "Mint", "Rose"], "a": "Lily"},
    {"q": "Plants are:", "options": ["Non-living things", "Living things", "Man-made things", "Rocks"], "a": "Living things"},
    {"q": "Plants grow in:", "options": ["Soil and water", "Air only", "Rocks only", "Deserts only"], "a": "Soil and water"},
    {"q": "Which part of a tree increases in size each year?", "options": ["Leaves", "Trunk", "Flowers", "Roots"], "a": "Trunk"},
    {"q": "What do plants need to grow?", "options": ["Sunlight, water, and soil", "Only sunlight", "Only water", "Only soil"], "a": "Sunlight, water, and soil"},
    {"q": "Which of these is NOT a type of plant?", "options": ["Tree", "Shrub", "Rock", "Herb"], "a": "Rock"},
    {"q": "Which plant is used to make perfumes?", "options": ["Tree", "Herb", "Cactus", "Grass"], "a": "Herb"},
    {"q": "Which plant has a dome shape?", "options": ["Tree", "Herb", "Cactus", "Grass"], "a": "Tree"},
    {"q": "Which plant has spines?", "options": ["Cactus", "Mint", "Rose", "Grass"], "a": "Cactus"},
    {"q": "Which plant is used to flavor food?", "options": ["Herb", "Tree", "Shrub", "Grass"], "a": "Herb"},
    {"q": "Which plant grows where we don’t want it?", "options": ["Herb", "Weed", "Tree", "Shrub"], "a": "Weed"}
]

        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 3, Primary Science, Types of Plants, 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>
