Multiple choice technology

X = @(1, 2, 3, 4, 5) If the below script will be executed what will be the value of $Z[6]? $x = @(1, 2, 3, 4, 5) $y = @(6, 7, 8, 9, 10) $z = $x + $y

  1. 5

  2. 6

  3. 7

  4. 8

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

In PowerShell, the + operator concatenates arrays. $z = $x + \$y creates a new array containing all elements from both arrays: (1, 2, 3, 4, 5, 6, 7, 8, 9, 10). Arrays are 0-indexed, so \$z[6] refers to the 7th element, which is 7. Note that \$z has no element at index 5 (the question asks about \$Z[6], not $Z[5]).