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

Char type and Unicode behavior 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 char variable with the letter 'A'.

C Sharp (C#)
char letter = '[1]';
Drag options to blanks, or click blank then click option'
A'A'
B"A"
CA
D'AA'
Attempts:
3 left
💡 Hint
Common Mistakes
Using double quotes instead of single quotes.
Trying to assign multiple characters to a char.
2fill in blank
medium

Complete the code to get the Unicode code point of the char 'Ω'.

C Sharp (C#)
int codePoint = (int) '[1]';
Drag options to blanks, or click blank then click option'
A"Ω"
B'Ω'
CΩ
D'O'
Attempts:
3 left
💡 Hint
Common Mistakes
Using double quotes which represent strings.
Not casting to int before assignment.
3fill in blank
hard

Fix the error in the code to correctly check if a char is a digit.

C Sharp (C#)
bool isDigit = char.[1]('5');
Drag options to blanks, or click blank then click option'
AIsLetter
BIsSymbol
CIsNumber
DIsDigit
Attempts:
3 left
💡 Hint
Common Mistakes
Using IsLetter which checks letters, not digits.
Using IsNumber which includes other numeric characters.
4fill in blank
hard

Fill both blanks to create a dictionary mapping characters to their Unicode code points for letters only.

C Sharp (C#)
var unicodeMap = new Dictionary<char, int> { { '[1]', (int)'A' }, { '[2]', (int)'Z' } };
Drag options to blanks, or click blank then click option'
AA
BZ
Ca
Dz
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase letters when uppercase is expected.
Using strings instead of chars as keys.
5fill in blank
hard

Fill all three blanks to create a method that returns true if a char is a letter and uppercase.

C Sharp (C#)
bool IsUpperLetter(char c) {
    return char.[1](c) && char.[2](c) && c [3] 'A';
}
Drag options to blanks, or click blank then click option'
AIsLetter
BIsUpper
C>=
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using IsLower instead of IsUpper.
Using wrong comparison operators like '<='.