Multiple choice technology programming languages

@array = (1,2,3,4,5) $scalar1, $scalar2 = @array; print “Scalar1 value is $scalar1”; print “Scalar2 value is $scalar2”;

  1. 1 2

  2. 4 5

  3. 5 5

  4. Null value 5

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

When assigning an array to a list of scalars, array elements are assigned left-to-right. $scalar1 gets the first element (1), but there are more scalars than elements, so remaining scalars get undef. The print shows 'Null value' (undef rendered as empty) and '5' ($scalar2 never got assigned, defaulting to undef/empty).