0
0
PowerShellscripting~10 mins

String concatenation 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 join two strings with a space.

PowerShell
$greeting = "Hello " [1] "World"
Drag options to blanks, or click blank then click option'
A/
B+
C*
D-
Attempts:
3 left
💡 Hint
Common Mistakes
Using - or * instead of + causes errors or wrong results.
2fill in blank
medium

Complete 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'
A+
B-
C*
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using - or * instead of + causes errors.
3fill in blank
hard

Fix the error in the code to concatenate strings correctly.

PowerShell
$name = "John" [1] "Doe"
Drag options to blanks, or click blank then click option'
A*
B&
C-
D+
Attempts:
3 left
💡 Hint
Common Mistakes
Using & causes errors because it is for running commands.
4fill in blank
hard

Fill 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'
A+
B-
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using - or * causes errors or wrong output.
5fill in blank
hard

Fill 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'
A+
D-
Attempts:
3 left
💡 Hint
Common Mistakes
Using - causes errors or breaks the string.