Bird
0
0

What will this script output?

medium📝 Command Output Q5 of 15
PowerShell - Functions
What will this script output?
function AddNumbers($a, $b) { $a + $b } AddNumbers 3 4
A7
B34
C3 4
DError: missing parentheses
Step-by-Step Solution
Solution:
  1. Step 1: Understand function parameters and operation

    The function adds two numbers passed as arguments.
  2. Step 2: Evaluate the call with arguments 3 and 4

    Adding 3 and 4 results in 7, which is output.
  3. Final Answer:

    7 -> Option A
  4. Quick Check:

    Function adds numbers correctly = B [OK]
Quick Trick: Functions can take parameters and return results [OK]
Common Mistakes:
  • Concatenating numbers as strings
  • Passing arguments incorrectly
  • Expecting error due to missing parentheses

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes