ProgrammingModerateSSC CGL Tier 2 · IBPS PO Mains

The string "Programming Language" is taken in lowercase and the procedure below counts its vowels (a, e, i, o, u). What is printed?

The string "Programming Language" is taken in lowercase and the procedure below counts its vowels (a, e, i, o, u). What is printed?
count = 0
for each character c of the lowercase string
    if c is one of a, e, i, o, u then count = count + 1
end for
Print count
  1. A. 12
  2. B. 2
  3. C. 19
  4. D. 7

Correct answer: D. 7

The vowels are o, a, i, a, u, a and e, which is 7. Counting the consonants gives 12, counting the words gives 2, and counting all letters gives 19.

More Pseudocode and Code Tracing questions

Exams that ask this topic