Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to join two strings with a space.
PowerShell
$greeting = "Hello " [1] "World"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using - or * instead of + causes errors or wrong results.
✗ Incorrect
In PowerShell, the plus sign (+) is used to concatenate strings.
2fill in blank
mediumComplete the code to add an exclamation mark at the end of the string.
PowerShell
$message = "Hi" [1] "!"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using - or * instead of + causes errors.
✗ Incorrect
Use + to join strings in PowerShell, so the exclamation mark is added.
3fill in blank
hardFix the error in the code to concatenate strings correctly.
PowerShell
$name = "John" [1] "Doe"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using & causes errors because it is for running commands.
✗ Incorrect
The + operator correctly concatenates strings in PowerShell. The & operator runs commands, so it is incorrect here.
4fill in blank
hardFill both blanks to create a full sentence by joining strings and a variable.
PowerShell
$age = 30 $sentence = "I am " [1] $age [2] " years old."
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using - or * causes errors or wrong output.
✗ Incorrect
Use + to join strings and variables in PowerShell. Both blanks need + to concatenate properly.
5fill in blank
hardFill all three blanks to build a greeting with a name and punctuation.
PowerShell
$first = "Jane" $last = "Smith" $greet = "Hello, " [1] $first [2] $last [3] "!"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using - causes errors or breaks the string.
✗ Incorrect
Use + to join all parts of the greeting string in PowerShell.