Bird
0
0

Which operator would you use to divide a variable $num by 4 and update it in PowerShell?

easy📝 Conceptual Q2 of 15
PowerShell - Operators
Which operator would you use to divide a variable $num by 4 and update it in PowerShell?
A$num -= 4
B$num += 4
C$num /= 4
D$num *= 4
Step-by-Step Solution
Solution:
  1. Step 1: Identify the division assignment operator

    The operator /= divides the variable by the right-hand value and updates the variable.
  2. Step 2: Match the operator to the question

    Since the question asks to divide $num by 4 and update it, $num /= 4 is correct.
  3. Final Answer:

    $num /= 4 -> Option C
  4. Quick Check:

    Division assignment operator /= = Divide and update [OK]
Quick Trick: Divide and update uses /= operator [OK]
Common Mistakes:
  • Using += instead of /=
  • Using -= or *= incorrectly
  • Forgetting to update variable

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes