Multiple choice

Consider @Countries = ("India", "Denmark", "Russia", "Germany", "Japan", "Ireland")

Which of the following statement is correct about the Array operations? (Multiple answers might be correct)

  1. shift(@Countries) will remove country "India" from the beginning of the array @Countries

    Now @Countries looks like @Countries = ("Denmark", "Russia", "Germany", "Japan", "Ireland")

  2. shift(@Countries) will remove country "Ireland" from the end of the array @Countries

    Now @Countries looks like @Countries = ("India", "Denmark", "Russia", "Germany", "Japan")

  3. unshift(@Countries, "Canada") will add country "Canada" at the end of the array @Countries

    Now @Countries looks like @Countries = ("India", "Denmark", "Russia", "Germany", "Japan", "Canada")

  4. unshift(@Countries, "Canada") will add country "Canada" at the front of the array @Countries.

    Now @Countries looks like @Countries = ("Canada", "India", "Denmark", "Russia", "Germany", "Japan")

  5. None of the above are correct

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

Yes, unshift prepends the elements at the front of the array and returns the length of the array Yes, shift function removes the first element of the array and shifts all the other elements to 1 position.