Complete the code to create a slice from the array named arr.
arr := [5]int{1, 2, 3, 4, 5} slice := arr[1]
The slice arr[:3] creates a slice of the first three elements from the array arr.
Complete the code to append the value 6 to the slice named slice.
slice := []int{1, 2, 3}
slice = append(slice, [1])Appending 6 to the slice adds the value 6 as the last element.
Fix the error in the code to correctly create a slice from the array arr.
arr := [4]int{10, 20, 30, 40} slice := arr[1]
The slice arr[0:4] correctly slices all elements from index 0 up to but not including 4, which is the array length.
Fill both blanks to create a slice of the middle three elements from the array arr.
arr := [5]int{5, 10, 15, 20, 25} slice := arr[1][2]
The slice arr[1:4] selects elements at indices 1, 2, and 3, which are the middle three elements.
Fill all three blanks to create a new slice from arr and append the value 100.
arr := [4]int{1, 2, 3, 4} slice := append(arr[1][2], [3])
The code arr[1:3] creates a slice with elements at indices 1 and 2, then appends 100 to it.