Question:medium

If the numerical value of a 2-byte unsigned integer on a little endian computer is 255 more than that on a big endian computer, which of the following choices represent(s) the unsigned integer on a little endian computer?

Show Hint

For 2-byte numbers, an endian difference of 255 occurs exactly when the two bytes differ by 1.
Updated On: Feb 2, 2026
  • 0x6665
  • 0x0001
  • 0x4243
  • 0x0100
Show Solution

The Correct Option is A, D

Solution and Explanation

To solve this problem, we need to understand how numbers are represented differently in little endian and big endian formats. In a little endian system, the least significant byte (LSB) is stored first. In a big endian system, the most significant byte (MSB) is stored first. Given that the numerical value on a little endian computer is 255 more than that on a big endian computer, let's explore the options to determine the correct answer.

  1. Analyze the differences in endianness:
    • If a number is represented as 0xABCD in big endian, its little endian equivalent would be 0xCDAB.
  2. Identify possible candidates: We need a case where \text{Little Endian Value} = \text{Big Endian Value} + 255.
  3. Verification of options:
    • Option 1: 0x6665 - Little endian as 0x6566, Big endian as 0x6665.
    • Convert these hexadecimal values to decimal:
    • 0x6566 = 25958, 0x6665 = 26213. The difference is indeed 255.
    • Option 4: 0x0100 - Little endian as 0x0001, Big endian as 0x0100.
    • Convert these hexadecimal values to decimal:
    • 0x0001 = 1, 0x0100 = 256. Here, also the difference is 255.

Both options meet the condition, hence the correct choices are 0x6665 and 0x0100.

Was this answer helpful?
0