views:

6889

answers:

15

I have been invited to do a second interview for a company recruiting for a software engineer. This interview will consist of a 45 minute programmatic test on a laptop followed by a whiteboard presentation on the solution. This position is Java/J2EE based so I'm assuming (hoping) the test will be implemented using Java.

Have you ever done anything like this? What was the nature of the problem you had to solve? What is a good way to prepare for this type of interview?

+4  A: 

In two different interviews I have been asked to write a function that will reverse a string.

Mark Ingram
A: 

Usually it's the Reverse, IsPalindrome or FizzBuzz simple little snippet.

Weirdly you get some graduates with good grades who can't actually do these - they're basically just a sanity check.

Keith
+8  A: 

Yes. Its usually something that doesn't take over an hour to complete - like a small account statement generator or a map navigator.
Just go in blind.. last minute mugging won't help with such tests. If you're in the habit of writing code, it should be a breeze. Once you have the solution, explaining it is a piece of cake. The intent of such programs is to get a general feel of your expertise/analytical/communication abilities - doesn't matter if you dont make the solution in the alloted time.. However it helps:)
Its a sign of a good company when they ask candidates to write code in interviews.

Best of luck.

Gishu
Actually, I'd say the best ones would be ones that take 50-100% longer than the time available. I don't want the developer struggling to finish - I want the developer to lay solid foundations and to be getting on the right road, not deploying loads of tricks and hacks to get just anything finished in time.
Unsliced
+1  A: 

There was one interview I went to where they gave me an 8 hour home assignment, to implement an order tracking system for a delivery firm. That was a bit over the top, another company hired me before I even had the time to start working on that assignment.

Microserf
+1  A: 

You probably dont have time, but if you could get hold of this book:

Programming Pearls by Jon Bentley

It has loads of common programming challenges and discusses how to solve them elegantly.

If i was setting a programming test, I would base it on something from that.

qui
+1  A: 

I have had to create a fully functional app in an interview - was the best interview I had done. They didn't expect anyone to finish just wanted to see how you approached the task and see some code.

I personally prefer real coding tasks to the multi-guess Brain Bench style tests that seem to be common place (here in the UK anyway).

To answer your question, usually these programming tasks are just to see if you can actually do what you say on your C.V. So if you can then you will be fine, if not....

KiwiBastard
A: 

As others have said the problem is something that can be finished in less than an hour. Doing that under pressure may not be possible. Having a working solution is nice but not critical. The more important aspect is the review of the solution. A good candidate can explain whats missing if the solution is incomplete. Bad candidates do not understand why their approach is wrong. At my current company we have seen both types.

A: 

Yes, I've done something like that.

However, all I can say is that you (probably) either know it or you don't. It's not going to be like a history test based on Chapter 1 in your textbook that you can study for.

If you're a guy who writes code, they're not going to give you something so complicated that it blows you away.

If you're not a guy who writes code, it's probably something you can't even get started on.

Either way, no need to sweat it.

Baltimark
+1  A: 

This question was posed prior to any technical interviews of any kind. The interview process after this simple problem was much more taxing on my skills, but they used this as a baseline to make sure I had an inkling of how to program, plus this simple problem can help you see if the candidate has any bad habits.

"Write a class in Java called Lister. Lister should have two methods: addInt() and printList(). addInt() should take an int as a parameter and add the int to a collection of some type. printList() should print out all the ints in the collection and it should sum all the ints in the collection and print out the summation to the standard output stream (the console). Assume that you are using JDK 1.4. You can use any classes and methods that are part of the standard Java API. Do not worry about thread safety. Be prepared to discuss your implementation decisions in a subsequent screening."

I was sent that in an email and given 30 minutes to submit (via email) my solution.

codeLes
So - were you given extra points for not overflowing the sum ?
nos
+8  A: 

Some that I've gotten:

  • reverse a string (very common)
  • primality test (+optimizations)
  • validate a binary tree
  • other network/graph problems (max/min path cost, etc)

Usually you are trying to get a person to verbalize their analysis of a problem in real time. Just having a working solution is not very interesting. You could use a pastebin service or screen sharing to do remote interview over the phone.

This can be really tough for some people though. Personally I do very poorly solving problems while being observed, all while having to explain my thinking in real time. So don't place much emphasis on speed, or correct solutions. Just make sure they are on the right track, and it's ok to give hints.

Oh, and for bonus points, whenever you get an answer, always ask... "do you think that can be optimized?"

Mark Renouf
I still don't understand what is the point of asking someone to reverse a string. You could Google that.I guess the only point would be if the position requires design of new language or some other API. Maybe.
ra170
It's designed to cause the interviewee to demonstrate their critical thinking skills. It's not usually important if the candidate is able solve the problem or not.
Mark Renouf
It is all about the critical thinking and how you get to what ever 'solution' you may have. In my opinion, when I have been to these things there is nothing that you can revise for them. What you should do is walk in with the confidence in the knowledge that you do have and show/apply that knowledge.If you are being interviewed way above you skill level, etc then there is the possibility that the job is not right for you or that the employer expects too much of the interviewee.Also bear in mind that I have done these types of test, not got to a solution and still got the job! ;)
Penfold
+7  A: 

One thing I would do (that I didn't when I had to do this) is make sure you ask questions when they give you the problem.

If you're given a vague problem spec by a client or a manager at work, the first thing you do is ask questions to make sure you know exactly what they want and this test should be no different.

As someone mentioned, it's not just a pure test on your ability to code. It's how you handle pressure, your ability to get the job done with a deadline and your communication skills.

For what it's worth, the problem I was asked was to take a CSV file and move the contents into a MySQL database in either Perl or PHP.

David McLaughlin
Yes. Nail it down so that you , and the interviewer, are definitely on the same page.
Rob Wells
+2  A: 

I heard of just such an example recently. Sit at a real developer's machine, with a known development environment (Visual Studio 2008 - it's for a C# role so that's not unreasonable), with a local instance of SQL Server Express (and Management Studio) also fired up.

A web browser was available and you were free to use it. Just think, leaving Stack Overflow in the recent history - that's got to be a good footprint for the forensics to find after you!

The candidate was sat down, with a single sheet with some vague specifications and given an hour. They weren't expected to finish, but they were expected to discuss what they did. It was a basic problem but one with enough haze to give the developer some space to work in.

I think this is a cracking idea - the machine was in the likely working environment (not in a meeting room) so you're also testing the user's ability to be productive in realistic background conditions.

If you're a solid, capable coder, this kind of example really gives you some headspace to show off your skills to a much higher degree than some paper-based noddy examples.

Unsliced
+1  A: 

Search for java interview questions online and you will get a lot of the problems. As mentioned in previous answers, those are problems can be done in a short time. Grad some of those, and try to implement in your box: company ususally looks for good enough solutions, so there is no need to target the best codes in the world, but the best codes (not only algorithms but also practices/styles) you can. They can tell your experiences by looking at the codes if they are good.

Try to get used to it: practice until you feel comfort.

You may also practice your presentation: the purpose of this interview is to tell how good you are at thinking at high level for solutions. They may discuss with you during this phase.

As a whole, the interview is to simulate your future working environment, if you get along well with the guys, and they like you, then you sure will get it. In an interview, it is not the best answer that sells you, it is the feeling you bring to the people that matters (of cuz if the code sucks, they won't have good feelings...).

Good luck!

Dr. Xray
+1  A: 

Yeah, I've had a few like this, though usually in other languages like C or C++ or C#. Generally they are simple problems like reverse a string, implement a Priority Queue from scratch, find in a B-tree, count the number of 1 bits in a byte in constant time, or testing for primality.

Programming Interviews Exposed has some good suggestions and is a handy reference, IME.

JB King
A: 

Following blog will have all the java interview questions and videos http://kamoor.com/javainterview

Rat
There's nothing there right now! By this logic, http://stackoverflow.com/questions/32107/practical-programming-test-in-interview has the answer to this question. (Oh, wait, mine actually has relevant data...)
Mike