So I used to have this trick question I’d ask near the end of an interview, if I thought people could handle it (eg: they would know, at least, that a hash table was a programming concept). I would simply ask, “How would you go about sorting a hash table?”

The correct answer is to be confused by the question, and ask something along the lines of “Do you mean sort the keys, or sort the values, or something else entirely?”

Based on some recent things happening, I think a better way would be:

“How would you access the fourth item of a hash table?”

It’s the same concept – that hashes are not ordered in any way – but it’s something that yields a better answer both if you do or do not know the answer. Simply put, “You can’t, that makes no sense, I don’t want to work here if you think that’s possible” if you know what a hash table is, or something stupid if you’ve used them and don’t understand them:

@keys = keys(%hash)
print $hash{$keys[3]} // zero indexed; I’m a computer programmer

Even better is you could say something like “are you sure that is right?” and then get this:

@keys = keys(%hash);
if (@keys > 3)
print $hash{$keys[3]}; // zero indexed; I’m a computer programmer
print “Define some more variables!”;

Which is even better.