What will be printed out as a result of the following code execution:
 
class Test 
{ 
    static void Main(string[] args) 
    { 
          char[] vowels = {'a','e','i','o','u'};
          for (int i = 1; i <= vowels.Length; i++)         
          Console.Write(vowels[i] + " "); 
      } 
}
 
Explanation
Array indices start from 0. The following cycle should be used to iterate over all array elements:
 for (int i = 0; i < vowels.Length; i++) 
(strictly less).
IndexOutOfRangeException will occur in the mentioned case.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты