Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

learning java



On Thu, 29 Apr 2004, Adam Russell wrote:
> Just curious, what sort of technical questions do you ask candidates for java positions? 

Ok, I'll get into this if people promise not to jump on every last 
question and say "What? You'd not hire me because of THAT?  You suck".
We gotta think big picture here, people.  I like to think of these 
questions as "poking stick" questions.  You poke aruond, and when you find 
what looks like a gap, you then have an avenue to pursue.

Also, of course there's no consistency.  I've seen places where you get a 
written exam.  We don't do that. I ask the questions I think are gonna 
give me the kind of reading I want.  The guys that come after me ask 
different questions.

Random sampling of questions...

* Can you tell me what constitutes a well-formed XML file?  (Since I got 
so much arugment over the 'triviality' of this question I changed it to 
drawing a bad XML file on paper and asking people to tell me why it is a 
bad XML file)

* When working with servlets, what's the difference between a redirect and 
a forward?  What is a servlet filter and how is it different from a 
servlet forward?

* Given a primitive such as an int or long, write some real code to count 
the number of bits that are set.  This is one of my favorite questions, 
because there are a variety of creative ways to go about it just from a 
problem solving perspective, and you can also talk about different ways to 
optimize it (for size/speed).  Sure, the problem as described is trivial, 
but it's a toy problem.  And if somebody says "Wow, that's dumb..." then 
I've already laerned more about their attitude than I need to know ;).
One of the best answers I ever got was somebody that told me three 
different ways to answer it, the pros and cons of each, and then chose 
one and wrote that.

* Reverse a singly-linked list.

* I have a list of several million strings, but I know that there are only 
about 100k unique ones.  I want to make myself a frequency table that 
tells me how often each string occurred.  Write me a data structure to do 
it.  Everybody makes a hashmap, which is fine, but most people end up 
creating several million Integer objects when it can be done by only 
creating 100k.

* Crawl all the HREFs out of a given HTML file.

* Tell me about the differences between Vectors and arrays and examples of 
when each might be useful.

* How would you implement an LRU cache?


If I ask somebody to write code it is always for a 'toy' problem that can 
be easily encapsulated and written in like 10 minutes.  It's always 
interesting to see people who claim to write Java every day get flustered 
over some pretty basic stuff.  And I'm not talking about memorizing the 
API (although I'd like to think that everybody knows how to get/put a 
hashmap), I"m talking about Java syntax like this:
	
	boolean table[arr.length];
	for (int i =0; i < table.length; i++) {	
		table[i] = false;
	}

That's wrong and redundant, btw. :)  Or this:

	if (map.contains(s)) {
		map.put(map.get(s)++);
	}

which is wrong in more than just a "not memorizing the API" way.



Hope that was interesting to you.  I get nervous when this subject comes 
up because it always turns into a flame war over what is ok to ask and 
what's useful or not.  I wasn't kidding when I joked that "If I need to 
know that I can look it up on google" is a very common response.  By that 
logic I could do brain surgery but nobody seems to be willing to write me 
a paycheck.

Duane





BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org