Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting the $ before the variable name.
Using other symbols like @ or # instead of $.
✗ Incorrect
In PowerShell, variables start with the dollar sign ($). So, to create a variable named 'name', you write '$name'.
2fill in blank
mediumComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using symbols other than $ to start the variable.
Omitting the $ symbol.
✗ Incorrect
Variables in PowerShell always start with the dollar sign ($). So, '$count = 10' assigns 10 to the variable count.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Leaving out the $ before the variable name.
Using other symbols instead of $.
✗ Incorrect
In PowerShell, the variable name must start with a dollar sign ($). So, '$message = "Hello"' is correct.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using ':' or '==' instead of '=' for assignment.
Forgetting the $ before the variable name.
✗ Incorrect
Variables start with $ and assignment uses = in PowerShell. So, '$age = 25' is correct.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using single quotes instead of double quotes (though both work, double quotes are common).
Omitting $ or =.
✗ Incorrect
Variables start with $, assignment uses =, and strings can be in double quotes. So, '$greeting = "Hi"' is correct.