The No-BS Guide to the Developer Interview
With information gathered from well-known software engineers, this guide will prepare you for most developer interviews.
Join the DZone community and get the full member experience.Join For Free
update: for companies hiring developers, *this* is how you should write developer job postings and conduct interviews. the content below is for developers to prepare themselves for most scenarios, but not all of them are the ways that companies *should* be conducting interviews.
there's a dirty little secret about all those "interview questions and answers" articles on various programming topics that so many inexperienced developers search for. they're almost all trivia style questions .
they're not questions to test how you think. they merely test memorization skills. articles about interview questions are actually more like study sheets used for getting up to speed with a topic for the first time, not something you should be scrambling to learn before an interview.
that's because in most real interviews, you won't be able to accurately predict and answer all of your questions just by reading articles online. the worst thing about interview question and answer articles is that they imply that you can succeed in your interview with a static knowledge approach. but what every programmer really needs to succeed is an adaptive, creative approach to problems they encounter, built on a solid foundation of programming concepts.
if you do get a series of trivia questions in your interview—for example, maybe they ask for a bunch of definitions like you would see in a standardized test—then the person interviewing you may not be a developer, and you'll want to find out if you can talk to one so you can better understand what the position will be like, because those kinds of questions might indicate that the organization doesn't have good hiring practices, or that they may not have good development practices. find out, because if you ask any veteran of the developer community the same questions you find in those interview question and answer articles, they'll think it's a joke.
this article is an attempt to undo some of the damage done by the majority of "interview questions and answers" posts aimed at various types of programmers. it's going to show you where you might need to develop your fundamental programming skills so you can reliably apply to any programming job, because you'll be able to get up to speed quickly regardless of what technology stack the company uses. you won't just be a ruby developer or a java developer, you'll be a developer.
the programming interview
if you are interviewing for any programming position, you're going to need to show that your fundamentals are solid. most companies can work with that, even if you don't have all the specific skills they want right now. companies that are good at doing developer interviews will screen for programming fundamentals right off the bat, and they'll do it with online tests and streamlined phone screens—two interview methods that won't waste a lot of their time—so that they can quickly see if you can actually program.
by compiling the interview techniques discussed by steve yegge , chris sells , , and jeff atwood , this article gives you a framework that will prepare you for the practices generally found in software industry interviews. you may encounter some differences, and most interviews probably won't include all of these steps, but if you do some practice in each area, you won't be surprised by anything.
let's start by talking about you. can you learn new technologies quickly? do you enjoy challenging problems? have you ever pushed technologies beyond their limits because it seemed like it would be a fun experiment? if you honestly answered yes to some of these questions, then you've probably got what it takes to be a good developer. now the only thing left to do is prove it. for that, you need a portfolio—a collection of code projects, an online presence, and a brand as a developer.
side note : not all developers need a portfolio. they're mostly useful for junior level candidates, people who have been with one company and one technology for a long tenure, or people with few demonstrable or individual accomplishments.
i know this was supposed to be about interviews, and the portfolio isn't technically part of the interview, but many companies will want to see code and content you've already written and use it as an unbiased way to form a first impression of you. half the battle of getting hired is simply coding every day and exhibiting those traits mentioned above in a publicly visible way.
every developer needs to know how to market themselves . here are some of the primary methods you want to use:
an open source code repository
a stack overflow profile
the open source code repo (e.g. your github page) is the most crucial piece. nobody will know if you've coded something great if it's not out there on the web for everyone to find. put your stuff out there, even if it's something small or silly that you made for fun. usually, the people hiring you won't care about what the code is for, but whether you are excited about what you worked on and can talk passionately about it. it also doesn't hurt if the code shows that you have worked on something relevant to their business. so showcase all your best code, even if it's not perfect (always go back and refactor if you can though). if you have code that you can't put online for some reason, then make sure it's all well-organized in a ready-to-send zip file.
a blog is another major tool in your career advancement arsenal. you can fake your knowledge in topics sometimes by memorizing a few interview questions, but you can't fake a blog. it showcases your development skills, personality, and engagement with the wider programming community. it's also an opportunity to advertise (and improve) your writing and communication skills, which can sometimes be a key factor in whether you're hired during a close race with other candidates.
it doesn't matter if barely anyone reads it. as long as you try to submit it to some link sites and share it on social media, you'll get a few views. you just want your blog to convey that you're interested in various development topics and that you have a passion for the space and sharing knowledge. one thing to remember is that that having a blog that hasn't been updated in many months can be a detriment to your perceived value, because it might imply that you let tasks fall to the wayside when you get busy. to combat that tendency, just remember to have fun and write about multiple topics that interest you, not just programming. try not to let blogging feel like work.
networking with other professionals in your industry is almost always the best method for getting interview opportunities. very often it's much better to get an interview through the backdoor . many job openings (maybe a majority of them) never get posted. they're filled by people who current employees have already met and chatted with. in fact, if a job is already posted, your likelihood of getting it goes way down because now you're competing against a much bigger group.
luckily, networking for developers is easy. there are countless user groups and meetups around the world on various sub-topics within the development industry. find several that might be useful and go talk to people. make friends, get their contact info, and get back in touch once in a while. talk to them about the interesting code you're working on. email bloggers that you like and connect with them on linkedin. if you keep building relationships in the industry—online and in-person—eventually someone will notice your work and help you get an interview.
your social media
twitter is one of the best ways to connect to the developer community. as long as you're not rude or offensive, you should be able to show your honest personality on twitter and your passion for programming topics and news. use twitter to network and have interesting conversations about coding. try tweeting at your programming idols once in a while too. unlike mainstream celebrities, they might actually respond. there are a lot of ways you can use social media sites to improve your online footprint and brand.
stack overflow is the one website you absolutely need to be on (and you probably know this and have already used it if you've ever run into a tough problem programming). but don't just consume help, make some time in your schedule every once in a while to find some questions to answer. not just so you can improve your karma, but so you can very clearly show potential companies what kind of communicator and problem solver you are in real-word situations. stack overflow can also be a valuable place for networking in the developer community.
all of these pieces of your portfolio are important, but the main thing you want to try to do with all of them is build a public narrative of yourself. in all of these channels you should convey yourself as a person who keeps up with changes and conversations in the industry, takes on challenges, and can teach others. a good technical interviewer knows that it's more important to find out if a candidate can pick up new technologies over time, rather than simply having a candidate who's resting on the laurels of knowing their current technologies well. so use these channels to show that you've put in the effort to gain a deep understanding of various technologies, because that shows potential employers that you can probably do this again with a new technology at their company.
i wanted to add one last footnote to the portfolio section to address resumes, even though they can often seem like a pointless exercise in the hiring process. it's true that showing somebody that you've done something is much more compelling than simply saying you did it, but many companies need the resume just to filter out people who don't even claim to have the skills for the job (unfortunately, this can mean that you have to cook up some keyword soup). for this section i'll just leave you with some links to helpful resources that should help you build an effective and relevant developer resume.
how i read a technical resume - dave fecak
why technical resumes need a profile - dave fecak
ten tips for a (slightly) less awful resume - steve yegge
how hr reads your resume vs. a developer [humorous, but with kernels of truth]
now onto preparations for the interview. like any skill, interviews are won in the wee hours of the nights that you spend working on becoming a better programmer. they're won in the meetups, blog posts, and other activities that you do to improve your communication and writing skills. so basically, if your interview is tomorrow and you haven't been working hard for several months nurturing these fundamental skills, no amount of interview practice is going to save you.
with that being said, it can help an awful lot if you know the types of questions you'll be encountering in an interview. you shouldn't feel like you need to go memorize answers. instead, you should be looking up exercises to help you brush up on the fundamentals you already have. you need to be able to adapt to questions and know the answers because you've actually coded things that taught you about the underlying principles of a question. memorizing answers without having any real experience with the underlying principles won't get you the job, and even if it did, would you really be able to do it?
these next few sections will be helpful at laying out the general types of questions you're likely to get in a programming interview. while some of these sections won't be a part of every interview (some might be fairly rare, in fact), knowing about each one will prepare you for most developer interviews.
online pre-screen test
this portion is not as common as the phone screen, but if you encounter one, just know that it's basically a pre-screen to see if you make it to the phone screen. some companies can't spare enough people to do a large amount of phone screens, so they use an automated online test to prove whether or not you have the basic knowledge requirements. this is important because a surprising number of applicants have some major holes in their fundamental knowledge of programming. the tests should feel simple to you, and if they don't, the requirements for the job might be too high for you right now. most of the time this is just a sanity check to see if you know basic programming.
you can go see what these online tests might look like by trying a free trial test from one of these companies that actually offer these online pre-screen tests as a service. interview zen and codility are two examples.
phone screen and in-person technical interview
some companies will have you do a phone screen before they commit more time to an in-person interview. while the phone screen could potentially include any level of question difficulty, most are focused on fundamentals and understanding your thought process. interviewers are not looking for the perfect answer. as you already know, many times in programming there is no one correct answer, only different options with different trade-offs.
if you run into a question that you don't know the answer to, don't worry. first off, part of reason why interviewers ask tough questions is to see if you can handle them calmly and logically without getting lost or breaking down. they also just want to see that you have a solid thought process that indicates experience with solving difficult programming problems. here's a good template for how you can answer questions you don't know the answer to:
"i don't know how to do that, but if i ran into that problem in a project, here's how i'd go about figuring out how to make it work..."
-- mason wheeler
you've now turned it into a question that you can answer. because (again, you probably already know this but…) programming is a constant struggle with questions you don't know the answers to. you should also read alan skorkin's how to answer a programming interview question and look good doing it .
5 common coding questions in an interview
there are about five areas that steve yegge believes are essential to address in a phone screen (but these could also come in the technical interview). here they are:
1. write some code
you'll want to show that you can write code with correct syntax to make a simple program. some of the common tests include:
a function to reverse a string
a function to compute nth fibonacci number
a function that prints the grade-school multiplication table up to 12x12
a function that sums up integers from a text file, one int per line
a function to find the largest integer value in an integer array
a function that formats an rgb value (three 1-byte numbers) as a 6-digit hexadecimal string
you'll want to be sure that you can handle concepts like recursion and do simple file i/o. you can test yourself on all of these exercises and a bunch more at hackerrank.com .
2. model an application
this is something you can practice with just a piece of paper and a pencil. if you're modeling the design of a hypothetical application in-person, you should probably request a whiteboard or piece of paper if they have it. object-oriented design is the go-to style you'll want to use here, unless the job specifically requires something else. here are some tests that yegge suggests :
design a deck of cards that can be used for different card game applications.
model the animal kingdom as a class system, for use in a virtual zoo program.
create a class design to represent a filesystem.
design an oo representation to model html.
these are a little more difficult than the basic coding question examples we just looked at, but usually the interviewers won't be looking for comprehensive, low-level oo design. this is just an exercise to show that you have a strong grasp of basic oo principles, and there are plenty of resources out there to help you practice problems like these as well.
brett schuchert's monopoly
bob martin's bowling game kata
jeff bay's object calisthenics
3. solve scripting and regex problems
you should have some experience building applications that use scripting and regex. here's another specific problem that steve yegge used (and apparently 25%-35% of candidates can't solve the problem):
last year my team had to remove all the phone numbers from 50,000 amazon web page templates, since many of the numbers were no longer in service, and we also wanted to route all customer contacts through a single page.
let's say you're on my team, and we have to identify the pages having probable u.s. phone numbers in them. to simplify the problem slightly, assume we have 50,000 html files in a unix directory tree, under a directory called "/website". we have 2 days to get a list of file paths to the editorial staff. you need to give me a list of the .html files in this directory tree that appear to contain phone numbers in the following two formats: (xxx) xxx-xxxx and xxx-xxx-xxxx.
how would you solve this problem? keep in mind our team is on a short (2-day) timeline.
this question might be considered a trap question, but it brings up a good point to remember: interviewers don't want you to reinvent the wheel in your interview. if there's a tool or command out there (in this case, "grep" was a perfectly reasonable answer), say in your answer that you would use a particular tool. don't feel like you have to know how to translate anything into regex. we all use tools for that. if interviewers say that you can't use certain tools for the purposes of the question, then they're just trying to see if you understand how some software or process works under the hood.
4. know your data structures and algorithms
you can't get very far in programming without knowing your data structures, and you won't write very good code if you don't understand the intimate relationship between data structures and algorithms. yegge's suggestions offer more detail, but you'll need to know at least the basics of these data structures:
arrays - structures with a fixed number of contiguous elements, each accessed by a separate index.
vectors - like arrays (and backed by arrays), but can increase or decrease the number of elements as needed.
linked lists - sets of boxes with two compartments each: one containing data, the other containing a pointer (or rather a generic reference) to the next item in the list.
hashtables - maps of keys to values (picture a table with two columns), with collision handling (in case the function that outputs a value given a key outputs the same value for more than one key).
graphs - sets of things (called "nodes") connected to other things (called "edges"), sometimes restricted in specific ways (e.g. nodes and edges can be ordered, typed, named, etc.).
trees - graphs whose nodes are related to one another only as parent to child or vice versa (e.g. one node can't contain a pointer to the child of its parent's parent that isn't also its own parent).
you need to at least know about these six data structures. obviously there are more, and it's great if you know about those too. an awesome way to learn these if you're a visual learner, is to go to visuaalgo , a site that visualizes a ton of data structures and algoritms through animations.
for each of these data structures you should know how to use them in real world examples, how to iterate over each one's elements, and why you would choose one structure over another in a given scenario. this is where some knowledge of big-o performance for each data structure's operations (know what operations each one has too) could come in handy. big-o notation is just a way of representing how many operations an algorithm performs given an input of a particular size. there are books and wikis that can help you brush up on this.
5. know how to count like a computer
you don't want to be running into integer-overflow errors all the time or not know how to decode serialized objects, so you need to know what bits and bytes are and how to count in binary. let's look at steve yegge's example questions one more time:
explain how to test whether the high-order bit is set in a byte.
write a function to count all the bits in an int value; e.g. the function with the signature int countbits(int x)
describe a function that takes an int value, and returns true if the bit pattern of that int value is the same if you reverse it (i.e. it's a palindrome); i.e. boolean ispalindrome(int x)
some things you might want to brush up on to be stronger in this area include:
being able to count in hexadecimal and convert between binary, octal, and hex representations of a number.
knowing the fundamentals of and, or, not and xor (e.g. what's the difference between a bitwise-and and a logical-and?)
understanding why 2^16 is a special number
being able to estimate the probable sizes of the primitive data types for a standard 32-bit (e.g. intel) architecture
some of these concepts will be more important in some jobs than others, but it never hurts to be prepared, and knowing these things can set you apart from any candidate that doesn't. it will be harder to get caught up on some of these topics if you haven't studied computer science, but the resources and online courses are certainly out there to get yourself up to speed.
brain teaser questions are now being shunned by the bastions of the software industry. even google, the company that was well known for it's impossible puzzlers a few years ago, has moved away from the practice .
“brain teasers are a complete waste of time. how many golf balls can you fit into an airplane? how many gas stations in manhattan? a complete waste of time. they don’t predict anything. they serve primarily to make the interviewer feel smart. … results matter, riddles don't."
-- laszlo bock, the sr. vp of hr for google
but unfortunately, some segments of the industry are lagging behind and have yet to expunge this tool from their hiring practices. the only value in these questions is just to see how you handle a difficult (often unsolvable) problem. these are not coding questions. they're crazy, high-level questions like, "what method would you use to move mt. fuji?" the best strategy is to just try to be creative and handle the question as logically as possible. the interviewer just wants to see how you think, and maybe they're hoping you'll come up with something exciting and innovative (which is kind of a stupid thing to expect). you can prep for these if you want by checking out some of google's old questions .
always approach problems from a logical angle.
ask questions to solidify vague requirements.
properly use any features available to solve a problem (if there's a whiteboard, use it!).
point out any shortcuts or limitations of the medium you're using to accomplish a task in the interview.
understand the "why" behind your answers as well as the "how" and be able to explain each clearly.
aside from coding questions, you'll also encounter anecdotal questions. basically these are questions where, rather than being asked 'what would you do in this situation?" you're usually asked to describe what you did do in a certain situation. so before the interview, you'll want to take note of some notable situations in your career (both positive and negative) and determine how you'll retell that story while emphasizing the important themes. be ready to have a back-and-forth discussion about these questions and explain how certain strategies worked, what you learned from the experience, and how you might do something differently next time.
if you haven't encountered a situation like the one they describe, ask questions to get more details and then explain what you would do and why. these questions are mostly designed to see how you handle work situations like deadlines, conflicts, and interactions. it's usually not about code but how you handle yourself as a professional and whether or not you would be a good cultural fit with the team and the company as a whole. more on that in the next section.
cultural/team fit interview
in most cases, you'll be working with a group at your prospective company. they're going to want to know what kind of personality you have, how you communicate, and how you handle difficult situations. many of these questions will be anecdotal style questions that try and discern how you actually handle various situations. try and predict some of the questions you might be asked relating to the specific work environment and organizational style of the company you are interviewing for. some general question examples from chris sells include:
what's the right process for gathering requirements?
how do you deal with vague requirements?
how do you convince someone that you've got a good idea?
what do you do when you can't convince them?
what happens if you're asked to do something you don't agree with?
(if you're interviewing at a startup) how do you like the idea of quick decisions, hard work on short deadlines, light process, and tight purse strings?
(if you're interviewing at an established company) how do you like the idea of getting buy-in with a set of stakeholders, making sure we don't ship anything until it's done, following an established process, and sticking to a budget?
what's more important: the customers or the business?
what kinds of activities are most important to you? do you like to be focused on your set of tasks or do you like to do a lot of different things?
what makes you as productive as you can be?
where do you see your career path taking you?
a really cool (and smart) company will actually take you out for dinner or drinks with the team to see if you generally get along with the team and are a generally nice person.
coding and presentation projects
instead of having you write some code to solve a generic, abstract programming problem, the main coding portion of an interview will usually require you to build a complete utility or module from scratch. sometimes these will be take-home projects or you'll do them at the interview. sometimes you'll be asked to pair program with another employee of the company. these "auditions" may even take an hour or two to complete, but the project will usually be fairly small.
a company that really knows how to hire programmers may even give you an actual unit of work from their product, and they'll pay you for your time (if they don't, you might want to reconsider joining the company).
one final interview scenario you might run into is a required presentation. jeff atwood has his own ideal interview strategy:
have the candidate give a 15 minute presentation on their area of expertise. i think this is a far better indicator of success than a traditional interview, because you'll quickly ascertain …
is this person passionate about what they are doing?
can they communicate effectively to a small group?
do they have a good handle on their area of expertise?
would your team enjoy working with this person?
while this ideal of jeff atwood's is rare in most developer interviews, you should appreciate the chance if you ever get to do one of these presentations and have fun with it. this is the type of pitch you'll have to give often in your career in order to suggest new technologies and directions for projects, so you can only improve your value by practicing for this interview scenario as well. the optimal way to practice would be to offer to give a presentation or lightning talk at one of your local user group meetups about a technology you think would help a lot of people in the group.
how to practice for interview questions
now that we've covered the most common developer interview stages, all that's left to do is to practice for it. there are so many great resources online that can help you do this. so many, in fact, that you'll probably never complete all of the puzzles and katas out there, but that shouldn't stop you from continuously sharpening your development skills with these coding challenges, even after you get the job.
github repos with interview question
started the trend, and now there are koans for just about every language and several other tools.
code challenges/practice questions
cracking the coding interview (6th ed.) by gayle laakmann mcdowell
job tips for geeks: the job search by dave fecak
more interview prep
good luck on your interviews! you're going to do great!
Opinions expressed by DZone contributors are their own.