Unravel Some Complex IF Logic

  • I enjoyed the question as well. It made me really think through possibilities, so thank you.

  • Thomas Abraham (1/9/2014)

    Let's try to simplify:

    "Option 3 will always return an integer value for @Result" is false, as it is not GUARANTEED to provide a specific value for @Result when @AA is not equal to any of the 6 test values.

    "Options 3 and 5 are identical" is false, because even if @AA is not equal to any of the six test values, it sets @Result to 0.

    "Answers 2 and 3 are both true" is thus false, because Answer 2 is false.

    By default, "Options 1, 2 and 4 are equivalent and identical to the original code" is the remaining answer that has not already been proven to be false.

    Nice analysis Tom.

    Thanks & Best Regards,
    Hany Helmy
    SQL Server Database Consultant

  • Very good question from QOTD perspective. Thanks Dwain. 🙂

  • good question..

    Thanks Dwain.

Viewing 4 posts - 16 through 18 (of 18 total)

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