Multiple choice technology programming languages

Consider the following program code: @array = (10, Masami, 10..13, Niklas); for (\$i = 1; \$i < \$#array; \$i++) { print(\$array[\$i] ); } What is the result of executing this program code?

  1. The code will output the following: Masami 10 11 12 13

  2. The code will output the following: 10 Masami 10 11 12 13

  3. The code will output the following: 10 Masami 11 12 13 Niklas

  4. The code will output the following: Masami 10 11 12 13 Niklas

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The array @array is constructed as (10, 'Masami', 10, 11, 12, 13, 'Niklas') because 10..13 expands to (10,11,12,13). The for loop runs from i=1 to i < $#array (which is 6), so it iterates i=1,2,3,4,5. This prints elements at indices 1 through 5: 'Masami', 10, 11, 12, 13.