Recall & Review
beginner
What is the C#
char type used for?The
char type in C# represents a single 16-bit Unicode character. It stores a UTF-16 code unit, which can represent most common characters.Click to reveal answer
intermediate
How does C#
char handle Unicode characters outside the Basic Multilingual Plane (BMP)?Characters outside the BMP (code points above U+FFFF) are represented using a pair of
char values called surrogate pairs. Each char holds one 16-bit code unit of the UTF-16 encoding.Click to reveal answer
intermediate
What is a surrogate pair in Unicode?
A surrogate pair is two 16-bit
char values that together represent a single Unicode character outside the BMP (above U+FFFF). The first is a high surrogate, the second a low surrogate.Click to reveal answer
intermediate
How can you check if a
char is a high surrogate or low surrogate in C#?Use
char.IsHighSurrogate(char c) to check for a high surrogate and char.IsLowSurrogate(char c) for a low surrogate.Click to reveal answer
beginner
Why can't a single C#
char always represent a full Unicode character?Because
char stores a UTF-16 code unit, some Unicode characters (those outside BMP) require two char values (surrogate pairs) to represent one character fully.Click to reveal answer
What size is the C#
char type?✗ Incorrect
The C#
char type is a 16-bit value representing a UTF-16 code unit.Which of these represents a Unicode character outside the Basic Multilingual Plane in C#?
✗ Incorrect
Characters outside the BMP require two
char values called surrogate pairs.How do you check if a
char is a high surrogate in C#?✗ Incorrect
Use
char.IsHighSurrogate(c) to check for a high surrogate.What encoding does C#
char use internally?✗ Incorrect
C#
char stores UTF-16 code units.Why might a Unicode character need two
char values in C#?✗ Incorrect
Characters outside the BMP need two
char values (surrogate pairs) to be represented.Explain how the C#
char type represents Unicode characters, including those outside the Basic Multilingual Plane.Think about UTF-16 encoding and surrogate pairs.
You got /4 concepts.
Describe how to identify surrogate pairs in C# and why they are important.
Focus on surrogate pair detection methods and their role.
You got /4 concepts.