Unravel Some Complex IF Logic

• Ed Wagner

SSC Guru

Points: 286988

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

• Hany Helmy

SSChampion

Points: 13488

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.

• sqlnaive

SSCoach

Points: 17435

Very good question from QOTD perspective. Thanks Dwain. 🙂

• PChiragS

SSCarpal Tunnel

Points: 4965

good question..

Thanks Dwain.

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

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