The subslice of a subslice

Report a typo

Suppose you have the slice of strings names, and the following subslices n1 and n2:

names := []string{"Keanu", "Brad", "Johnny", "Tom", "Dwayne", "Ryan"}
n1 := names[0:6]
n2 := n1[1:5]

And then you perform the following assignment operations:

n2[0] = "Mark"
n1[2] = "Liam"
n2[2] = "Mark"

What would be the contents of the names slice after performing the above operations? Remember that subslices share a common underlying array with their parent slice!

Select one option from the list
___

Create a free account to access the full topic