Bird
0
0

How can you calculate the square of a number stored in $num in PowerShell?

hard📝 Application Q9 of 15
PowerShell - Operators
How can you calculate the square of a number stored in $num in PowerShell?
A$square = $num + $num
B$square = $num ** 2
C$square = $num * $num
D$square = $num / 2
Step-by-Step Solution
Solution:
  1. Step 1: Understand PowerShell does not support '**'

    PowerShell does not use '**' for powers, so $square = $num ** 2 is invalid.
  2. Step 2: Multiply $num by itself

    Multiplying $num by $num calculates the square.
  3. Final Answer:

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

    Use * to multiply for square calculation [OK]
Quick Trick: Multiply number by itself to square it [OK]
Common Mistakes:
  • Using ** operator
  • Dividing instead of multiplying
  • Adding instead of multiplying

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes