Bird
0
0

Which syntax correctly accesses the 'Count' property of an array object named $items in PowerShell?

easy📝 Syntax Q3 of 15
PowerShell - Working with Objects
Which syntax correctly accesses the 'Count' property of an array object named $items in PowerShell?
ACount($items)
B$items.Count
C$items->Count
DGet-Count $items
Step-by-Step Solution
Solution:
  1. Step 1: Recall property access syntax

    PowerShell uses dot notation to access properties of objects.
  2. Step 2: Apply to array object

    To get the number of elements, use $items.Count.
  3. Final Answer:

    $items.Count -> Option B
  4. Quick Check:

    Property access = A [OK]
Quick Trick: Use dot (.) to access object properties in PowerShell [OK]
Common Mistakes:
  • Using function-like syntax for properties
  • Using arrow (->) which is not PowerShell syntax
  • Trying to call non-existent cmdlets

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes