ISRO Scientist/Engineer CSE 2020Computer Organization and Architecture › Not yet assigned to a topic
ISRO Scientist/Engineer CSE 2020 PYQ: An array of 2 two byte integers is stored in big endian machine in byte addresses as shown below. What will…
An array of 2 two byte integers is stored in big endian machine in byte addresses as shown below. What will be its storage pattern in little endian machine ?
$$\begin{array}{c|c}\text{Address}& \text{Data}\\\hline0 \times 104&78\\0 \times 103&56\\0 \times 102&34\\0 \times 101&12\end{array}$$
- A$\begin{array}{c|c}\text{Address}& \text{Data}\\\hline0 \times 104&12\\0 \times 103&56\\0 \times 102&34\\0 \times 101&78 \\ \\\end{array}$
- B$\begin{array}{c|c}\text{Address}& \text{Data}\\\hline0 \times 104&12\\0 \times 103&34\\0 \times 102&56\\0 \times 101&78\\\\\end{array} \\$
- C$\begin{array}{c|c}\text{Address}& \text{Data}\\\hline0 \times 104&56\\0 \times 103&78\\0 \times 102&12\\0 \times 101&34\\\\\end{array} \\$Correct answer
- D$\begin{array}{c|c}\text{Address}& \text{Data}\\\hline0 \times 104&56\\0 \times 103&12\\0 \times 102&78\\0 \times 101&34\end{array}$
Answer
(C) $\begin{array}{c|c}\text{Address}& \text{Data}\\\hline0 \times 104&56\\0 \times 103&78\\0 \times 102&12\\0 \times 101&34\\\\\end{array} \\$
Approach
The array consists of two 2-byte integers. In big-endian, the most significant byte (MSB) of each word is stored at the lower address. In little-endian, the least significant byte (LSB) of each word is stored at the lower address. Therefore, within each 2-byte word, the byte order is reversed when switching from big-endian to little-endian, while the word boundaries remain the same.
Reviewed by ISRO IQ Editorial Team.