Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to print the variable inside double quotes using string interpolation.
PowerShell
Write-Output "Hello, [1]!"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting the $ sign before the variable name.
Using single quotes which do not expand variables.
✗ Incorrect
In PowerShell, variables inside double quotes are expanded using $variable syntax. So $name inside double quotes will be replaced by its value.
2fill in blank
mediumComplete the code to include the variable $age inside the string using double quotes.
PowerShell
Write-Output "I am [1] years old."
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the variable name without $ sign.
Using single quotes which do not expand variables.
✗ Incorrect
Using $age inside double quotes will insert the value of the variable age into the string.
3fill in blank
hardComplete the code to include the variable $city inside the string using double quotes.
PowerShell
Write-Output "Welcome to [1]!"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using single quotes which do not expand variables.
Forgetting the $ sign before the variable.
✗ Incorrect
Using $city inside double quotes will insert the value of the variable city into the string.
4fill in blank
hardFill both blanks to correctly display the full name using variables $first and $last inside a string.
PowerShell
Write-Output "Full name: [1] [2]"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names without $ sign.
Using single quotes instead of double quotes.
✗ Incorrect
Inside double quotes, variables must have $ before their names to be expanded. So use $first and $last.
5fill in blank
hardFill all three blanks to create a greeting with variables $greeting, $name, and $punctuation inside double quotes.
PowerShell
Write-Output "[1], [2][3]"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names without $ sign.
Using single quotes instead of double quotes.
✗ Incorrect
Variables inside double quotes must have $ before their names to be expanded. So use $greeting, $name, and $punctuation.