Recall & Review
beginner
What is a here-string in PowerShell?
A here-string is a way to create multiline strings easily. It starts with @" and ends with "@ for double-quoted strings, or @' and '@ for single-quoted strings.
Click to reveal answer
beginner
How do you start and end a double-quoted here-string in PowerShell?
Start with @" on a new line and end with "@ on a new line. Everything between is part of the string, including line breaks.
Click to reveal answer
intermediate
What is the difference between single-quoted and double-quoted here-strings?
Double-quoted here-strings allow variable expansion and escape sequences. Single-quoted here-strings treat content literally, no variable expansion.
Click to reveal answer
beginner
Show a simple example of a here-string that contains multiple lines.
Example:
$myString = @"
Line one
Line two
Line three
"@
This stores three lines in $myString.
Click to reveal answer
beginner
Why are here-strings useful in scripting?
They let you write long text blocks or scripts inside a variable without worrying about quotes or line breaks. This makes scripts easier to read and maintain.Click to reveal answer
How do you start a double-quoted here-string in PowerShell?
✗ Incorrect
A double-quoted here-string starts with @" on a new line.
Which here-string type allows variable expansion?
✗ Incorrect
Double-quoted here-strings allow variables inside the string to be replaced with their values.
What symbol ends a single-quoted here-string?
✗ Incorrect
A single-quoted here-string ends with '@ on a new line.
Which of these is a correct here-string assignment?
✗ Incorrect
Both A and C are valid here-string assignments; A is double-quoted, C is single-quoted.
Why use here-strings instead of normal strings for multiline text?
✗ Incorrect
Here-strings let you write multiline text easily without needing escape characters for new lines.
Explain how to create a multiline string using here-strings in PowerShell.
Think about how you open and close the string and what happens inside.
You got /4 concepts.
Describe the difference between single-quoted and double-quoted here-strings and when you might use each.
Consider how variables behave inside each type.
You got /4 concepts.