arupananda


{ City } bangalore
< Country > india
* Profession * engineer
User No # 91946
Total Questions Posted # 0
Total Answers Posted # 2

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 29
Users Marked my Answers as Wrong # 3
Questions / { arupananda }
Questions Answers Category Views Company eMail




Answers / { arupananda }

Question { 7404 }

what is output of the following statetment?Printf(“%x”,
-1<<4); ?


Answer

Question is -1<<4
Answer to 16bit compiler
As -1 is a negative number,so compiler first convert this number with removing negative sign to 2's complement
Here -1 is given
so compiler first removes the -ve sign and then convert to 2's complement
Binary form of 1 for 16 bit compiler is 0000 0000 0000 0001
1's complement of 1 is 1111 1111 1111 1110
2's complement of 1 is 1111 1111 1111 1111(1+1's complement)
now do the left shift operation
1111 1111 1111 1111 << 4
which results 1111 1111 1111 0000
i.e equivalent to FFF0 in hex format
So the answer is FFF0 for 16 bit compiler
And for 32 bit compiler it is FFFF FFF0 (do same operation as 16 bit compiler)

Is This Answer Correct ?    1 Yes 1 No

Question { 17509 }

why the crystal frequency of 8051 is divide by 12 for its
working?


Answer

1 machine cycle need to execute 12 oscillator period in 8051. That is why the crystal freq is divided by 12...

It is a prescaler which is used to execute 1 machine cycle instruction..

Is This Answer Correct ?    28 Yes 2 No