Bird
0
0

What is the output of this PowerShell code?

medium📝 Predict Output Q13 of 15
PowerShell - Working with Objects
What is the output of this PowerShell code?
$data = 1, 3, 5, 7, 9
$result = $data | Measure-Object -Minimum, -Maximum
$result.Minimum, $result.Maximum
AError: Invalid parameters
B9 1
C5 7
D1 9
Step-by-Step Solution
Solution:
  1. Step 1: Understand -Minimum and -Maximum flags

    Measure-Object does not accept multiple flags separated by commas; this causes an error.
  2. Step 2: Correct usage

    To get both minimum and maximum, you must run Measure-Object twice or use separate commands.
  3. Final Answer:

    Error: Invalid parameters -> Option A
  4. Quick Check:

    Multiple flags separated by commas cause error [OK]
Quick Trick: Measure-Object flags cannot be combined with commas [OK]
Common Mistakes:
  • Mixing order of minimum and maximum
  • Expecting sum or average instead
  • Using wrong syntax causing errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes