GATE / CS ARCHIVE

GATE CSE 2021 SET 2 / QUESTION 44

GATE CSE 2021 Set 2 Q44

Computer Organization & Architecture · Data Representation & Arithmetic · Full GATE CSE 2021 Set 2 paper

GATE 2021 Set 2, Q44 2 marks · MSQ
Report issue

Data Representation & Arithmetic

Question 44, GATE 2021: The same two bytes represent an unsigned value 255 greater under little endian than big endian. Which little-endian hexadecimal values qualify? A 0x6665; B 0x0001; C 0x4243; D 0x0100.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A; D

For bytes a, b in increasing address order, little-endian value is 256b+a and big-endian value is 256a+b. Their difference 255(b-a) equals 255 exactly when b=a+1. A little-endian numeral must therefore have its high-order byte one larger than its low-order byte. 0x6665 and 0x0100 satisfy this; 0x0001 and 0x4243 have the opposite sign of difference. Answer A, D.

Evaluate options numerically without decimal conversion: byte swap of 0x6665 is 0x6566, difference 0x00FF; swap of 0x0100 is 0x0001, also 0x00FF. The other two have differences −255. Unsigned means the ordinary nonnegative two-byte values, not a signed interpretation of either byte.

Original paper, page 81 · Answer key