What is the output of the following code snippet?

func main() {
  sliceX := [...]int {1, 2, 3, 4, 5}
  sliceY := sliceX[0:2]
  sliceZ := sliceX[1:4]
  fmt.Print(len(sliceY), cap(sliceY), len(sliceZ), cap(sliceZ))
}

2 5 3 4

2 5 3 3

2 5 3 5

2 4 3 4

Verified Answer
Correct Option - a

To get all Go Programming Language - Assessment Exam questions Join Group https://bit.ly/infy_premium_group

We're passionate about offering best placement materials and courses!! A one stop place for Placement Materials. We daily post Offcampus updates and Placement Materials.

Qtr No. 213, New Town Yehlanka Indore 454775

admin@prepflix.in