Home » C Programming » Data Types » Question
  1. If the binary equivalent of 5.375 in normalized form is 0100 0000 1010 1100 0000 0000 0000 0000, what will be the output of the following program?
    #include <stdio.h>
    int main ( )
    {
    float a =5.375 ;
    char *p ;
    int i ;
    p = (char *) &a ;
    for (i = 0 ; i <= 3 ; i++)
    printf("%02 X \n" , (unsigned char) p[ i ]);
    return 0 ;
    }
    1. 40 AC 00 00
    2. 04 CA 00 00
    3. 00 00 AC 40
    4. 00 00 CA 04
Correct Option: C

Binary equivalent of 5.375 in normalized form is

0100 -> 4
0000 -> 0

1010 -> A
1100 -> C

0000 -> 0
0000 -> 0

0000 -> 0
0000 -> 0

Since the PC's (Intel processors) use " LITTLE ENDIAN" byte order, the higher order byte of number is stored in lowest address. The result is written from bottom to top.



Your comments will be displayed only after manual approval.