Bird
0
0

Identify the error in this parameter declaration:

medium📝 Debug Q6 of 15
PowerShell - Functions
Identify the error in this parameter declaration:
param([string]Name)
AWrong type declaration
BParameters cannot be strings
CMissing $ before parameter name
DMissing default value
Step-by-Step Solution
Solution:
  1. Step 1: Check parameter syntax

    PowerShell parameters require a $ before the name, e.g., $Name.
  2. Step 2: Identify the error

    Here, Name lacks the $ sign, causing a syntax error.
  3. Final Answer:

    Missing $ before parameter name -> Option C
  4. Quick Check:

    Parameter names need $ prefix [OK]
Quick Trick: Always prefix parameter names with $ [OK]
Common Mistakes:
  • Omitting $ before parameter
  • Confusing type syntax
  • Assuming default value is mandatory

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes