• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

taming binary questions..

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am wondering is anybody got an easy solution/formula to solve the binary related questions?
I would value any input regarding this.
Thanks in adv.
 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the easiest way to handle the binary questions is to learn/understand binary and simply work through them.
ex:
5 & 9 = ?
(first convert to binary and find the result)
0101 & 1001 = 0001
(second convert the answer to decimal)
5 & 9 = 1
find two's compliment of 77
(convert 77 to binary)
0100 1101
(invert the digits)
1011 0010
(add 1)
1011 0011
(convert to signed decimal)
-51
.... hmmmm did I do that right?
[ November 16, 2002: Message edited by: Jessica Sant ]
 
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jessica - I think you're trying to trick us! 1011 0011 is -77... it's true that 00110011 is 51, but you don't just flip the sign bit to get a negative number... you've got to do the whole 2's compilment tango... were we on our toes?
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also check out our campfire story: Cat and Mouse Games with Bits
 
reply
    Bookmark Topic Watch Topic
  • New Topic