Recall & Review
beginner
What is a type modifier in C?
A type modifier in C changes the meaning or size of a basic data type, like
int or char. Examples include signed, unsigned, short, and long.Click to reveal answer
beginner
What does the
unsigned modifier do?The
unsigned modifier tells the compiler the variable can only hold zero or positive values, removing the ability to store negative numbers.Click to reveal answer
intermediate
How does
long int differ from int?long int usually uses more memory than int, allowing it to store larger numbers. The exact size depends on the system but long means 'longer' or 'bigger'.Click to reveal answer
intermediate
Can you combine multiple type modifiers? Give an example.
Yes, you can combine them. For example,
unsigned long int means a large integer that cannot be negative.Click to reveal answer
intermediate
What is the difference between
signed char and unsigned char?signed char can hold negative and positive values, while unsigned char holds only non-negative values (including zero). Both store small integers but differ in range.Click to reveal answer
Which type modifier allows only non-negative values?
✗ Incorrect
The
unsigned modifier restricts values to zero and positive numbers only.What does
short int usually mean?✗ Incorrect
short int typically uses less memory than int, so it stores smaller numbers.Which of these is a valid combination of type modifiers?
✗ Incorrect
unsigned long int is valid. signed unsigned int is contradictory, and long float or short double are invalid.What is the default sign for
int if no modifier is given?✗ Incorrect
By default,
int is signed, meaning it can hold negative and positive values.Which type modifier affects the size of the data type?
✗ Incorrect
long changes the size (usually larger), while unsigned and signed affect the sign, and const affects mutability.Explain what type modifiers are in C and give examples.
Think about how you can change the size or sign of a number type.
You got /3 concepts.
Describe the difference between signed and unsigned types and why you might use each.
Consider when you need negative numbers or only positive numbers.
You got /3 concepts.