Skip to content
Official PYQ · 2021

GATE CS 2021 Set 2 Q44 — Number Representations (Fixed and Floating Point)

Explain with AI

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

Select all correct options
View worked solution

Answer: A;D

Let the 2-byte unsigned integer be stored in memory at consecutive byte addresses AA and A+1A+1 as bytes XX and YY respectively.

  • On a Little Endian computer, the least significant byte (LSB) is stored at the lower address AA. Thus, the value is: VLE=Y⋅256+XV_{LE} = Y \cdot 256 + X
  • On a Big Endian computer, the most significant byte (MSB) is stored at the lower address AA. Thus, the value is: VBE=X⋅256+YV_{BE} = X \cdot 256 + Y

According to the problem, the value on the little endian computer is 255255 more than that on the big endian computer:

VLE−VBE=255V_{LE} - V_{BE} = 255 (Y⋅256+X)−(X⋅256+Y)=255(Y \cdot 256 + X) - (X \cdot 256 + Y) = 255 255(Y−X)=255  ⟹  Y−X=1255(Y - X) = 255 \implies Y - X = 1

This means the most significant byte (YY) must be exactly 11 greater than the least significant byte (XX). Let us evaluate the options represented as 0xYX0\text{x}YX:

  • Option A (0x66650\text{x}6665): Y=0x66Y = 0\text{x}66, X=0x65X = 0\text{x}65. Here, Y−X=0x66−0x65=1Y - X = 0\text{x}66 - 0\text{x}65 = 1. (Correct)
  • Option B (0x00010\text{x}0001): Y=0x00Y = 0\text{x}00, X=0x01X = 0\text{x}01. Here, Y−X=−1Y - X = -1. (Incorrect)
  • Option C (0x42430\text{x}4243): Y=0x42Y = 0\text{x}42, X=0x43X = 0\text{x}43. Here, Y−X=−1Y - X = -1. (Incorrect)
  • Option D (0x01000\text{x}0100): Y=0x01Y = 0\text{x}01, X=0x00X = 0\text{x}00. Here, Y−X=1−0=1Y - X = 1 - 0 = 1. (Correct)

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Number Representations (Fixed and Floating Point) questions