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- A. 12
- B. 2
- C. 19
- 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.
Practise more Pseudocode and Code Tracing questionsPseudocode and Code Tracing: notes and key points
More Pseudocode and Code Tracing questions
- For the bracket string "(()(()))", the procedure below tracks the nesting depth and prints the maximum depth reached. What is printed?…
- Longest common prefix of the words "flower", "flow" and "flight" is found by comparing characters column by column until a mismatch. The…
- The words of "the sky is blue" are reversed in order (the words themselves are kept). The procedure below does this and prints the result…
- The string "bananana" is searched for "ana" with overlapping occurrences allowed. The procedure below counts the start positions of…
- Strings are compressed in place by writing each run of equal characters as the character followed by the run length (a count of 1 is…
- Using Booth-style thinking, the lexicographically smallest rotation of the string "banana" is wanted. The procedure below tries every…