Bird
0
0

Consider this PowerShell code:

medium📝 Predict Output Q5 of 15
PowerShell - Automation Patterns
Consider this PowerShell code:
$baseline = @('X','Y','Z')
$current = @('X','Y','W')
Compare-Object -ReferenceObject $baseline -DifferenceObject $current

What will be the output?
ANo differences found
BInputObject SideIndicator<br>---------- -------------<br>Z =><br>W <=
CInputObject SideIndicator<br>---------- -------------<br>Z <=<br>W =>
DError: Missing parameters
Step-by-Step Solution
Solution:
  1. Step 1: Understand Compare-Object parameters

    -ReferenceObject is the baseline; -DifferenceObject is the current state.
  2. Step 2: Analyze differences

    Z is in baseline but not current (<=), W is in current but not baseline (=>).
  3. Final Answer:

    InputObject SideIndicator
    Z <=
    W =>
    -> Option C
  4. Quick Check:

    SideIndicator shows which array contains the item [OK]
Quick Trick: SideIndicator <= means baseline only, => means current only [OK]
Common Mistakes:
  • Reversing SideIndicator meanings
  • Assuming no differences when items differ
  • Confusing parameter names -ReferenceObject and -DifferenceObject

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes