0
0
PowerShellscripting~10 mins

Variable creation with $ in PowerShell - Interactive Code Practice

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

Complete the code to create a variable named name with the value "Alice".

PowerShell
[1]name = "Alice"
Drag options to blanks, or click blank then click option'
A$
B@
C#
D%
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting the $ before the variable name.
Using other symbols like @ or # instead of $.
2fill in blank
medium

Complete the code to assign the number 10 to a variable named count.

PowerShell
[1]count = 10
Drag options to blanks, or click blank then click option'
A#
B&
C$
D%
Attempts:
3 left
💡 Hint
Common Mistakes
Using symbols other than $ to start the variable.
Omitting the $ symbol.
3fill in blank
hard

Fix the error in the code to correctly create a variable named message with the value "Hello".

PowerShell
[1]message = "Hello"
Drag options to blanks, or click blank then click option'
A$
B@
C#
D%
Attempts:
3 left
💡 Hint
Common Mistakes
Leaving out the $ before the variable name.
Using other symbols instead of $.
4fill in blank
hard

Fill both blanks to create a variable named age and assign it the value 25.

PowerShell
[1]age [2] 25
Drag options to blanks, or click blank then click option'
A$
B=
C:
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using ':' or '==' instead of '=' for assignment.
Forgetting the $ before the variable name.
5fill in blank
hard

Fill all three blanks to create a variable named greeting and assign it the value "Hi".

PowerShell
[1]greeting [2] [3]
Drag options to blanks, or click blank then click option'
A$
B=
C"Hi"
D'Hi'
Attempts:
3 left
💡 Hint
Common Mistakes
Using single quotes instead of double quotes (though both work, double quotes are common).
Omitting $ or =.