Bird
0
0

You run this code but get an error:

medium📝 Debug Q14 of 15
PowerShell - Cmdlets and Pipeline
You run this code but get an error:
$items = @(5, 3, 8, 1)
$items | Sort-Object -descendingg

What is the problem?
AYou must use parentheses around the array.
BSort-Object cannot sort numbers.
CThe parameter '-descendingg' is misspelled.
DThe pipe operator '|' is not allowed here.
Step-by-Step Solution
Solution:
  1. Step 1: Check the parameter spelling

    The parameter should be -Descending, but it is misspelled as -descendingg.
  2. Step 2: Understand impact of misspelling

    PowerShell does not recognize the misspelled parameter, causing an error.
  3. Final Answer:

    The parameter '-descendingg' is misspelled. -> Option C
  4. Quick Check:

    Parameter spelling must be exact [OK]
Quick Trick: Check parameter spelling carefully [OK]
Common Mistakes:
  • Misspelling parameters
  • Thinking Sort-Object can't sort numbers
  • Misunderstanding pipe usage

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes