in DS
474 views
0 votes
0 votes

What will be output ?

A. Abnormal Termination.

B. Infinite loop

C. Output wil be 65536

D. None

Ans. D

in DS
by
474 views

1 comment

a=240 and b=1  = 2240-240

a=241 and b=2 =2241-240

a=242 and b=2*2 =2242-240

a=243 and b=2*2*2=2243-240

.........

a=255 and b= 215 = 2255-240

a=256 which takes 2B but unsigned char has 1B so the considering little endian architecture, the MSB i.e. 1 goes out of this 1B and a becomes 0.

b=2256-240=216. b is unsigned short which has 2B but 216 requires 17 bits i.e. >2B. So again MSB goes out from this 2B and it becomes 0.

So i think function will return 0.

4
4

Please log in or register to answer this question.

Related questions