Fog Creek Software
Discussion Board




2 x 2

2 x 2 = ?

I will accept only complete (and correct, of course) answers :)

Dmitri Papichev
Friday, February 25, 2005

OK, no answers so far...
Is the question too easy? Too hard? Too boring? Or too silly maybe? :)

Dmitri Papichev
Monday, February 28, 2005

Let's try some possible answers:

1) In any base greater than 4, assuming normal interpretation of the symbols, the answer is 4
2) In base 3 the answer is 11
3) In base 4 the answer is 10
4)In base 2 '2' is not a valid number so the question is meaningless.

If x is a variable, and taking adjacency of symbols as multiplication, the answer is 4x

If we are talking about matrices, it describes a square matrix with four elements (and undefined contents)

Any others?

David Clayworth
Monday, February 28, 2005

David, you got it right - there are three possible answers dependind on the counting base.

I considered x to be a multiplication sign

I really like that question - isn't it good for the technical interview? :)

Dmitri Papichev
Tuesday, March 01, 2005

It's a horrible interview question.  It falls in the "I know a little bit about numbers, so I'll try to stump people" category.

Here's the problem.  Suppose you're talking about the set of numbers called Z3 (should be written with the outline font and subscript).  Then 2x2=1.  If you're in Z4, then 2x2=0. 

"But," you say, "we were assuming I was talking about the integers."

That's a fair assumption--but then, so is assuming you're in base 10 unless otherwise noted.  Besides, the answer (in your problem) is "4" no matter what.  You're just writing 4 in different ways.

Simon Moon
Saturday, March 05, 2005

It coulb a horrible question, but I disagree with some of your arguments.

Yes, we are assuming the numbers are integer - it is quite a natural (literally) assumption, isn't it? And subsequent assumption - that the base is 10 - is also natural, as you correctly noted.

To tell the person that I expect something beyond 2x2=4 I added the following line: "I will accept only complete answers".  I believe it is enough of a hint for a candidate for a programming role to start thinking about the different cases when the answer can be not only 4. And it is quite natural for a prgrammer to think about the bases, isn't it?

And, also, while the answer is indeed always four, I ask to write the answer. With different bases the written form of four will look different. To find how means to answer the question correctly (possibly asking additional question in the process, it is always OK).

Dmitri Papichev
Saturday, March 05, 2005

I think that this is a horrible technical interview question too.  Almost any answer will be justifiable making the right assumptions.

I would say 2x2 = A wooden plank.

Tapori
Wednesday, March 09, 2005

I'm outnumbered 2 to 1 :)

Dmitri Papichev
Wednesday, March 09, 2005

Or should I say "10 to 1"? :)

Dmitri Papichev
Thursday, March 10, 2005

Yeah, if you pulled a question like this, that had nothing to do with anything really, I'd think you were trying to be a smarty-pants, and seriously reconsider whether I wanted to work with someone who was so full of his own knowledge.

I'm not trying to be mean, but that's what I'd think.

I think someone that has a secret agenda; someone that's hiding something; someone that won't tell me everything they know, especially when they know I need to know it; someone who confuses "withholding knowledge" for "having power" is not anyone I'd like to work for.

That being said, I'd probably just say "4", then wait for the interview to be over.

Risser
Thursday, March 31, 2005

I think some of you guys are way too serious.
Come on, this is just fun :)

OK, let me be honest: I would probably not ask that question at the job interview - as almost any other  question from that great site. These questions are just for having fun for quite a narrow circle of people.

I have much more serious approach for real job interviews. There is usually no time for this kind of games there.

Dmitri Papichev
Thursday, March 31, 2005

*  Recent Topics

*  Fog Creek Home