Skip to content
MathsGenie logo
Open app

Course home

  1. IGCSE
  2. Computer Science Edexcel
  3. Question bank

Algorithms

EasyMedium
123456789101112131415161718
Question 9

An algorithm is needed to count and display the number of uppercase vowels in a string. The uppercase vowels are 'A', 'E', 'I', 'O', and 'U'.

The completed algorithm must:

  • Initialize a counter variable
  • Loop through each character of the string to count the uppercase vowels
  • Create a message as a single string (e.g. 'Total uppercase vowels: 4')
  • Print the message to the display

Complete the pseudocode algorithm below by writing the missing statements in the spaces provided.

SET phrase TO 'AERODYNAMIC'

// 1. Initialize the counter variable

FOR EACH character FROM phrase DO

    // 2. Check if the character is an uppercase vowel

        // 3. Increment the counter

    // 4. End the conditional block

END FOREACH

// 5. Create the combined message string and print it

[5]

Algorithms Questions

  1. IGCSE
  2. /Computer Science
  3. /Algorithms