Recall & Review
beginner
What is the range of the
int type in C#?The
int type in C# is a 32-bit signed integer. It ranges from -2,147,483,648 to 2,147,483,647.Click to reveal answer
beginner
What is the difference between
int and uint in C#?int is a signed 32-bit integer (can hold negative and positive numbers). uint is an unsigned 32-bit integer (only positive numbers and zero). uint ranges from 0 to 4,294,967,295.Click to reveal answer
intermediate
What is the size and range of the
long type in C#?long is a 64-bit signed integer. It ranges from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.Click to reveal answer
beginner
Which integer type would you use to store only positive numbers up to about 65,000?
You would use
ushort, which is an unsigned 16-bit integer ranging from 0 to 65,535.Click to reveal answer
intermediate
What happens if you try to store a number outside the range of an integer type in C#?
If you store a number outside the range, it causes an overflow. By default, this can wrap around silently or throw an exception if checked context is used.
Click to reveal answer
What is the range of the
byte type in C#?✗ Incorrect
byte is an unsigned 8-bit integer ranging from 0 to 255.Which type is a 16-bit signed integer in C#?
✗ Incorrect
short is a 16-bit signed integer ranging from -32,768 to 32,767.What is the size of the
uint type in C#?✗ Incorrect
uint is a 32-bit unsigned integer.Which integer type can store the largest positive number?
✗ Incorrect
long is a 64-bit signed integer and can store the largest positive number among these.What keyword can you use to detect overflow errors in C#?
✗ Incorrect
The
checked keyword enables overflow checking and throws exceptions on overflow.Explain the difference between signed and unsigned integer types in C# and give examples.
Think about whether the number can be negative or not.
You got /3 concepts.
List the common integer types in C# and their size in bits.
Remember the smallest to largest sizes.
You got /5 concepts.