This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Which of the following escape sequences should be used to add double quotes to a literal string in C# code?
'\q'
\q
'\''
\'
'\"'
\"
Which of the following lines of code correctly uses string interpolation assuming that the variable value is a string?
value
'Console.WriteLine(@"My value: {value}");'
Console.WriteLine(@"My value: {value}");
'Console.WriteLine($"My value: {value}");'
Console.WriteLine($"My value: {value}");
'Console.WriteLine(@"My value: [value]");'
Console.WriteLine(@"My value: [value]");
Unicode characters were embedded in the C# strings for a console application to present a greeting message in Thai. However, the message is only displayed as question mark characters. What is a possible cause?
A missing \u escape sequence for Unicode characters.
The wrong Unicode characters were used.
The user's console doesn't support Unicode characters.
Which of the following lines of code appends a single \ to the string directory?
\
directory
'directory = directory + "\";'
directory = directory + "\";
'directory = directory + '\';'
directory = directory + '\';
'directory = directory + @"\";'
directory = directory + @"\";
You must answer all questions before checking your work.
Was this page helpful?