C Data Type Fundamentals MCQs: 12 Solved Questions with Explanations

Attempt 12 C data-type MCQs, then check concise explanations, two worked output traces, and an honest note about one ambiguous option.

KnowledgeGate Team

Exam prep & CS education

Updated 28 Jul 20267 min read

C data-type questions often look like simple recall, but they mix specifier grammar, implementation-dependent widths, literal suffixes, character codes, promotions, and format behaviour. Miss any one of those and a one-mark question becomes a guess. Three of the 12 below are past questions, from GATE 2022, UGC NET 2022 and Coal India 2017. Attempt each one before reading its explanation, and treat every option you reached by elimination as a rule you still owe yourself a revision on.

If the ground underneath this set is still shaky, what C is, which identifiers are legal, and which types exist at all, clear the solved intro and data types MCQs first. When you want a structured route through the subject rather than practice alone, browse Coding & Skills courses.

C data type fundamentals: five rules to keep beside the MCQs

Question cue

Rule

Common trap

unsigned alone

It means unsigned int

Calling it a signed int

Plain 6.68

Its type is double

Assuming every decimal constant is float

Floating suffix

f or F gives float; l or L gives long double

Combining suffixes as LF

sizeof

It reports bytes and has type size_t

Letting the stored value affect the size

char and %c

char is an integer type; %c displays a character

Reporting the numeric code instead

C does not make int universally 2 or 4 bytes. If a stem supplies a width, use it. If it does not, do not guess. Question 6 explicitly says that int occupies 4 bytes, while Question 5 asks for the portable, implementation-dependent answer.

For code questions, first write each literal's base or each character's numeric code. Perform the arithmetic or bitwise operation next, then apply the printf conversion. Recognising 015 as octal and 0x71 as hexadecimal is easier after revising number systems and base conversions.

Integer families, shorthand declarations, and signedness traps

Question 1. Integral type

Which of the following is integral data type?

1. void
2. char
3. float
4. double

Answer: option 2, char. C places char, signed and unsigned integer types, and enumerated types in the integer family. float and double are floating types, while void represents no value and is not an integral type.

Question 2. unsigned shorthand

This question appeared in Coal India 2017.

The data type of the variable “var1” declared in the following ‘C’ language statement is:

unsigned var1;

1. int
2. double
3. char
4. float

Answer: option 1, int. Expand the declaration to unsigned int var1;. When unsigned appears without char, short, long, or another integer type specifier, int is implied. The full type remains unsigned int, not plain signed int.

Question 3. Signed versus unsigned range

This question appeared in UGC NET 2022.

Which of the following statements about data types is wrong?

1. The number is always positive when the qualifier 'unsigned' is used.
2. The number can be positive or negative when the qualifier 'signed' is used.
3. The range of values for signed data types is more than that of unsigned data types.
4. The leftmost bit in an unsigned data type is used to represent the value.

Answer key: option 3. In a typical 8-bit comparison, unsigned spans 0 to 255, while signed two's-complement spans -128 to 127. Unsigned uses every bit for the value, so its non-negative maximum is larger.

Read option 1 carefully before you move on. It says the number is always "positive" under unsigned, yet zero is a valid unsigned value and zero is not positive, so "non-negative" would have been the precise word. Option 1 is therefore loosely worded as well, and option 3 is the intended answer rather than the only false sentence on the list. When a paper leaves you two imperfect statements, pick the one that is wrong about the concept under test, which here is range.

Data-type ranges and sizeof questions

Question 4. Minimum of unsigned char

What is the minimum value that an unsigned char data type can hold in C?

1. 0
2. -128
3. -256
4. 1

Answer: option 1, 0. An unsigned integer type has no negative values, and zero is included. Its maximum depends on CHAR_BIT, but its minimum remains zero. This also shows why "positive" was imprecise in Question 3.

Question 5. Minimum value of int

What is the minimum value that an int data type can hold in C?

1. It depends on the compiler and system
2. -32768
3. 0
4. -2147483648

Answer: option 1. A 16-bit two's-complement int has minimum -32768, while a 32-bit two's-complement int has minimum -2147483648. The stem gives no width, so neither numeric option is portable.

Question 6. sizeof with a stated width

What will be the output of the following C code? Assume that an int occupies 4 bytes.

int main()
{
    int a = 45;
    int i = sizeof(a);
    printf("%d", i);
}

1. 1
2. 6
3. 2
4. 4

Answer: option 4, 4. Variable a has type int, and the stem fixes sizeof(int) at 4 bytes. Therefore sizeof(a) yields 4, that value is assigned to i, and %d prints 4. The stored value 45 does not change the type's storage size.

Type-specifier grammar and floating-constant suffixes

Question 7. Valid type-specifier combination

In the context of C data types, which of the followings is correct?

1. “unsigned long long int” is a valid data type.
2. “long long double” is a valid data type
3. “unsigned long double” is a valid data type.
4. Above all are valid data types.

Answer: option 1. long long and unsigned are valid integer specifiers, so unsigned long long int is legal. long long double incorrectly mixes an integer-family specifier with double, and floating types cannot be unsigned.

Question 8. long double constant

Which of the following correctly represents a long double constant?

1. 6.68
2. 6.68L
3. 6.68f
4. 6.68LF

Answer: option 2, 6.68L. Plain 6.68 is double, 6.68f is float, and 6.68L is long double. LF is not a combined floating suffix. Lowercase l is permitted, but uppercase L is easier to distinguish from digit 1.

Question 9. Default real-number type

In C, by default, a real number is treated as a ____

1. float
2. double
3. long double
4. far double

Answer: option 2, double. Without a suffix, the literal 6.68 has type double. Use 6.68f for float and 6.68L for long double. far double is not a standard C type.

Character values, integer operations, and library return types

Question 10. Character arithmetic and bitwise output

This question appeared in GATE 2022.

What is printed by the following ANSI C program?

    #include<stdio.h>
    int main(int argc, char *argv[]){
         char a = 'P';
         char b = 'x';
         char c = (a & b) + '*';
         char d = (a | b) - '-';
         char e = (a ^ b) + '+';
         printf("%c %c %c\n", c, d, e);
        return 0;
    }
ASCII encoding for relevant characters is given below
A B C ... Z
65 66 67 ... 90
a b c ... z
97 98 99 ... 122
* + -
42 43 45

1. z K S
2. 122 75 83
3. * - +
4. P x +

Answer: option 1, z K S. Start with 'P' = 80 = 01010000₂ and 'x' = 120 = 01111000₂.

  • AND: 80 & 120 = 80; then 80 + 42 = 122, the code for 'z'.

  • OR: 80 | 120 = 120; then 120 - 45 = 75, the code for 'K'.

  • XOR: 80 ^ 120 = 40; then 40 + 43 = 83, the code for 'S'.

The conversion %c prints characters rather than decimal codes, so the output is z K S.

Four stacked rows working Question 10 in 8-bit binary. The top row gives P = 80 = 01010000 and x = 120 = 01111000. The AND row: 01010000 & 01111000 = 01010000 = 80, then + '*' (42) = 122 = 'z'. The OR row: 01010000 | 01111000 = 01111000 = 120, then - '-' (45) = 75 = 'K'. The XOR row: 01010000 ^ 01111000 = 00101000 = 40, then + '+' (43) = 83 = 'S'. A highlighted box at the foot gives the printf result: z K S.

Question 11. Return type of getchar

What is the return type of getchar()?

1. int
2. char
3. unsigned char
4. float

Answer: option 1, int. getchar() must represent every possible unsigned char value and the distinct sentinel EOF. On a common implementation, a byte value such as 255 and EOF such as -1 must remain distinguishable, which a plain char return type cannot guarantee.

Decimal, octal, and hexadecimal integer constants

Question 12. Mixed-base constant addition

What will be output of the following program?

#include<stdio.h>
int main(){
                int a;
                a=015 + 0x71 +5;
                printf("%d",a);
                return 0;
}

1. 127
2. 130
3. 131
4. None of these

Answer: option 3, 131. Convert before adding: octal 015 = 1 x 8 + 5 = 13, hexadecimal 0x71 = 7 x 16 + 1 = 113, and decimal 5 remains 5. Therefore 13 + 113 + 5 = 131. The %d conversion prints that integer in decimal.

What these 12 C data-type MCQs are testing, and what to do next

Questions 1 to 3 test classification and signedness. Questions 4 to 6 test ranges and storage assumptions. Questions 7 to 9 test legal specifiers and literal suffixes. Questions 10 and 11 test character values, integer operations, and library return types. Question 12 tests literal bases.

For every miss, revise the rule rather than memorising the option, then attempt the question again without viewing the choices. Keep this final checklist beside you:

  • Never assume the width of int.

  • Treat bare unsigned as unsigned int.

  • Remember that zero belongs to unsigned ranges.

  • Read literal suffixes before calculating.

  • Separate numeric character codes from %c output.

  • Convert octal and hexadecimal constants before decimal addition.

If you need the full sequence with concept teaching and MCQ practice, continue with the C Language Course. If you are preparing across C, C++, Java, Python, and coding rounds, Coding for Placements is the broader route.