Which of the following statements about data types is wrong?

2022

Which of the following statements about data types is wrong?

  1. A.

    The number is always positive when the qualifier 'unsigned' is used.

  2. B.

    The number can be positive or negative when the qualifier 'signed' is used.

  3. C.

    The range of values for signed data types is more than that of unsigned data types.

  4. D.

    The leftmost bit in an unsigned data type is used to represent the value.

Attempted by 1242 students.

Show answer & explanation

Correct answer: C

Concept

A data type's storage is a fixed number of bits, and that width fixes the total count of distinct values it can hold (2^n for n bits). 'signed' versus 'unsigned' does not change how many values exist — it only changes which values those bit-patterns are mapped to. A signed type dedicates one bit to recording the sign, so its patterns are split between negative and non-negative numbers; an unsigned type uses every bit for magnitude, so all its patterns are non-negative.

Applying it to each statement

Read every statement and decide whether it is true; the question asks for the one that is wrong.

  • Unsigned removes the sign, so it cannot store a negative number (it stores non-negative values) — a true description of unsigned behaviour.

  • Signed reserves a sign bit, so it can store both negative and non-negative numbers — a true description of signed behaviour.

  • Signed has a greater range than unsigned — this is the claim to test below.

  • In unsigned, no bit is reserved for a sign, so every bit (including the leftmost) carries magnitude — a true description.

Cross-check the range claim with an 8-bit example

  1. Unsigned 8-bit uses all 8 bits for magnitude: it covers 0 to 255, so its maximum value is 255.

  2. Signed 8-bit (two's complement) spends one bit on the sign: it covers -128 to 127, so its maximum value is 127.

  3. Both hold 2^8 = 256 distinct values, but the unsigned maximum (255) is larger than the signed maximum (127).

Result

Because the unsigned type reaches a higher maximum value for the same width, the statement claiming that signed types have a larger range than unsigned types does not hold. The other three statements correctly describe how signed and unsigned types behave.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Mppsc Assistant Professor