JOB REFERRALS
    ON THIS PAGE
    ARCHIVES
    CATEGORIES
    BLOGROLL
    LINKS
    SEARCH
    MY BOOKS
    DISCLAIMER
 
 Saturday, March 11, 2006
Sample programmers' quiz

While training last week, the group I was training asked for some help in interviewing candidates for some openings. I came up with the following, and thought I'd post it in the interests of giving teams looking to hire some new folks. This was created specifically to find candidates with 2-3 years' experience with some familiarity with web applications.

  • What was the most interesting computer/technical book you read last year? Why?
  • What was the last new programming language you learned?
  • How do you convince a customer that what they want is wrong?
  • Describe the last elegant hack you wrote. Why, where, how, when, ...?
  • Write a servlet that prints all parameters and HTTP headers to the browser. Build an Ant script that compiles, and creates the appropriate .war file for deployment into Tomcat.
  • Name all of the verbs in the HTTP/1.1 specification.
  • Given a tag library, "utilitytags.jar" which is described by the tag library descriptor file "utilitytags.tld", please write a JSP that uses the "foobar" tag from that library.
  • What keyword in Java do we use to grant package-level access to class members?
  • When do you think you should use an abstract base class as opposed to using an interface?
  • How do I protect code in a multithreaded environment from being executed by more than one thread at a time?
  • Please fill in the necessary code to return the contents of the "last name" column using the following SQL statement; make all necessary changes so that this code will compile:
    public void printUsers(Connection conn)
    {
      String sql = "SELECT last_name FROM users WHERE first_name = 'Sean'";
      ...
    }
    
  • What is a design pattern? Please describe three patterns that you have used and why you used them and what the consequences of using them were, both good and bad.
More suggestions, questions, and comments welcome. Note that some of the questions are deliberate traps, some of them are deliberately open-ended in order to encourage discussion and opportunities to flesh out what's on the resume, and some of them are intended not to hear the answers but to watch the candidates' reaction. (Yeah, I'm a hard interviewer. :-) )


Update: A couple of commenters have pointed out that a few of the questions are answered by simply looking up stuff (in the HTTP specification, for example). Two answers come to mind why I want people to know this without having to look it up--one, sometimes I want to pitch a slowball just to see how they'll react and answer, and two, if they can answer the question without having to look it up, it means they know the spec, which is a far, far different thing than being able to look something up.


Java/J2EE

Saturday, March 11, 2006 10:27:20 PM (Pacific Standard Time, UTC-07:00)
Comments [6]  |  Related posts:
Explorations into "M"
REST != HTTP
Winter Travels: Øredev, DevTeach, DeVoxx
The ServerSide Java Symposium 2009: Call for Abstracts and/or Suggestions
Windows 7 + VMWare 6/VMWare Fusion 2
Thoughts of a PDC (2008) Gone By...
Tracked by:
"Programmer's Quiz" (Stefan Tilkov's Random Stuff) [Trackback]
"Programming ineptitude" (Steve: Developing on the Edge) [Trackback]
"entry..." (r) [Trackback]
"buy bupropion" (online) [Trackback]
"robots cheap airfares flights travel" (robots cheap flights airline) [Trackback]
"cheap levaquin" (side effects prescription drug levaquin) [Trackback]
"alcohol and zoloft" (zoloft) [Trackback]
"dictonary" (online) [Trackback]
"cindy lauper" (online) [Trackback]
"rv parks" (online) [Trackback]
"composite decking" (online) [Trackback]
"nissian" (online) [Trackback]
Sunday, March 12, 2006 7:27:45 AM (Pacific Daylight Time, UTC-07:00)
Some good interview questions there. Design-type questions are particularly good, especially since this is something I find lacking in many candidates. However I simply don't understand why "regurgitate"-type questions should ever be asked in an interview. I particularly have issues with:

- Write a servlet that prints all parameters and HTTP headers to the browser.

Look up the servlet Javadoc! Printing them is something I never need to do in my professional work, so why is there a need to remember how to do this offhand?

- Name all of the verbs in the HTTP/1.1 specification.

http://www.google.co.uk/search?hl=en&q=%22HTTP+specification%22&btnG=Google+Search

Questions like these are like asking "name all the static methods in the so-and-so class". What's the point when the answer is figuratively in your fingertips? Unless of course the answer you expect is for me to tell you how I'd quickly and easily find out...?
Jack Ashburn
Sunday, March 12, 2006 9:22:31 AM (Pacific Daylight Time, UTC-07:00)
Another couple questions I always love to ask:

* What is the difference between a Hashtable and a HashMap?
- looking for an understanding between the different collections classes, particularly in regard to synchronization

* Do Java methods pass objects by reference or value?

* What is the difference between a Statement, a PreparedStatement, and a CallableStatement in JDBC?

I too try to avoid the "name all the methods on class X" questions - I can never remember them myself, and rely on auto-complete in the IDE way too much ;)
Sunday, March 12, 2006 11:45:17 AM (Pacific Daylight Time, UTC-07:00)
I agree with the Jeff and Jack about the "regurguitate" type questions in an interview. I've found that the people that can "regurguitate" stuff are piss-poor programmers. They've learned to memorize common solutions for the interview. But book examples like this are rarely what we need. When the project steps outside the realm basic samples, they are lost.

I think a better solution is ask people explain this stuff in a psuedo code or rough ideas. I want see thier problem solving skills. For example, I could care less if they know the syntax of the war or jar task. I would be more interested in why the choose to use the jar task over the war target. They can lookup or learn the sytax. Much harder to teach and grow the design skills.

I like to ask people about unit tests. I want people that value testing their code. I want to hear why the use it. Why they like. What it does for them. If they don't like unit testing, I want to know why.

Lastly, I try get the person to tell me why they are looking for a new job. The way a canidate talks about a previous or current employeer is very telling. I'm surprised by people that go on a long rant about how stupid their current boss or company is. If they aren't smart enough to have a positive reason for lookng for a job, then they aren't smart enough work for me.


Monday, March 13, 2006 5:54:23 AM (Pacific Daylight Time, UTC-07:00)
Re "name all the HTTP/1.1 verbs", which HTTP/1.1? The difference specs defines different verbs. e.g. RFC 2068 also defines, as adjunct methods, PATCH, LINK, and UNLINK, which aren't defined in 2616.
Monday, March 13, 2006 10:56:59 AM (Pacific Daylight Time, UTC-07:00)
Ted,

I mostly like this quiz, depending on how the results are interpreted, of course. I would do pretty poorly on some of the regurgitation questions, but well on others.

I like the question about the last programming language learned; I would follow up with "What prompted you to learn it?" and "What approach did you take to learning it?"

Finally, what I really see missing is things that show critical thinking and skepticism. I'm fond of asking "What's your favorite {language,platform,tool,etc}" and then following that with "OK ... now tell me the things you hate about it, and why you wish they were different."
Saturday, April 22, 2006 4:21:53 PM (Pacific Daylight Time, UTC-07:00)
One of my favorite Java interview questions (actually three questions...): when you override the equals() method, there is another method you need to override. What method is that? What behavior should it have? Why?
Comments are closed.