Challenge - 5 Problems
Unicode Char Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of char and Unicode code point conversion
What is the output of this C# code snippet?
C Sharp (C#)
char ch = '\u0041'; int code = ch; Console.WriteLine(code);
Attempts:
2 left
💡 Hint
Remember that '\u0041' is a Unicode escape for a character, and casting char to int gives its code point.
✗ Incorrect
The character '\u0041' is 'A'. Its Unicode code point is 65. Casting char to int returns this numeric value.
❓ Predict Output
intermediate2:00remaining
Output of char arithmetic with Unicode characters
What does this C# code print?
C Sharp (C#)
char ch = 'A'; ch = (char)(ch + 2); Console.WriteLine(ch);
Attempts:
2 left
💡 Hint
Adding 2 to 'A' moves two characters forward in Unicode.
✗ Incorrect
The character 'A' has code 65. Adding 2 gives 67, which is 'C'.
❓ Predict Output
advanced2:00remaining
Output when using surrogate pairs in char arrays
What is the output of this C# code?
C Sharp (C#)
string s = "\U0001F600"; // Unicode emoji 😀 Console.WriteLine(s.Length);
Attempts:
2 left
💡 Hint
Some Unicode characters use two char units called surrogate pairs in .NET strings.
✗ Incorrect
The emoji 😀 is represented by two UTF-16 code units, so Length is 2.
❓ Predict Output
advanced2:00remaining
Behavior of char.IsSurrogate method
What does this C# code print?
C Sharp (C#)
char high = '\uD83D'; char low = '\uDE00'; Console.WriteLine(char.IsSurrogate(high)); Console.WriteLine(char.IsSurrogate(low));
Attempts:
2 left
💡 Hint
Both high and low surrogate halves are considered surrogate chars.
✗ Incorrect
Both '\uD83D' and '\uDE00' are surrogate code units, so IsSurrogate returns true for both.
🧠 Conceptual
expert2:00remaining
Understanding char and Unicode code points in C#
Which statement about C# char type and Unicode is TRUE?
Attempts:
2 left
💡 Hint
Think about how UTF-16 encoding works and how C# char relates to it.
✗ Incorrect
C# char is a 16-bit UTF-16 code unit. Characters outside the Basic Multilingual Plane use two chars (surrogate pairs).