C Data Types MCQ

Data types are integral to C programming. They help in classifying the type of data, ensuring proper memory allocation, and enabling appropriate operations on the data. This quiz is designed for beginners to test their understanding of the fundamental data types in C. Let's jump right in!

Note that each question is followed by the correct answer and an explanation to help reinforce your knowledge.

1. Which of the following is a derived data type in C?

A) int
B) float
C) array
D) char

2. What is the size (in bytes) of double on most modern systems?

A) 4
B) 6
C) 8
D) 10

3. What data type is best suited for storing a single character?

A) int
B) bool
C) char
D) double

4. Which of the following is a non-standard integer type?

A) int
B) long int
C) byte
D) short int

5. How many bytes does the int data type usually occupy?

a) 1
b) 2
c) 4
d) 8

6. Which of the following types can store a larger range of integers?

A) short
B) int
C) long long
D) long

7. Which data type in C has only two possible values?

A) char
B) bool
C) int
D) double

8. Which of the following is not a floating-point data type?

A) float
B) double
C) long double
D) long int

9. Which type is used to store a wide character in C?

A) char
B) w_char
C) wchar_t
D) wide

10. If a variable is declared as unsigned short int, what is its typical size on modern systems?

A) 1 byte
B) 2 bytes
C) 4 bytes
D) 8 bytes

11. Which of the following data types has the smallest storage size?

A) float
B) double
C) long double
D) char

12. What would be the outcome of sizeof(_Bool) in C?

A) 0
B) 1
C) 2
D) 4

13. What is the primary difference between int and unsigned int?

A) Memory allocation
B) Range of values
C) Data type classification
D) Operation types

14. Which data type would be most suitable for storing the value of PI (3.14159...)?

a) int
b) float
c) double
d) char

15. Which data type is used to store a sequence of characters?

a) sequence
b) char sequence[]
c) string
d) char[]


Comments