Bird
0
0

You want to print the result of adding two numbers, 7 and 4, using a single PowerShell command. Which command should you use?

hard📝 Application Q15 of 15
PowerShell - Basics and Environment
You want to print the result of adding two numbers, 7 and 4, using a single PowerShell command. Which command should you use?
AWrite-Output 7, 4
BWrite-Output "7 + 4"
CWrite-Output 7 4
DWrite-Output (7 + 4)
Step-by-Step Solution
Solution:
  1. Step 1: Understand how to calculate expressions in Write-Output

    Using parentheses causes PowerShell to evaluate the expression before printing.
  2. Step 2: Evaluate each option

    Write-Output (7 + 4) uses Write-Output (7 + 4), which calculates 11 and prints it.
  3. Final Answer:

    Write-Output (7 + 4) -> Option D
  4. Quick Check:

    Parentheses evaluate math before output = A [OK]
Quick Trick: Use parentheses to calculate before printing [OK]
Common Mistakes:
  • Putting math inside quotes prints text, not result
  • Writing multiple arguments without parentheses
  • Using commas prints array, not sum

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes