Bird
0
0

What will this script output?

medium📝 Command Output Q5 of 15
PowerShell - Variables and Data Types
What will this script output?
$num = 5
$num = $num + 3
Write-Output $num
A53
B8
C5
DError: Cannot add variable to itself
Step-by-Step Solution
Solution:
  1. Step 1: Understand variable value and addition

    $num starts at 5, then adds 3, so new value is 8.
  2. Step 2: Output the updated value

    Write-Output prints 8, the new value of $num.
  3. Final Answer:

    8 -> Option B
  4. Quick Check:

    Variable addition result = 8 [OK]
Quick Trick: Adding numbers updates variable value correctly [OK]
Common Mistakes:
  • Concatenating numbers as strings
  • Not updating variable value
  • Expecting error on self addition

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes