Bird
0
0

What will be the output of this script?

medium📝 Command Output Q4 of 15
PowerShell - Functions
What will be the output of this script?
function SayHello { Write-Output "Hello" } SayHello
ASayHello
BHello
CNo output
DError: function not found
Step-by-Step Solution
Solution:
  1. Step 1: Understand function definition and call

    The function 'SayHello' outputs the string "Hello" when called.
  2. Step 2: Analyze script execution

    The script defines the function then calls it, so "Hello" is printed.
  3. Final Answer:

    Hello -> Option B
  4. Quick Check:

    Function outputs text = B [OK]
Quick Trick: Function outputs text when called [OK]
Common Mistakes:
  • Expecting function name as output
  • Thinking no output occurs without explicit return
  • Assuming function is not found

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes