Bird
0
0

What will be the output count of groups when running this command?

medium📝 Command Output Q13 of 15
PowerShell - Working with Objects
What will be the output count of groups when running this command?
Get-Process | Group-Object -Property CPU | Measure-Object | Select-Object -ExpandProperty Count

Assuming multiple processes share the same CPU time value.
AThe number of CPU cores on the machine.
BThe total number of processes running.
CAlways 1 because CPU is a single value.
DThe number of unique CPU time values among processes.
Step-by-Step Solution
Solution:
  1. Step 1: Understand Group-Object output

    Group-Object groups items by unique values of the specified property, here 'CPU'.
  2. Step 2: Interpret Measure-Object Count

    Measure-Object counts how many groups were created, which equals the number of unique CPU values among processes.
  3. Final Answer:

    The number of unique CPU time values among processes. -> Option D
  4. Quick Check:

    Group count = unique property values [OK]
Quick Trick: Group count equals unique property values, not total items [OK]
Common Mistakes:
  • Confusing group count with total items
  • Assuming CPU property is always unique
  • Thinking it relates to CPU cores

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes