|
|
|
SSChasing Mays
      
Group: General Forum Members
Last Login: Saturday, April 06, 2013 12:20 AM
Points: 649,
Visits: 263
|
|
| Comments posted to this topic are about the item AND & OR
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 5:46 AM
Points: 384,
Visits: 186
|
|
Tricky question especially in the morning 
Kindest Regards,
Damian Widera SQL Server MVP, MCT, MCITP-DBA, MCSD.NET
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Thursday, May 09, 2013 8:55 AM
Points: 1,865,
Visits: 556
|
|
arghh!! I spent a few minutes playing with a spreadsheet to mock up the bitwise AND and OR functions (a happy little diversion) and i missed the data type gotcha!
ah well...
Life: it twists and turns like a twisty turny thing
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Thursday, January 24, 2013 9:59 PM
Points: 1,354,
Visits: 1,299
|
|
I just did the same thing -- missed the bit datatype.
120 = 01111000 030 = 00011110 040 = 00101000
120 and 30 = 11000 in binary or 8 + 16 = 24 24 or 40 = 11000 or 101000 = 111000 = 8 + 16 + 32 = 56
Well, all that work was thrown out the window because of the bit datatype.
I'm getting tired of these trick questions. The title of the question says AND & OR and that led me to believe the author is testing our binary skills -- not our visual acuity. We have a list of variables that are all INT except one that's squeezed in the middle. Sheesh.
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Yesterday @ 1:32 AM
Points: 3,187,
Visits: 4,140
|
|
I am disappointed with the question, too. If I copied the script into SSMS, I would get the right answer. Instead, I took a piece of paper and wrote binary 'ones' and 'zeroes'... and didn't notice the 'bit' trick...
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Friday, November 30, 2012 1:52 AM
Points: 1,116,
Visits: 602
|
|
I completely agree with this, though I was this time lucky I found the bit this time. But this is not testing for knowledge about the meaning of bitwise comparising, which can be very useful.
Ronald Hensbergen
Help us, help yourself... Post data so we can read and use it: http://www.sqlservercentral.com/articles/Best+Practices/61537/ ------------------------------------------------------------------------- 2+2=5 for significant large values of 2
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Friday, May 03, 2013 3:39 AM
Points: 857,
Visits: 584
|
|
Absolutely ridiculous!
What is the point of a trick question on a technical forum? Maybe you could argue that as developers we need to pay attention to the smallest detail, but that's a pretty thin argument when we're coming here to challenge our knowledge, not our powers of observation.
A question about AND and OR is good, working out the answer is a pleasant diversion, discovering that it wasn't a question about AND or OR at all but rather an exercise in hiding the word 'bit' amongst a list of 'int's and seeing who noticed... really disappointing, to the point of making me angry!
I'm sorry - I know people put effort into making up the questions and they could have a legitimate point that I have no right to complain when I don't submit questions of my own, but this is just annoying.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Friday, November 30, 2012 1:52 AM
Points: 1,116,
Visits: 602
|
|
hodgy (10/14/2009) arghh!! I spent a few minutes playing with a spreadsheet to mock up the bitwise AND and OR functions (a happy little diversion) and i missed the data type gotcha!
ah well... I hope you know about the Excel functions DEC2BIN and BIN2DEC (from Analysis Toolpak)...
Ronald Hensbergen
Help us, help yourself... Post data so we can read and use it: http://www.sqlservercentral.com/articles/Best+Practices/61537/ ------------------------------------------------------------------------- 2+2=5 for significant large values of 2
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 5:13 AM
Points: 1,123,
Visits: 986
|
|
vk-kirov (10/14/2009) I am disappointed with the question, too. If I copied the script into SSMS, I would get the right answer. Instead, I took a piece of paper and wrote binary 'ones' and 'zeroes'... and didn't notice the 'bit' trick...
Not only a trick question, but one that is possible to get right by getting the reasoning all wrong...
If you don't know that AND and OR operate bitwise on integers, you might assume that it works like Excel's AND() function which treats nonzero values as TRUE and zeroes as FALSE. Then it would return 1 as the value, even if all the variables were declared as INT.
So you'd get the right answer, but for the wrong reason - and you'd go away "knowing" something about these operators that "ain't so".
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Tuesday, April 02, 2013 8:28 PM
Points: 555,
Visits: 2,137
|
|
I think that was a nice question because it practices the capacity to get the details: sometimes, I make error (well it does not append that often ) and can look for them for a long time, missing the detail ...
|
|
|
|