Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to store the number 10 in a variable named $num.
PowerShell
$num = [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around the number stores it as text, not a number.
Using $ inside the value when not needed.
✗ Incorrect
The variable $num stores the number 10 by assigning it directly.
2fill in blank
mediumComplete the code to store the text Hello in a variable named $greeting.
PowerShell
$greeting = [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to add closing quotes.
Using text without quotes.
✗ Incorrect
Text values must be inside quotes to be stored as strings.
3fill in blank
hardFix the error in the code to store the value 5 in $count.
PowerShell
$count = [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using words instead of numbers.
Adding $ inside the value.
✗ Incorrect
Numbers are stored without quotes or $ signs.
4fill in blank
hardFill both blanks to store the text 'PowerShell' in $tool and the number 2024 in $year.
PowerShell
$tool = [1] $year = [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around numbers.
Not putting quotes around text.
✗ Incorrect
Text needs quotes, numbers do not.
5fill in blank
hardFill all three blanks to store your name in $name, your age in $age, and your city in $city.
PowerShell
$name = [1] $age = [2] $city = [3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around text.
Putting quotes around numbers.
✗ Incorrect
Text values need quotes, numbers do not.