Server Administration

A PowerShell script contains this assignment: $label = 'Backup #1' <# primary label #> + ' ready' # status What value is assigned to $label?

Show the answer

Correct answerA. Backup #1 ready

AWhy this is right: The quoted hash is literal text; the block and trailing comments are ignored, leaving the string concatenation.

BWhy not this: The unquoted hash starts a single-line comment, so '# status' is not included in the value.

CWhy not this: A hash inside a quoted string is literal text, so '#1' remains in the value.

DWhy not this: A block comment ends at its closing marker, so the following concatenation still executes.

PowerShell ignores the inline block comment and the trailing single-line comment, but preserves the hash inside the quoted string. The plus operator therefore joins 'Backup #1' and ' ready'; the inline block comment does not end the assignment.