Multiple choice

@alpha = (a..z); print "Before splicing - @alphan";

splice (@alpha, 5, 3, "af".."ah"); print "After splicing - @alphan";

This code produces the following result Before splicing - a b c d e f g h i j k l m n o p q r s t u v w x y z After splicing - a b c d e af ag ah i j k l m n o p q r s t u v w x y z

Which of the following statement is correct about the above piece of code. (Multiple answers mighe be correct)

  1. splice( ) function has the first argument as the array name.

  2. splice( ) function has the second argument as the OFFSET. Starting position in the array. Here the offset is 5

  3. splice() function has the third argument as the LENGTH. The function replaces the elements starting from the OFFSET and count the number of elements mentioned in the LENGTH parameter. Here 3 is the length. So the elements f g h are picked for replacement

  4. splice() function has the fourth argument as the LIST of elements to replace with. The function replaces the elements starting from the OFFSET and count the number of elements mentioned in the LENGTH parameter with the LIST.

  5. All the above are correct.

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

Yes, All the statements are correct about the above piece of code