Testing Java Candidates - Part I

  • Posted on: 4 January 2016
  • By: rob

Certus Technology is a software business and we employ software developers, mainly coding in Java and Groovy. Our recruitment process may not be perfect, but one thing we do is give candidates a simple test in Java programming to help us filter them. The test comprises 11 questions and we give candidates about 20 minutes to provide their answers. Candidates get 1 mark for a good answer, 1/2 a mark for a weak answer and 0 for an incorrect answer. We discuss the answers with the candidate after they have worked through the test and consider their responses when marking the test. The candidates are not shown their final results.
Several interesting findings have come out of this procedure, which we have been running for about 15 years and given to at least 50 candidates. Overall scores range from 0.5 to 11, and we generally consider a candidate to be worthy of further consideration if they score 8 or above. In this post, I will discuss question one, which is surprisingly simple and gives a very good predictor for the final overall score. It is tempting to reduce the test to this single question.

Question 1. Complete the body of the following method.

public boolean isZero(int i) {



}

Before you snigger at the simplicity of this question and scroll down, take a moment to consider what your answer would be.


.
.
.
.
.
.
.
.

We have found nearly everyone can give some sort of answer to this question and the answers fall into 3 classes.

Type 1. Wrong

public boolean isZero(int i) {
  System.out.println(i);
}

People who give this type of answer must have some knowledge of Java, but quite what they are thinking, I am not sure. They have failed to understand the question in front of them, or give a working solution. 0 marks for this question and a predicted overall score of less than 2.

Type 2. Correct, but naive.

public boolean isZero(int i) {
  if (i == 0) {
    return true;
  } else {
    return false;
  }
}

This answer does work and demonstrates some knowledge of Java and the ability to read a question and provide working code. The code is over-complex though and shows that the candidate has not really much real experience of coding. 1/2 a mark here, and we can now expect the candidate to get an overall score of around 5.

Type 3. Correct

public boolean isZero(int i) {
  return i == 0;
}

This is the answer we are looking for. 1 mark here, and we can now expect the candidate to get an overall score of at least 7 and we may well consider them for a second interview.