Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to add two numbers and store the result in $sum.
PowerShell
$a = 5 $b = 3 $sum = $a [1] $b Write-Output $sum
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-' which subtracts instead of adds.
Using '*' which multiplies instead of adds.
✗ Incorrect
The plus sign (+) adds two numbers together in PowerShell.
2fill in blank
mediumComplete the code to multiply two numbers and display the product.
PowerShell
$x = 7 $y = 4 $product = $x [1] $y Write-Output $product
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' which adds instead of multiplies.
Using '/' which divides instead of multiplies.
✗ Incorrect
The asterisk (*) multiplies two numbers in PowerShell.
3fill in blank
hardFix the error in the code to correctly divide two numbers and show the result.
PowerShell
$num1 = 20 $num2 = 5 $result = $num1 [1] $num2 Write-Output $result
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '*' which multiplies instead of divides.
Using '+' which adds instead of divides.
✗ Incorrect
The forward slash (/) divides one number by another in PowerShell.
4fill in blank
hardFill in the blank to calculate the remainder when 17 is divided by 3.
PowerShell
$a = 17 $b = 3 $remainder = $a [1] $b Write-Output $remainder
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-' which subtracts instead of finding remainder.
Using '*' which multiplies instead of finding remainder.
✗ Incorrect
The percent sign (%) gives the remainder of division in PowerShell.
5fill in blank
hardFill both blanks to calculate the expression: (8 + 2) * 5.
PowerShell
$a = 8 $b = 2 $c = 5 $result = ($a [1] $b) [2] $c Write-Output $result
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-' instead of '+' for addition.
Using '/' instead of '*' for multiplication.
✗ Incorrect
First add 8 and 2 using '+', then multiply the sum by 5 using '*'.