An array of 2 two byte integers is stored in big endian machine in byte…

2020

An array of 2 two byte integers is stored in big endian machine in byte address as shown below. What will be its storage pattern in little endian machine ?

Address Data
0 × 104 78
0 × 103 56
0 × 102 34
0 × 101 12 
  1. A.
    0 × 104 12
    0 × 103 56
    0 × 102 34
    0 × 101 78 
  2. B.
    0 × 104 12
    0 × 103 34
    0 × 102 56
    0 × 101 78 
  3. C.
    0 × 104 56
    0 × 103 78
    0 × 102 12
    0 × 101 34 
  4. D.
    0 × 104 56
    0 × 103 12
    0 × 102 78
    0 × 101 34 

Attempted by 75 students.

Show answer & explanation

Correct answer: C

First, interpret the given Big Endian memory dump. In Big Endian, the Most Significant Byte (MSB) is stored at the lower address. The first integer occupies addresses 0x101 and 0x102 with values 12 and 34 respectively, forming the value 0x1234. The second integer occupies addresses 0x103 and 0x104 with values 56 and 78 respectively, forming the value 0x5678. Next, convert this to Little Endian format. In Little Endian, the Least Significant Byte (LSB) is stored at the lower address within each integer. For the first integer (0x1234), the LSB is 34 and MSB is 12. Thus, address 0x101 stores 34 and 0x102 stores 12. For the second integer (0x5678), the LSB is 78 and MSB is 56. Thus, address 0x103 stores 78 and 0x104 stores 56. The final storage pattern is: 0x101=34, 0x102=12, 0x103=78, 0x104=56.

Explore the full course: Isro