Discussion :: Bitwise Operators - Find Output of Program (Q.No.2)
Kishore said: (Aug 10, 2010) | |
Bcoz purpose of ~ will act as NOT operator and hence in binary equivalent as shows as 1111 1111 1101 1111.... hence option c.. |
Neetu said: (Aug 21, 2010) | |
32 can be written as 0000 0000 0010 0000 in 2 bytes and complement operator convert this to 1111 1111 1101 1111 |
Raja said: (Sep 2, 2010) | |
~m= ones compliment of m. Replace binary form of 32 with its compliment form. Replace 0 with 1 and 1 with 0. |
Sudheer Kumar Raina said: (Sep 3, 2010) | |
1) 32--> in binary--> for 2 bytes --> 0000 0000 0010 0000. 2) Now ~m makes all 0's to 1's and viceversa. ---> 1111 1111 1101 1111. 3) Now lets convert them into hexa, as %x is specified as format specifier. 4) Now the output in 2nd step becomes "f (15) f (d (13) f" in hexa decimal. 5) Finally "ffdf" is the answer. |
Divya said: (May 26, 2011) | |
Thanks for your explanation. |
Abani said: (Jul 8, 2011) | |
Binary representation of 32 in 16bit(turbo c) is 0000000000100000 Hence 1's complement of 32 is 1111111111011111 and whose hexadecimal form is FFDF which is option C. |
Munni said: (Jul 30, 2011) | |
m=32 In binary: 0000 0000 0010 0000 Hence C is answer. |
Neeraj Kumar said: (Dec 15, 2011) | |
Thank nitu |
Shilpa said: (Jan 20, 2012) | |
Thanks Neetu & Sudheer Kumar Raina, very well explianed. |
Sudhir Kushwaha said: (Jun 7, 2012) | |
m=32 In binary: 0000 0000 0010 0000 ~ it called tiled i.e. 1's complement of given no. Hence ~m : 1111 1111 1101 1111 f f d f Hence C is answer |
Sanjay said: (Aug 19, 2012) | |
Good explain munni. |
Chinnu said: (Aug 28, 2012) | |
Thanks munni thanku so much. |
Jayakrishana said: (Aug 31, 2012) | |
Thanks for you explanation Sudheer Kumar Raina. |
Jagajjeevan said: (Aug 31, 2012) | |
~a=-(a+1) ~32=-(32+1)=-33 Binary of 33 : 0000 0000 0001 0001 1's of 33 : 1111 1111 1110 1110 2's of 33(-33): 1 1111 1111 1110 1111 f f d f ~32 is ffdf |
Vignesh said: (Mar 1, 2013) | |
What does "f"&"d" mean and any thing others. |
Chelsi said: (Aug 10, 2013) | |
How did you took m=32 as in binary: 0000 0000 0010 0000 please explain me? |
Naveen said: (Aug 26, 2013) | |
But in the compiler provided by the indiabix.com. The output is ffffffdf. Can anyone explain why? |
Raina said: (Aug 30, 2013) | |
HOW TO WRITE . 32 = 0000 0000 0010 0000. Can anyone explain this? |
Sravanthi said: (Aug 31, 2013) | |
Assume each digit from right to left as 2 power i. Where i =0,1,2... Now 32 is 0000 0000 0010 0000. Which mean 0*(2 power 0)+0*(2 power 1)+0*(2 power 2)+0*(2 power 3)+0*(2 power 4)+1*(2 power 5)+0*(2 power 6)+.. |
Gaurav Bisht said: (Sep 24, 2013) | |
Since unsigned 2 byte m = 32 can be represented as: 0000 0000 0010 0000 To do ~m means just complimenting m i.e. ~m = 1111 1111 1101 1111 In Hexa 1111 = f and 1101 = d Therefore result is ffdf. |
Sangita said: (Sep 24, 2013) | |
The output is ffffffdf. in indiabix.com because its runs on 32 bit linux environment. If we run in turbo it will give ffff. It varies from platform to platform. |
Preeti said: (Oct 3, 2013) | |
Binary representation of 32bit - 0000000000100000. 1's - 1111111111011111. So ffdf answer. |
S.Loguprasad said: (Nov 8, 2013) | |
~ act like Not. 32 in binary 0000 0000 0010 0000. Convert to Not So 1111 1111 1101 1111. Answer in hexadecimal ffdf. |
Shruti said: (Jan 22, 2014) | |
How 32 is 0000 0000 0010 0000 ? |
Sravanthi said: (Feb 24, 2014) | |
I don't understand the above procedure can anyone lease explain me in brief I mean how to write the values of 32 in binary form? |
Mounika Kursing said: (Apr 1, 2014) | |
32 16 8 4 2 1 2^5 2^4 2^3 2^2 2^1 2^0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 f f d f We want 32, So keep 1 at 32 all other 0. For negation replace 0's with 1's. |
Vinod said: (Jul 13, 2014) | |
"%x" represents hexadecimal. How to print a number in binary form? |
Shreya said: (Oct 25, 2015) | |
32 = 2^5 = 2*2*2*2*2. So here 2^5 bit is 1 = 0000 0000 0010 0000. But what they have asked is ~m so = 1111 1111 1101 1111. |
Anirudh Sharma said: (Jul 22, 2016) | |
~ 32 = (32 + 1) *-1. - 33 33 = 0000 0000 0010 0001. 2complemnt is: 1111 1111 1101 1111 f f d f So the answer is f f d f. |
Selvameenal C said: (Apr 18, 2017) | |
Yes, there is m=32=0000 0000 0010 0000; ~m(1s complement)= 1111 1111 1101 1111; Thus answer : ffdf. |
Jishan said: (Jul 26, 2017) | |
Negative numbers are treated with 2's complement method. 1's complement: Inverting the bits ( all 1s to 0s and all 0s to 1s). 2's complement: Adding 1 to the result of 1's complement. Binary of 32(2byte) : 0000 0000 0010 0000. Representing -32: 1s complement of 32(2byte) : 1111 1111 1101 1111. Adding 1 to 1's comp. result : 1111 1111 1110 0000. Hexadecimal : f f e 0. This is not given in the option, checked on Ubuntu machine. |
Zakar said: (Nov 21, 2018) | |
32 complement = 1111 1111 1101 1111. In hexadecimal f f d f. |
Nikhil Tekade said: (Apr 19, 2022) | |
Negative numbers are treated with 2's complement method. 1's complement: Inverting the bits ( all 1s to 0s and all 0s to 1s). 2's complement: Adding 1 to the result of 1's complement. Binary of 32(2byte) : 0000 0000 0010 0000. Representing -32: 1s complement of 32(2byte) : 1111 1111 1101 1111. Adding 1 to 1's comp. result : 1111 1111 1110 0000. Hexadecimal: f f df. |
Post your comments here:
Name *:
Email : (optional)
» Your comments will be displayed only after manual approval.