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- A. 5
- B. 4
- C. 6
- D. 3
Correct answer: A. 5
The vowels in 'education' are e, u, a, i, o: 5.
Practise more Pseudocode and Code Tracing questionsPseudocode and Code Tracing: notes and key points
More Pseudocode and Code Tracing questions
- What will be the output of the following pseudocode? Function f(Integer n) if (n <= 1) return 1 end if return f(n - 1) + f(n - 2) end…
- What will be the output of the following pseudocode? Integer x = 1, i for (i = 1; i <= 5; i = i + 1) x = (x 3) mod 7 end for Print x
- What will be the output of the following pseudocode? Integer i, s = 0 for (i = 1; i <= 10; i = i + 1) if (i mod 3 == 0) continue end if if…
- What will be the output of the following pseudocode? Integer n = 4021, r = 0 while (n > 0) r = r 10 + (n mod 10) n = n / 10 end while…
- What will be the output of the following pseudocode? Procedure p(Integer a[], Integer x) a[0] = a[0] + x x = x + 100 a[1] = x return x end…
- What will be the output of the following pseudocode? Integer c = 0 Function inc() c = c + 1 return c end function if (inc() > 0 || inc() >…