MindFill - Brian Carroll's Blog

Do While (WhatYouKnow) < (WhatYouKnow + 1)

Should programmers be able to convert from decimal to binary?

When I'm interviewing candidates for a development position I typically write a number down and ask them to convert it from decimal to binary.  Of course this is a very minor factor in the interview, but I find it interesting to see their responses.  It amazes that onle one person out of the last twenty five or thirty candidates I've interviewed has been able to convert from decimal 45 to binary 00101101.  (He also proudly did the hex conversion to 2D without missing a beat.)  Most of these candidates have CS degrees and 5+ years of experience, but from the looks on their faces when asked this question, they either never learned or have forgotten one of the most fundamental concepts of computing. 

Not only is it fundamental, it's also a simple concept.  My 9 and 10 year old sons can do these conversions.  They can do all combinations of decimal/binary/hex conversions.  They think the binary system is the coolest because they can count to 1024 on their fingers.  Thankfully I waited until after they were 4 to teach them.  I could see it now...“Hi Sweetie....how old are you?“ and them showing a binary 4 on their fingers!

So, would the developers you work with be able to do these conversions (without a calculator) or would they go completely blank like my job candidates have been doing lately?

Comments

Eric Maino said:

At least when they reach the age of 36, 68, or 100 they can still use the 4 trick :-)
# June 5, 2004 2:06 AM

Mikhail Arkhipov (MSFT) said:

Actually, they also should be able to write *code* that converts decimal to binary. Next question: write code that converts decimal to any radix. Next question: modify it to convert number in one random radix to a number in another random radix within reasonable limits.
# June 5, 2004 2:34 AM

ben said:

you should of asked them to think about how they would code it, the long division algorithm is pretty intuitive
# June 5, 2004 2:36 AM

Stijn Gysemans said:

@ school we even learn how to write that algorithm in assembler :-)
# June 5, 2004 7:22 AM

denny said:

how bout this as a bonus answer:

45 do you want 45 in binary or the char values "4" and "5" in binary?

different problem with different answers....

thats the first thing I would ask given the question as I read it.
# June 5, 2004 10:16 AM

Drew said:

Depends on what they'll be coding. I'd bet that for most jobs, this isn't useful knowledge. Requiring nervous candidates to remember how to do it almost borders on hazing (like forcing hams to learn morse code).
I can't imagine having a CS degree (I do) and not being able to do the conversion quickly in my head (I did), though.
# June 5, 2004 3:56 PM

Greag said:

It proves how big a fool you are asking such a question!

You deserve a hit on head with a scientific calculater, not a programmer.

# September 18, 2007 8:03 AM

Tom said:

I'm pretty sure asking other questions will get you a better condidate.  Anybody with a CS degree should be able to think and leave the calculations to computers.

# October 15, 2007 11:40 AM

JonMorg said:

I completely agree that the programmer needs to know how to decode numbers into bin/hex/dec. The person is writing for computers. It is hazing only if he mocks the person for doing so. As part of an extensive candidate, yes, i agree it is a small part, but the basics are basics for a reason. Because everything builds from them

# March 30, 2008 3:24 PM

TURHIG said:

I hate binary and and having to convert it into decimal. It's annoying and really hard..

# February 22, 2009 3:32 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)