Bird
0
0

Identify the error in this function definition:

medium📝 Debug Q6 of 15
PowerShell - Functions
Identify the error in this function definition:
function Multiply {
  param $a, $b
  return $a * $b
}
Areturn keyword is invalid in PowerShell
Bparam block must be enclosed in parentheses
CFunction name cannot be Multiply
DParameters must be declared outside the function
Step-by-Step Solution
Solution:
  1. Step 1: Check param block syntax

    PowerShell requires parameters inside param() parentheses, not just param keyword.
  2. Step 2: Validate other options

    Return is valid, function name is allowed, parameters must be inside function.
  3. Final Answer:

    param block must be enclosed in parentheses -> Option B
  4. Quick Check:

    param block syntax requires parentheses [OK]
Quick Trick: Always use param(...) with parentheses [OK]
Common Mistakes:
  • Omitting parentheses in param block
  • Misusing return keyword
  • Declaring parameters outside function

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes