Bird
0
0

Given the code:

medium📝 Predict Output Q5 of 15
PowerShell - Working with Objects
Given the code:
$values = 5, 10, 15
$stats = $values | Measure-Object -Average
$stats.Average

What is the output?
A30
B15
C5
D10
Step-by-Step Solution
Solution:
  1. Step 1: Calculate average of the numbers

    Average = (5 + 10 + 15) / 3 = 30 / 3 = 10
  2. Step 2: Access the Average property from Measure-Object

    $stats.Average returns the calculated average, which is 10.
  3. Final Answer:

    10 -> Option D
  4. Quick Check:

    Average property = 10 [OK]
Quick Trick: Average property holds mean value after Measure-Object -Average [OK]
Common Mistakes:
  • Adding instead of averaging
  • Using Sum property
  • Dividing by wrong count

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes