Doing binary conversions by hand

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amanda22
    New Member
    • Nov 2007
    • 8

    Doing binary conversions by hand

    I am having a time with these problems:

    X=1100110000110 011
    Y=0000111100001 010

    1) what would I get in binary representation for X<<5?

    2) what is the two's complement of negative Y (-Y)?

    3) If X is an int variable, what do we know about the value of X&X?
    a. It is always equal to X.
    b. It is always greater than 1.
    c. It is always equal to zero.
    d. It is always equal to 1.
  • sicarie
    Recognized Expert Specialist
    • Nov 2006
    • 4677

    #2
    What are you having trouble with? Did you try them? What did you get?

    Comment

    • AHMEDYO
      New Member
      • Nov 2007
      • 112

      #3
      HI.,..

      i cant understand Q1 fully, but if you wanna all binary values for x < 5 then

      Q1: x=000 , 001 , 010 , 011 , 100

      Q2: to get the 2's complementer first u reverse all bits 0s to 1s and all 1s to 0s and then additional the result by 1

      Y=0000111100001 010

      1's Complementer =11110000111101 01
      2's Complementer =00000000000000 01

      and then add each 2 bits ------------------------------
      = xxxxxxxxxxxxxxx x

      the result is the 2's complementer for Y or -Y by 2's complementer

      Q3: answer is choice A

      try to check behind me i cant exactly rememmber all things, but i think it will right answer..

      by the way is that home work? :D

      GOOD LUCK..

      Comment

      • Ganon11
        Recognized Expert Specialist
        • Oct 2006
        • 3651

        #4
        Q1 isn't asking about the < operator, but the bitshift operator <<, which I believe moves the entire set of bits to the left, creating 0s at the end. For instance,

        Code:
        X = 0100 1101
        X << 2
        (X is now 0001 0011 0100)
        Of course, I could be wrong.

        Comment

        • AHMEDYO
          New Member
          • Nov 2007
          • 112

          #5
          Originally posted by Ganon11
          Q1 isn't asking about the < operator, but the bitshift operator <<, which I believe moves the entire set of bits to the left, creating 0s at the end. For instance,

          Code:
          X = 0100 1101
          X << 2
          (X is now 0001 0011 0100)
          Of course, I could be wrong.
          hey..no man i think that you fully right, its SHL operator

          Many Thanx

          Comment

          Working...