0
0
C Sharp (C#)programming~10 mins

Verbatim and raw string literals in C Sharp (C#) - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare a verbatim string literal.

C Sharp (C#)
string path = [1]"C:\\Users\\Admin";
Drag options to blanks, or click blank then click option'
A@
B%
C$
D#
Attempts:
3 left
💡 Hint
Common Mistakes
Using # or $ instead of @ for verbatim strings.
Not escaping backslashes in normal strings.
2fill in blank
medium

Complete the code to declare a raw string literal with three double quotes.

C Sharp (C#)
string json = [1]"""
{
  "name": "John"
}""";
Drag options to blanks, or click blank then click option'
A"""
B@
C$
D'''
Attempts:
3 left
💡 Hint
Common Mistakes
Using single quotes instead of triple double quotes.
Using @ symbol which is for verbatim strings, not raw strings.
3fill in blank
hard

Fix the error in the raw string literal declaration.

C Sharp (C#)
string text = [1]"""
Line 1
Line 2
""";
Drag options to blanks, or click blank then click option'
A""
B"""
C@
D"
Attempts:
3 left
💡 Hint
Common Mistakes
Using only two double quotes causes syntax errors.
Using @ symbol instead of triple quotes for raw strings.
4fill in blank
hard

Fill both blanks to create a verbatim string with a newline character.

C Sharp (C#)
string message = [1]"Hello[2]World";
Drag options to blanks, or click blank then click option'
A@
B\n
D$
Attempts:
3 left
💡 Hint
Common Mistakes
Using actual newline character instead of \n inside verbatim strings.
Not using @ symbol for verbatim strings.
5fill in blank
hard

Fill all three blanks to create a raw string literal with embedded quotes and a newline.

C Sharp (C#)
string quote = [1]"""
She said, [2]Hello, World![3]
""";
Drag options to blanks, or click blank then click option'
A"""
B""
C"
D'
Attempts:
3 left
💡 Hint
Common Mistakes
Using single quotes instead of double quotes inside the raw string.
Not using triple double quotes to start and end the raw string.