Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

OK, I feel stupid asking this - but in Jeff's article: Getting the Interview Phone Screen Right and originally stated in the 5 essential phone screen questions:

They shouldn't stare blankly at you when you ask with 2^16 is. It's a special number. They should know it.

I've been a developer\software engineer\code monkey\whatever for a little while now, and I don't think I've ever come across this. I mean, I can certainly count binary values do basic operations on them, etc, etc. But I don't see what is "special" about this value.

share|improve this question
6  
It's a power of 2? :) –  Michael K Feb 1 '11 at 17:56
1  
@Michael 2^16.1 is also a power of 2, but nothing special. Same for 2^0. –  rightfold Feb 1 '11 at 19:21
3  
@Radek: 2**0 is 1, which is in fact a very special number ;) But yes, we're generally only concerned with powers of two where the exponent is a positive integer. –  delnan Feb 1 '11 at 19:38
1  
Well, why is 10^3 or 10^6 a special number? –  user1249 Feb 1 '11 at 22:14
2  
Is this an interview question from the 90s? 16 bits were special back then –  Chris S Feb 1 '11 at 23:11
show 3 more comments

3 Answers

up vote 47 down vote accepted

(2^16 -1) or 65535 or 0xFFFF is the maximum value of 2 bytes. For a long time CPUs used 16-bit architecture and OSes were likewise based on 16-bit operations. There were 16-bit commands and 16-bit memory addresses. A lot of systems/compilers still use 16 bits for integers.

So, (2^16 -1) is special because it is the largest number that a 16-bit (unsigned) integer can hold and the largest memory address that a 16-bit architecture can access.

share|improve this answer
11  
FYI, it's also the number of rows in an Excel spreadsheet :) –  Travis Christian Feb 1 '11 at 17:55
2  
Is that still the limit? –  JeffO Feb 1 '11 at 18:02
1  
@Jeff, Travis: No, I've heard that Excel 2007 increased the limit. –  FrustratedWithFormsDesigner Feb 1 '11 at 18:10
5  
I stand corrected. Maybe it's been a while since I scrolled all the way down. –  Travis Christian Feb 1 '11 at 18:12
    
@Travis: Last sentence has an off-by-one error; 2^16 requires 17 bits. –  PSU Feb 1 '11 at 18:18
show 5 more comments

The only reason I can see for regarding 216 as "special" is because it's one more than the highest integer you can store in a single register on a 16 bit operating system.

Similarly you could apply the same logic to 232 and 32 bit operating systems.

I'd need to know more context for the question before being able to say whether it was a significant piece of knowledge or not.

share|improve this answer
    
I swear I must have filtered out most of what you wrote. All I saw was 2^16 and highest integer. –  ChaosPandion Feb 1 '11 at 17:55
3  
This is inaccurate. It is perfectly possible to have a 32-bit (or higher) data type in a 16-bit operating system. A 16-bit integer is simply the largest value that can be stored in a single register on a 16-bit processor. –  Chinmay Kanchi Feb 1 '11 at 23:37
    
@Chinmay - point taken ;) –  ChrisF Feb 1 '11 at 23:38
add comment

From the full body from Steve Yegge's article,

Candidates should know what bits and bytes are. They should be able to count in binary; e.g. they should be able to tell you what 2^5 or 2^10 is, in decimal. They shouldn't stare blankly at you when you ask with 2^16 is. It's a special number. They should know it.

I was thrown off from the bit you quoted in the question; it sounded like a candidate should be able to describe it's significance, but in context he's saying that candidates should know, off the top of their head, what the decimal conversion of 216 is.

The significance of this is that since we humans still use decimal for counting, especially in our heads (in most circumstances), we need to know the rough capacities of the common byte blocks that we use for storage, memory, or even character encoding. Since a byte is 8 bits, the most common are 8, 16, 24, 32, and 64.

At the present time I would say 232 is the most commonly occurring capacity a developer deals with. I am suspicious of developers who don't know that 232 is roughly 4 billion (max value of ~2 billion if signed), since it means they've never bothered to find out roughly how many records can be stored in their databases that use 32-bit ints for primary keys, or when old code using 32-bit ints for IDs, dates, etc. will need to be refactored to 64-bit.1

216 is the total capacity of the Java short. (Total numbers between -215 and 215-1)

A developer should know by heart what 8-bit is. Among the many common usages is ASCII character encoding.

I wouldn't expect a programmer to know 214 or 218 at all, but I would probably expect that they know 216 since it's a very commonly occurring number and short enough number (65536) to easily remember the full number.


1: If you browse the leaderboards of Call of Duty: MW2 or iPhone Game Center you'll often see cheaters at the top with high score values of 2,147,483,647, which is 231-1, the max value of a signed 232 integer.

share|improve this answer
11  
A good thing to remember is that 2^10 is about one thousand, and from there you get 2^20 is a million, and 2^30 a billion and so on. And with help of this it's somewhat easy to "see" that 2^14 is sixteen million, so you can quickly do mental conversions between binary and decimal. And 2^64 is 16 * 10^18, which is hmm... 16 billion billions :) –  Maglob Feb 1 '11 at 18:38
    
@Maglob, thanks, good point. It's worth noting how you arrived at 2^64, since it took me a minute. 1000 is 10^3 which is roughly 2^10. 64 is 4 and 60. 60/10 is 6, 6 * 3 is 18, so you get: 10^18 * (2^4 or 16) ... –  NickC Feb 1 '11 at 18:45
1  
Uuh. I made a typo above (and somehow can't edit it) 2^14 is of course sixteen thousand, not million. (I guess it was not that easy to "see" after all :) –  Maglob Feb 2 '11 at 11:39
    
+1 Good answer, because a more complete context is that you are looking for the person being able to think, and in particular to have knowledge of the context and domain. –  quickly_now Apr 23 '13 at 6:49
1  
Um, ASCII is 7-bit.. ;-) –  Brendan Jul 20 '13 at 9:46
add comment

protected by ChrisF Apr 23 '13 at 7:58

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.