Bird
0
0

Which of the following best describes a ScriptMethod added to a PowerShell object?

easy📝 Conceptual Q2 of 15
PowerShell - Working with Objects
Which of the following best describes a ScriptMethod added to a PowerShell object?
AA method that runs a script block when called
BA command that deletes object members
CA variable that stores script text
DA property that holds a fixed value
Step-by-Step Solution
Solution:
  1. Step 1: Define ScriptMethod behavior

    A ScriptMethod is a method attached to an object that executes a script block when invoked.
  2. Step 2: Differentiate from properties and variables

    Unlike properties, ScriptMethods run code; they are not fixed values or variables storing text.
  3. Final Answer:

    A method that runs a script block when called -> Option A
  4. Quick Check:

    ScriptMethod runs code = D [OK]
Quick Trick: ScriptMethod runs code on call, not just stores data [OK]
Common Mistakes:
  • Confusing methods with properties
  • Thinking ScriptMethod stores static values
  • Mixing up methods with variables

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes