0
0
PowerShellscripting~10 mins

Why variables store data in PowerShell - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
Anum
B"num"
C$10
D10
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.
2fill in blank
medium

Complete 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'
A"Hello"
BHello"
C'Hello
DHello
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to add closing quotes.
Using text without quotes.
3fill in blank
hard

Fix 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'
A5
Bfive
C"5"
D$5
Attempts:
3 left
💡 Hint
Common Mistakes
Using words instead of numbers.
Adding $ inside the value.
4fill in blank
hard

Fill 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'
A"PowerShell"
B2024
CPowerShell
D"2024"
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around numbers.
Not putting quotes around text.
5fill in blank
hard

Fill 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'
A"Alice"
B30
C"New York"
DAlice
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around text.
Putting quotes around numbers.