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

Answer Posted / arupananda

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many data structures are there in c?

601


What tq means in chat?

569


I completed my B.tech (IT). Actually I want to develop virtual object that which will change software technology in the future. To develop virtual object what course I have to take. can I any professor to help me.

1729


What are the data types present in c?

617


What is the difference between Printf(..) and sprint(...) ?

770






What is #include called?

557


Explain what is the general form of a c program?

616


any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above

646


Iam a B.Tech graduate and completed my engineering in 2009, from 2005 to 2009 and after that i had done nothing.Now i want to do job and get into BPO field . Friends give me suggestions as what to say in interview... if they ask me that what would you had done ... these many years without doing job ??????? pls urgent

1421


Is printf a keyword?

747


What is the sizeof () a pointer?

540


When is the “void” keyword used in a function?

820


How do you search data in a data file using random access method?

814


Why do we use stdio h and conio h?

621


Explain what is the concatenation operator?

615