Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using double quotes instead of single quotes.
Trying to assign multiple characters to a char.
✗ Incorrect
In C#, a char is a single character enclosed in single quotes.
2fill in blank
mediumComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using double quotes which represent strings.
Not casting to int before assignment.
✗ Incorrect
Cast the char 'Ω' (in single quotes) to int to get its Unicode code point.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using IsLetter which checks letters, not digits.
Using IsNumber which includes other numeric characters.
✗ Incorrect
The method char.IsDigit checks if a character is a digit.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase letters when uppercase is expected.
Using strings instead of chars as keys.
✗ Incorrect
The dictionary keys are chars 'A' and 'Z' representing uppercase letters.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
IsLower instead of IsUpper.Using wrong comparison operators like '<='.
✗ Incorrect
The method checks if c is a letter, is uppercase, and is greater or equal to 'A'.