Whats the o/p of following
#define BUFF_SIZE 64*1024
UWord64 fileOffset;
fileOffset = readFromFile(BUFF_SIZE);
/* above fn returned BUFF_SIZE */
fileOffset -= BUFF_SIZE - 71444;/* 17444=0x11714 */
Options:
1. 18446744069414655764 or 0xffff ffff 0001 1714
2. 71444 or 0x1 1714
Soln:
BUFF_SIZE - 71444 i.e 65536 - 71444 is converted to 2's compliment form in Word32 format which is 0xffff e8ec. That value is subtracted from 0x0000 0000 0001 0000. So option 1 is the ans.
UWord64 fileOffset;
fileOffset = readFromFile(BUFF_SIZE);
/* above fn returned BUFF_SIZE */
fileOffset -= BUFF_SIZE - 71444;/* 17444=0x11714 */
Options:
1. 18446744069414655764 or 0xffff ffff 0001 1714
2. 71444 or 0x1 1714
Soln:
BUFF_SIZE - 71444 i.e 65536 - 71444 is converted to 2's compliment form in Word32 format which is 0xffff e8ec. That value is subtracted from 0x0000 0000 0001 0000. So option 1 is the ans.
Comments