There are already good answers posted but let me share the “quickest” approach to the question.
First, let’s discuss the concept, and then we’ll dive straight to the question.
Concept :
Let’s take a binary number i.e. 0101 011
Ques) How do we write this in decimal format?
Ans) Let’s take 0101 and left shift it by 3, we get 0101 000 and we can write it in decimal as $5\times 2^{3}$
Now, add 011 i.e. $3$ to it.
Finally, we get $5\times 2^{3} + 3$
Here, we apply this concept to the question as well,
Given in the question, 2 byte integer format,
Little Endian :
<---------------------1 byte-------------------><-----------------------1 byte-------------------->
x |
y |
where x and y represents decimal value corresponding to their respective binary number
So, in decimal, we get $x\times 2^{8} + y$ _______(1)
Big Endian :
<---------------------1 byte-------------------><-----------------------1 byte-------------------->
y |
x |
where x and y represents decimal value corresponding to their respective binary number
So, in decimal, we get $y\times 2^{8} + x$ ________(2)
Now, Question says
“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”.
That means, Value of Little Endian = Value of Big Endian + 255
From (1) and (2), we get
$x\times 2^{8} = y\times2^{8} + 255$
$256x + y = 256y + x + 255$
$x - y =1$
That means, we've to check only decimal values represented by x and y respectively and check whether their difference is 1 or not.
Given in the question, options are represented in “Little endian format” , thus, we can say
x represents MSB and y represents LSB.
(refer above concept)
Let’s check options now :
Option A:
$0x6665 = 01100110 01100101$
$x = 01100110 = (102)_{10}$ ; $y = 01100101 = (101)_{10}$
$x - y = 1$
Therefore, Option A is valid.
Option B:
$0x0001 = 00000000 00000001$
$x = 00000000 = (0)_{10}$ ; $y = 00000001 = (1)_{10}$
$x - y = -1$
Therefore, Option B is not valid.
Option C:
$0x4243 = 01000010 01000011$
$x = 01000010 = (66)_{10}$ ; $y = 01000011 = (67)_{10}$
$x - y = -1$
Therefore, Option C is not valid.
Option D:
$0x0100 = 00000001 00000000$
$x = 00000001 = (1)_{10}$ ; $y = 00000000 = (0)_{10}$
$x - y = 1$
Therefore, Option D is valid.
Hence, Option A and Option D are correct.