What will be the output of the following pseudocode?
Note: array index starts from 0
Integer arr[7] = {11, 23, 8, 19, 23, 21, 6}
Integer i, first, second
Set first = 0, second = 0
for (each i from 0 to 6)
if (arr[i] > first)
second = first
first = arr[i]
else if (arr[i] > second)
second = arr[i]
End if
End for
Print second21
11
6
23
The verified answer and full solution are one login away
Every answer here is machine verified, with a step-by-step solution that teaches the method. Your login also unlocks a 7-question mock preview in the real exam interface.
Log in to see the answer