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

Char type and Unicode behavior in C Sharp (C#) - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Unicode Char Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2: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);
A65
B41
CA
DSyntax error
Attempts:
2 left
💡 Hint
Remember that '\u0041' is a Unicode escape for a character, and casting char to int gives its code point.
Predict Output
intermediate
2: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);
AB
BC
CD
DRuntime error
Attempts:
2 left
💡 Hint
Adding 2 to 'A' moves two characters forward in Unicode.
Predict Output
advanced
2: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);
A2
B1
C4
D0
Attempts:
2 left
💡 Hint
Some Unicode characters use two char units called surrogate pairs in .NET strings.
Predict Output
advanced
2: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));
AFalse\nFalse
BTrue\nFalse
CTrue\nTrue
DFalse\nTrue
Attempts:
2 left
💡 Hint
Both high and low surrogate halves are considered surrogate chars.
🧠 Conceptual
expert
2:00remaining
Understanding char and Unicode code points in C#
Which statement about C# char type and Unicode is TRUE?
AThe char type can store any Unicode character without needing surrogate pairs.
BA char represents a full Unicode code point, including those outside the Basic Multilingual Plane.
CC# strings store Unicode code points directly as 32-bit integers.
DA char is a 16-bit value representing a UTF-16 code unit, which may be a surrogate half for some characters.
Attempts:
2 left
💡 Hint
Think about how UTF-16 encoding works and how C# char relates to it.