Interview filter question
Developers interview candidates every now and then. There are days when you need to interview 4 candidates, and finish your work too. Then there are times you go to work on a Saturday to support an interview drive. Whatever the case, it really pays to have a few filter questions that should tell you whether a candidate is full of gas or if they are worth their salt. These questions can be a real time saver. Here are 2 questions that many developers use.
1. Class hierarchy:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | class A { public void doSomething() { System.out.println("A"); } } class B extends A { @Override public void doSomething() { System.out.println("B"); } } |
Give a candidate a class hierarchy like the one above and ask them something like, ‘How should you instantiate these objects so the output is ‘A’ / ‘B”. The you can drill down and ask them about the different instantiation combination. Anyone that says B b = new A(); will instantiate, is out of here.
2. Name them:
This is my favorite. It has helped me filter a lot of candidates and has saved me so much time.
What is System, out and println in System.out.println()
There are many wrong answers that I have heard. Some one once said ‘System.out’ is a package. Another said ‘The entire thing is a method’. Now I do not expect a candidate to tell me out is a PrintStream object, but at the very least I would like them to identify that System is a class and println() is a method. Many candidates fail to do this. There are some with 6+ years of experience that get this wrong and some of them turn hostile when asked this question, saying they should not be expected to know the answer after spending so many years coding.
For candidates with a little more experience you can ask questions that test knowledge of Concurrent object modification and how they are related to Collections, questions about Threads etc. After developing a few of these ‘litmus test’ questions, I also found how not to ask questions.
- Avoid asking questions that may confuse the candidate. Be very clear and concise when asking the question.
- Do not ask trick questions. If the question is twisted, most candidates will get it wrong.
- Using design level questions to filter candidates can be hard. Two designs are almost never the same.
- If a candidate gets one of these questions wrong, do not assume immediately that they answered incorrectly. Sometimes when I reiterate a point or explain a question more clearly the candidate says ‘Ohh I thought you meant Y instead of X’.
It’s sad, but I probably would have failed even with 7 or 8 years of Java and 25-30 years of other languages. I would have gone right down the rabbit hole with the first question with follow-ups about the three types of quote marks used, “Do you want the slash printed too?”, …
For the second, I would have gone off about methods and classes (ok so far), name spaces, layers of abstraction, machine-independent representations of machine-specific resources and so on.
I think the pure simplicity of the questions would have convinced me that they were “trick” questions in some way. It probably says something about the interviews I have had or my reaction to them. Of course, face-to-face interviewing could iron out these misunderstandings quickly.
Thanks for the thoughtful post.
@David Clark
Thanks for leaving your thoughts. It is always great to hear what others think about interview questions and their styles.