Podcast
Questions and Answers
What is the range of a signed short int?
What is the range of a signed short int?
- 0 to 65,535
- -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
- -32,768 to 32,767 (correct)
- -2,147,483,648 to 2,147,483,647
Which format specifier is used for unsigned long long int?
Which format specifier is used for unsigned long long int?
- %hd
- %u
- %llu (correct)
- %lu
What is the size in bytes of a double data type?
What is the size in bytes of a double data type?
- 8 (correct)
- 4
- 2
- 16
Which of the following types has the largest range for signed integers?
Which of the following types has the largest range for signed integers?
What is the precision of a float data type?
What is the precision of a float data type?
Which format specifier is used for printing characters?
Which format specifier is used for printing characters?
What is the range of an unsigned int?
What is the range of an unsigned int?
How many bytes does a long double type occupy?
How many bytes does a long double type occupy?
Flashcards are hidden until you start studying
Study Notes
Integer Types
-
int:
- Size: 4 bytes
- Signed range: -2,147,483,648 to 2,147,483,647
- Unsigned range: 0 to 4,294,967,295
- Format specifiers: %d (signed), %u (unsigned)
-
short int:
- Size: 2 bytes
- Signed range: -32,768 to 32,767
- Unsigned range: 0 to 65,535
- Format specifiers: %hd (signed), %hu (unsigned)
-
long int:
- Size: 8 bytes (4 bytes on 32-bit systems)
- Signed range: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
- Unsigned range: 0 to 18,446,744,073,709,551,615
- Format specifiers: %ld (signed), %lu (unsigned)
-
long long int:
- Size: 8 bytes
- Signed range: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
- Unsigned range: 0 to 18,446,744,073,709,551,615
- Format specifiers: %lld (signed), %llu (unsigned)
-
unsigned int:
- Size: 4 bytes
- Unsigned range: 0 to 4,294,967,295
- Format specifier: %u
Floating-Point Types
-
float:
- Size: 4 bytes
- Range: 3.4E-38 to 3.4E+38
- Precision: 6 decimal places
- Format specifier: %f
-
double:
- Size: 8 bytes
- Range: 1.7E-308 to 1.7E+308
- Precision: 15 decimal places
- Format specifier: %lf
-
long double:
- Size: 16 bytes
- Range: 3.4E-4932 to 1.1E+4932
- Precision: 18 decimal places
- Format specifier: %Lf
Character Types
-
char:
- Size: 1 byte
- Signed range: -128 to 127
- Unsigned range: 0 to 255
- Format specifier: %c
-
unsigned char:
- Size: 1 byte
- Unsigned range: 0 to 255
- Format specifier: %c
Summary of Format Specifiers
- Integer: %d, %i (signed), %u (unsigned)
- Floating-point: %f, %e (scientific), %g (shorter of %e or %f)
- Character: %c
- String: %s
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.