quiz

Data Types in C

1. What is the size of the char data type in C?

  • A) 8 bits
  • B) 2 bytes
  • C) 64 bits
  • D) 32 bits
A) 8 bits Explanation

2. Which of the following data types is used to store single-precision floating-point numbers in C?

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

3. Which data type is used to store true/false values in C?

  • A) int
  • B) char
  • C) bool
  • D) float
C) bool Explanation

4. What is the purpose of the void data type in C?

  • A) It indicates an empty argument list for a function.
  • B) It represents the absence of data type.
  • C) It is used to declare variables with no initial value.
  • D) It is used for defining constant values.
B) It represents the absence of data type. Explanation

5. In C, which data type is used to store memory addresses?

  • A) int
  • B) pointer
  • C) void
  • D) char
B) pointer Explanation

6. Which data type does not occupy any memory space?

  • A) char
  • B) int
  • C) float
  • D) void
D) void Explanation

7. What would be the value of ‘a’ after execution of the following code?

int main() { int a, b = 5; char c = 'x'; a = b + c; printf("%d", a); return 0; }
  • A) 5
  • B) x
  • C) 125
  • D) 5x
C) 125 Explanation

8. Which data type’s size is consistent in both 32-bit and 64-bit operating systems?

  • A) int
  • B) char
  • C) double
  • D) long
B) char Explanation