ProgrammingModerateTCS NQT · Infosys

What will be the output of the following pseudocode?

What will be the output of the following pseudocode?
String s = "education"
Integer i, c = 0
for (i = 0; i < length(s); i = i + 1)
    if (s[i] is one of 'a', 'e', 'i', 'o', 'u')
        c = c + 1
    end if
end for
Print c
  1. A. 5
  2. B. 4
  3. C. 6
  4. D. 3

Correct answer: A. 5

The vowels in 'education' are e, u, a, i, o: 5.

More Pseudocode and Code Tracing questions

Exams that ask this topic