Multiple choice technology programming languages

Assume @list contains (“1”, “2”, “3”, “4”, “5” ). What is the content of @list after the following statement splice (@list, -1, 1, “test1”. “test2”);

  1. (“1”, “2”, “3”, “4”, “test1”, “test2”)

  2. ( “2”, “3”, “4”, “test1”, “test2”)

  3. (“1”, “3”, “4”, “test1”, “test2”)

  4. (“1”, “test1”, test2”, “2”, “3”, “4” )

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

splice(@list, -1, 1, "test1", "test2") removes 1 element starting from -1 (last element, which is 5), then inserts test1 and test2. The array becomes (1, 2, 3, 4, test1, test2). Option A is correct. splice with negative index counts from the end, and the remaining elements fill the gap maintaining order.