Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
218 views
in Information Technology by (95.2k points)
closed by

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?

Address

Data

0 × 104

78

0 × 103

56

0 × 102

34

0 × 101

12


1.

0 × 104    12

0 × 103    56

0 × 102    34

0 × 101    78


2.

0 × 104    12

0 × 103    34

0 × 102    56

0 × 101    78
3.

0 × 104    56

0 × 103    78

0 × 102    12

0 × 101    34
4.

0 × 104    56

0 × 103    12

0 × 102    78

0 × 101    34

1 Answer

0 votes
by (95.4k points)
selected by
 
Best answer
Correct Answer - Option 3 :

0 × 104    56

0 × 103    78

0 × 102    12

0 × 101    34

Concept -

  • Little and big endian are two ways of storing multi-byte data-types like int, float, etc.
  • In little endian machines, last byte of binary representation of the multi-byte data-type is stored first.
  • On the other hand, in big endian machines, first byte of binary representation of the multi-byte data-type is stored first.

 

Explanation -

Given in the question is that each integer is of two bytes. For little endian-big endian, we will determine MSB and LSB of both the integers.

The big endian format,

104

103

102

101

78

56

34

12

MSB-1

LSB-1

MSB-2

LSB-2

 

MSB-1 refers to MSB of 1st integer.

For little endian, we simply have to reverse the exchange MSB with LSB and vice versa.

104

103

102

101

56

78

12

78

LSB-1

MSB-1

LSB-2

MSB-2

 

Hence, Option 3 is correct.

NOTE

if this was one integer with 4 bytes, then in little endian format, entire sequence would have been reversed.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...