Binary

  • Comments posted to this topic are about the item Binary

  • There are only 10 types of people in this world.

    .

  • Cool, in

    11111011110

    it was essential to spot that the first two bits (1) and the last one (0) are constructing the right answer.

    Regards,

    IgorMi

    Igor Micev,My blog: www.igormicev.com

  • Bill (DBAOnTheGo) (12/31/2013)


    There are only 10 types of people in this world.

    +10 🙂

  • Awesome, thank you for the post, Steve.

    HAPPY NEW YEAR 11111011110, to all SQL family 🙂 (we are proud, as our family is growing bigger each day)

    (I took the classic style, you know - pen paper and base-2)

    -//Edit: Today I can proudly point back to my signature and say, I can be counter under "who understands binary"

    ww; Raghu
    --
    The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.

  • Bill (DBAOnTheGo) (12/31/2013)


    There are only 10 types of people in this world.

    +1

    ww; Raghu
    --
    The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.

  • Steve, I love these questions. Thanks:-D

    Oh, here is an excerpt of a UDF I used to convert from int to binary (of course the other aspects of the UDF is checking the data type). I'm sure many of you use something similar or SQL Server bitwise ANDs. Just thought I'd share.

    Thanks

    --Convert to "binary"\HEX

    select CONVERT(binary,2014), CONVERT(varbinary,2014)

    --Returns 0x7DE...of course, the actual result between the two are different (fixed vs. variable)

    --Convert string value to true binary representation

    declare @parmVal int

    declare @currVal varchar(64)

    declare @counter int

    set @parmVal=2014

    select @counter = 64, @currVal = ''

    while @counter>0

    begin

    select @currVal = convert(char(1), @parmVal % 2)+@currVal

    select @parmVal = convert(int, (@parmVal / 2))

    select @counter=@counter-1

    end

    select @currVal

    --Returns 11111011110 (I left off the prepended 0's)

  • Happy New Year friends!

    ~ Lokesh Vij


    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter

  • Happy New Year

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • For me it was an easy one - I used to work as a Systems Programmer on IBM mainframes...

    Thanks, Steve, and Happy New Year, all!

  • The two more significant bits and the least significant bit were how I got it.

    😉

    Sincerely,
    Daniel

  • Required to do Some pen paper work..!!

    Nice Question to Start the Year 2014.

    Thanks for the question. 🙂

  • thanks steve,..... & happy new year to all!

  • First, notice 2014 is even, so first and third answer are out because they are odd.

    Next, notice the bits that differ in the remaining two answer choices(second bit from the left having value of 512) and see which choice is correct.

    Calculate 2014 minus 1024(the leftmost bit value) to see if difference leaves enough to subtract 512. If yes, choose answer with bit on; if no choose answer with bit off. Since the answer is yes, then the 512 bit must be on, so the correct answer is the fourth choice.

  • Happy New Year 11111011110 to All!!!!

Viewing 15 posts - 1 through 15 (of 28 total)

You must be logged in to reply to this topic. Login to reply