C Data Types MCQ Questions and Answers
Q. What is the type of the expression (5 + 3) / 2 in C?
A. intB. float
C. double
D. char
Q. What is the output of the following code snippet?
int main() {A. 6 9
int x = 5;
int y = ++x + 3;
printf("%d %d\\n", x, y);
return 0;
}
B. 7 9
C. 6 8
D. 7 8
Q. Which data type is suitable for storing a boolean value in C?
A. intB. float
C. char
D. _Bool
Q. What is the range of the short data type in C on a typical 32-bit system?
A. -32768 to 32767B. -2147483648 to 2147483647
C. -128 to 127
D. -32768 to 32767
Q. What is the output of the following code snippet?
int main() {A. 4294967291
unsigned int x = -5;
printf("%u\\n", x);
return 0;
}
B. 0
C. -5
D. The program will not compile.
Q. What is the size of the long long data type in C on a typical 64-bit system?
A. 32 bitsB. 64 bits
C. 16 bits
D. It depends on the compiler.
Q. What is the output of the following code snippet?
int main() {A. 3.14 3.14
float x = 3.14;
double y = x;
printf("%.2f %.2f\\n", x, y);
return 0;
}
B. 3.00 3.14
C. 3.1400 3.1400
D. 3 3
Q. What is the output of the following code snippet?
#include <limits.h>A. Minimum char value: -128
int main() {
printf("Minimum char value: %d\\n", CHAR_MIN);
return 0;
}
B. Minimum char value: 0
C. Minimum char value: -32768
D. Minimum char value: -2147483648