Bird
0
0

Which statement about [PSCustomObject] behavior is TRUE?

hard📝 Conceptual Q10 of 15
PowerShell - Working with Objects
Which statement about [PSCustomObject] behavior is TRUE?
AYou can add new properties by direct assignment anytime
BDuplicate property names in the hashtable cause the last value to be used
CPSCustomObject is immutable after creation
DProperties must be strings only
Step-by-Step Solution
Solution:
  1. Step 1: Understand property behavior in PSCustomObject

    If duplicate keys exist in the hashtable, the last one overwrites previous values.
  2. Step 2: Evaluate other options

    Direct assignment cannot add new properties; PSCustomObject is mutable (properties can be updated); properties can be any type, not just strings.
  3. Final Answer:

    Duplicate property names in the hashtable cause the last value to be used -> Option B
  4. Quick Check:

    Duplicate keys overwrite = Duplicate property names in the hashtable cause the last value to be used [OK]
Quick Trick: Last duplicate key wins when creating PSCustomObject [OK]
Common Mistakes:
  • Thinking new properties can be added by direct assignment
  • Assuming PSCustomObject is immutable
  • Believing properties must be strings

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes