Machine-translated by Google. Questions are authored in English.
Top

Discussion

If an integer needs two bytes of storage, then the maximum value of a signed integer is

  • A.\(2^{16} - 1\)
  • B.\(2^{15} - 1\)
  • C.\(2^{16}\)
  • D.\(2^{15}\)

Answer: B

The maximum signed integer in two bytes is \(2^{15} - 1\).

Two bytes are 16 bits. In two's complement the top bit is the sign, which leaves 15 bits for the value:

\[ \text{max} = 2^{15} - 1 = 32767 \]

\(2^{16} - 1\) is 65535, the largest unsigned value in two bytes. \(2^{16}\) and \(2^{15}\) are one more than the largest unsigned and signed values, so no 16-bit integer can reach them.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.