Data Types
1. Which of the following is a primary data type in C?
a) int
b) array
c) pointer
d) struct
Answer: a) int
2. Which data type is used to store decimal numbers?
a) int
b) char
c) float
d) long
Answer: c) float
3. What is the size of a char data type in C?
a) 1 bit
b) 8 bits
c) 2 bytes
d) 4 bytes
Answer: b) 8 bits (1 byte)
4. Which data type is best for storing large whole numbers?
a) int
b) char
c) float
d) long int
Answer: d) long int
5. What is the range of int on a 32-bit system?
a) -32768 to 32767
b) -2,147,483,648 to 2,147,483,647
c) 0 to 65,535
d) -255 to 255
Answer: b) -2,147,483,648 to 2,147,483,647
6. Which format specifier is used for float in printf()?
a) %d
b) %c
c) %f
d) %s
Answer: c) %f
7. What is the data type of 'A' in C?
a) int
b) char
c) string
d) double
Answer: b) char
8. What is the size of int on most 32-bit systems?
a) 2 bytes
b) 4 bytes
c) 8 bytes
d) 1 byte
Answer: b) 4 bytes
9. Which of the following is NOT a valid C data type?
a) double
b) string
c) float
d) int
Answer: b) string
10. Which data type can hold the largest value?
a) int
b) float
c) long double
d) char
Answer: c) long double