In the conventional data model of a 16-bit C compiler, the size of long int is:
2019
In the conventional data model of a 16-bit C compiler, the size of long int is:
Answer: B. 32 bits — ConceptIn C, integer-type widths are implementation-defined, but long int must represent at least the range −2,147,483,647 to 2,147,483,647. Traditional…
- A.
8 bits
- B.
32 bits
- C.
16 bits
- D.
24 bits
Attempted by 4 students.
Show answer & explanation
Correct answer: B
Concept
In C, integer-type widths are implementation-defined, but long int must represent at least the range −2,147,483,647 to 2,147,483,647.
Traditional 16-bit C data models use a 16-bit int and a 32-bit long int.
Application
Use the conventional 16-bit C data model named in the stem:
long intoccupies 4 bytes in that model.Convert bytes to bits using 8 bits per byte: 4 × 8 = 32 bits.
Contrast
8 bits is one 8-bit byte, which is narrower than even the conventional 16-bit
intin this model.16 bits is two 8-bit bytes and is the conventional width of
int, notlong int, in this model.24 bits is three 8-bit bytes and is not the conventional
long intwidth used by this data model.
Cross-check
A signed 16-bit object reaches only 32,767, whereas long int must represent values through at least 2,147,483,647. A 32-bit signed representation meets that minimum range, confirming 32 bits.