If the numerical value of a -byte unsigned integer on a little endian computer is more than that on a big endian computer, which of the following choices represent(s) the unsigned integer on a little endian computer?
View worked solution
Answer: A;D
Let the 2-byte unsigned integer be stored in memory at consecutive byte addresses and as bytes and respectively.
- On a Little Endian computer, the least significant byte (LSB) is stored at the lower address . Thus, the value is:
- On a Big Endian computer, the most significant byte (MSB) is stored at the lower address . Thus, the value is:
According to the problem, the value on the little endian computer is more than that on the big endian computer:
This means the most significant byte () must be exactly greater than the least significant byte (). Let us evaluate the options represented as :
- Option A (): , . Here, . (Correct)
- Option B (): , . Here, . (Incorrect)
- Option C (): , . Here, . (Incorrect)
- Option D (): , . Here, . (Correct)
Free practice · Your answers on this page are not saved.
