Bird
0
0

Which of the following is the correct syntax for defining a PowerShell function named using the Verb-Noun convention?

easy📝 Syntax Q3 of 15
PowerShell - Cmdlets and Pipeline
Which of the following is the correct syntax for defining a PowerShell function named using the Verb-Noun convention?
Afunction Get-Data { Write-Output 'Data' }
Bfunction DataGet { Write-Output 'Data' }
Cfunction GetData { Write-Output 'Data' }
Dfunction Get_Data { Write-Output 'Data' }
Step-by-Step Solution
Solution:
  1. Step 1: Review PowerShell function naming rules

    Function names should follow Verb-Noun with a hyphen and no underscores or camel case.
  2. Step 2: Check each function name

    function Get-Data { Write-Output 'Data' } uses 'Get-Data' which follows the correct Verb-Noun with hyphen syntax.
  3. Final Answer:

    function Get-Data { Write-Output 'Data' } -> Option A
  4. Quick Check:

    Correct Verb-Noun function syntax = B [OK]
Quick Trick: Use hyphen between verb and noun in function names [OK]
Common Mistakes:
  • Using camel case instead of hyphen
  • Placing noun before verb
  • Using underscores instead of hyphen

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes