The interview question that stumped 30% of Senior Software Engineers

A few years ago, I had the opportunity to interview people for a Senior Software Engineer role.

I was dead keen to do this as I take an interest in how to interview programmers.

Amongst the questions I asked, there was one that stumped 3 of the 9 candidates. Another 3 really struggled, and the last 3 did it easily.

Here is the question:

In the language of your choice, write some code that cycles through the numbers 1 to 100 and prints out every 5th number.

There you have it. That’s it. The 3 that failed the question didn’t even put pen to paper. They had no idea. They were completely stumped. Didn’t even write code to cycle through the numbers 1 to 100.

(For those of you non programmers reading this post, looping through a bunch of numbers is one of the first things you learn to do, ever).

# Print the numbers 1 to 100
# range() is always <= the num in the argument so you need to add 1

for i in range(101):

Now these people weren’t juniors, they were applying for a Senior Software Engineer role. And they had all worked in a role with that title before.

In my humble opinion code like this is pretty much the absolute minimum a interviewer would expect, even taking into account the stress of an interview, the unfamiliar coding environment etc.

So what was the problem? After a bit of digging it seems most of them rarely wrote custom code. They were handy with key frameworks but they spent most of their time on configuration management.

Configuration Management is a desirable skillset but this was a programming job.

Needless to say the interviews were short.

Oh, and if you are applying for a Python programming gig, don’t write your interview code in JavaScript!

Here is a satisfactory answer (you could argue that I’m over the top using the f-string – but it is intentional):

# range() is always <= the num in the argument so you need to add 1
for n in range(101):
     if n%5 == 0:

Leave a Reply