Multiple choice technology

Which are the valid array declarations in PowerShell among the following options

  1. $Number = 1,2,3,4,5
  2. $DescriptionArray= “This”, “is”, “a”, “Sample”, “Variable”
  3. $x = @(1, 2, 3, 4, 5)
  4. $y = @[6,7, 8, 9, 10]
Reveal answer Fill a bubble to check yourself
A,B,C Correct answer
Explanation

PowerShell supports multiple array declaration syntaxes: comma-separated lists ($Number = 1,2,3,4,5), array suboperator with parentheses ($x = @(1, 2, 3, 4, 5)), and quoted string arrays (\$DescriptionArray = "This", "is", "a", "Sample", "Variable"). However, the array suboperator uses the @ symbol followed by parentheses, not square brackets, so \$y = @[6,7, 8, 9, 10] is invalid syntax.