integer lengths (II)

  • Comments posted to this topic are about the item integer lengths (II)

    Tom

  • This question has a serious error. I've asked Steve to correct it. I hope he will award back points to anyone who was caught by the error (only two people so far).

    Tom

  • Correct answer:

    When J is between -999,999,999 and -100,000,000 or between 1,000,000,000 and 2,147,483,647

    Correct explanation:

    ...

    If the expression is between -999,999,999 and -1(,0)00,000,000 or between 1,000,000,000 and 2,147,483,647 it's decial representation requires exactly 10 didits, so it will just fit into a 10 character string with no paddiing with spaces either side; so the strings STR(J) and cast(J as char(10)) are both the correct decimal representation of J, hence both the same and the expression evaluates to TRUE in this case.

  • Correct answer:

    When J is between -999,999,999 and -100,000,000 or between 1,000,000,000 and 2,147,483,647

  • Correct answer:

    When J is between -999,999,999 and -100,000,000 or between 1,000,000,000 and 2,147,483,647

  • Nice question, thanks.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • TomThomson (7/4/2015)


    This question has a serious error. I've asked Steve to correct it. I hope he will award back points to anyone who was caught by the error (only two people so far).

    I missed the error, so I answered the question as intended (and got it right). 😀

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • I totally misunderstood the question--somehow thought it was asking when the CAST would result in TRUE, which it obviously never will. Realised my error when I read the answer. :crying:

  • I also noticed the error but I thought it should be the right answer because there are 2 ranges and only one answer has 2 ranges.

    1 range has been described well, the other was just missing one 0.

    It is logic :

    minus sign with 9 digits

    plus is without a sign, so 10 digits

    and of course there is the INT limit

  • Good question Tom.

    Despite the error, the answer is clear.

    In the way the answers has been described,

    it was like a one error-correcting answer.

    (such as in the digital technique)

  • I saw that it couldn't have been true for any of the given answers, but understood the point of the question, so I answered with the closest answer and it was right. Another question to make people think - nice one. And at least you found your own error. 😀

  • This was removed by the editor as SPAM

  • I presumed there was a typo too and got it right. I still reviewed all of the choices 5 times though before choosing the one that appeared to be the intended correct answer. A well intended question.

  • Good discovery. Thanks.

    Igor Micev,My blog: www.igormicev.com

  • It seems to be taking a mush longer time that usual to get the question corrected - I mesaged Steve as soon as I saw it (Saturday evening UK time) so thought it would be fixed early Monday (the official publication date); I guess Independence day falling on Saturday is both the reason it was publshed before its official date and the reason it didn't get corrected today.

    Tom

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

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