Skip to content
GATEiit

GATE CSE 2021 Set 2 Q54: 2-byte value 255 larger on little endian than on big endian

Question

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?

Try it: multiple select: one or more correct options

Select one or more options
Select all correct options. No negative marking, no partial marks.
Show answer and explanation

Answer: A, D (official GATE 2021 final answer key)

Concept used: The same two bytes read in the other order swap the high and low bytes.

First step: If the little-endian value is 256h+l256h + l, the big-endian reading is 256l+h256l + h; their difference is 255(h−l)255(h - l), so h−l=1h - l = 1.

Full step-by-step solution

Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.

Share this question

WhatsAppDownload image

Source: official GATE 2021 Set 2 CS question paper and final answer key, organised by IIT Bombay. Question paper · Answer key