Java Interview Questions: Am I Being Too Difficult?

G

Guest

I've been tasked with doing technical interviews at my company,
and I have generally ask a range of OO, Java, and "good programming
technique" concepts.

However, one of my favorite exercises I give interviewees seems
to trip them up all the time, and I wonder if I'm being too much
of a hardass... it seems easy enough to ME, but these guys, when
I get them up to the whiteboard, seem to get really confused.

The exercise is this:

Create one or more classes that represent a binary tree.

This class(es) must be able to do standard sorts of operations
one would do on a binary tree in a good, OO sort of way.

A node in this tree holds only a single, String, value.

Now write for me a method named 'find' that takes an argument
of a String (or a String and a Node, depending upon your
implementation) and returns a java.util.List of all nodes,
from the node it's called upon and all descendent nodes, inclusive,
who's value matches that of the String argument.

The code must be syntactically correct, and would compile.

As an added exercise, how would you make this code thread-safe?

Seems pretty simple, huh? But most guys we've brought in just sit there
staring at the board, and have trouble even writing the basic
Node class... they get all confused, don't know how to traverse a
tree, etc.

Am I unreasonable in expecting someone to be able to do this???

- Tim

--
 
C

Carl Howells

Spammay said:
Now write for me a method named 'find' that takes an argument
of a String (or a String and a Node, depending upon your
implementation) and returns a java.util.List of all nodes,
from the node it's called upon and all descendent nodes, inclusive,
who's value matches that of the String argument.

Matches? That term is kind of ambiguous.

However, ignoring that (as clarification can easily be asked for and
given), the problem seems very reasonable to me. It's a simple data
structure problem. It's not like you're asking them to implement an
m-tree or something. Heck, you're not even asking them to make it
self-balancing.

Really, all programmers should be able to explain (and implement) simple
data structures. And I'd say binary search trees are simple data
structures, though just about the most complex that I'd still call simple.
 
M

Marty

Spammay Blockay said:
I've been tasked with doing technical interviews at my company,
and I have generally ask a range of OO, Java, and "good programming
technique" concepts.

However, one of my favorite exercises I give interviewees seems
to trip them up all the time, and I wonder if I'm being too much
of a hardass... it seems easy enough to ME, but these guys, when
I get them up to the whiteboard, seem to get really confused.

The exercise is this:

Create one or more classes that represent a binary tree.

This class(es) must be able to do standard sorts of operations
one would do on a binary tree in a good, OO sort of way.

A node in this tree holds only a single, String, value.

Now write for me a method named 'find' that takes an argument
of a String (or a String and a Node, depending upon your
implementation) and returns a java.util.List of all nodes,
from the node it's called upon and all descendent nodes, inclusive,
who's value matches that of the String argument.

The code must be syntactically correct, and would compile.

As an added exercise, how would you make this code thread-safe?

Seems pretty simple, huh? But most guys we've brought in just sit there
staring at the board, and have trouble even writing the basic
Node class... they get all confused, don't know how to traverse a
tree, etc.

Am I unreasonable in expecting someone to be able to do this???

- Tim

Seems reasonable to me, but Ive never used List, and is that not an
interface anyway?
So without the api do you allow them to say can I return it anyway I like
for now, and implement the list when they can look it up?

Probably stump me in the interview, but as I do not know how list works, I
would ask to return it as an array or vector because I do not know how list
works.

Would this fail me?
Give me 5 minutes with a compiler and api and you could have your list
:)
 
G

Guest

Seems reasonable to me, but Ive never used List, and is that not an
interface anyway?
So without the api do you allow them to say can I return it anyway I like
for now, and implement the list when they can look it up?

Probably stump me in the interview, but as I do not know how list works, I
would ask to return it as an array or vector because I do not know how list
works.

Would this fail me?
Give me 5 minutes with a compiler and api and you could have your list
:)

Oh no, of course not... if you told me you weren't familiar
with the List interface, I'd let you use whatever you wanted.

- Tim

--
 
D

Dan Nuttle

My personal opinion about interview questions is that they should be
designed to indicate whether the person being interviewed can be a valuable
member of your team. So the only relevant criterion to be applied to any
given question is, does it help to indicate whether the person being
interviewed can be a valuable member of your team?

E.g.:

1. Will the person need to write code that represents a binary tree? Or do
you already have an existing library that provides that functionality?

2. Does the coding a representation of a binary tree represent the common
type of programming task your team members face?

3. What other kinds of coding do team members need to do? Can you list
categories, and prioritize them? Where does coding a binary tree fit in?

Only you can determine the answers to these kinds of questions. Now, I will
say that from my own personal experience, I believe that being able to code
a binary tree probably isn't that important. First, it's been done; you
can find implementations already coded for you. Second, it's the kind of
thing that throw coders for a loop if they're not familiar with it, but once
you understand what a binary tree is, it's not terribly difficult to code
it. Are you perhaps indulging yourself in trying to make interviewees jump
through a hoop that you once had to jump through yourself? Don't think I'm
trying to be insulting; I know I can be prone to just that kind of
indulgence myself.

Personally, I think the most important attributes of coders are 1) the
ability to "get things done", however nebulous that sounds, 2) the ability
to work as part of a team, and 3) the ability not to annoy the living hell
out of me with bizarre personal habits and mannerisms. A good coder can
quickly learn what a binary tree is, and code it, even if he's never heard
of the concept before. I'd concentrate more on best practices (for example,
emphasizing the uses of interfaces rather than inheritance whenever
possible) rather than something like the ability to code a particular
concept or algorithm. But even then, best practices can be learned.
 
S

Sudsy

Spammay Blockay wrote:
A node in this tree holds only a single, String, value.
<snip>

This is the part which confuses me. How can you implement a tree,
requiring left and right branches, if the node isn't permitted to
contain the appropriate references?
Most of us know that you need left and right references, plus the
actual value of the node; values which lexically evalute to less
than this node can be found in the left subtree while ones which
are lexically greater are found in the right subtree.
If both left and right are null then you've got a leaf node.
So why the unusual limitation?
Apart from that, it's a standard programming exercise.
So maybe it's a matter of problem statement which is causing the
difficulty...
YMMV
 
G

Guest

My personal opinion about interview questions is that they should be
designed to indicate whether the person being interviewed can be a valuable
member of your team. So the only relevant criterion to be applied to any
given question is, does it help to indicate whether the person being
interviewed can be a valuable member of your team?

Well, I can see your point... the thing is, I guess I have
some pretty strong ideas about what "good programmers" *should*
be able to do, and the kinds of things they should know.
Basically, they should:

1) Have a broad knowledge of common data structures, how
they work, and how they are implemented (and be able to
implement them themselves, even if perfectly good, complete
implementations exist in easily-found libraries).

2) Have experience in all tiers of common sorts of applications
(UI, Business Logic/Middleware, Database, Network)

3) Be able to quickly come up with relatively clever algorithms
that solve common (or uncommon) sorts of problems.

4) Be very comfortable with most uses of boolean logic,
as they appear in programming environments (eg. the
ability to code complex if/then/else's and not lose
track of the logic they're trying to code)

5) Know that it is important to make your code readable,
clear, and concise

6) Be able to quickly write code that accomplishes simple tasks
(eg. write a Java Bean, write a Comparator, know how to use
the Java Collections API, etc.).

In the interview I had today with this guy, he knew what a Binary Tree
was. But then he started coding it as an N-ery tree, with an add(Node myNode)
method. That's not a binary tree. So I clarified it for him "In a binary
tree each node may have at most two child nodes, left and right".

He continued working, but very slowly, not seeming to understand
what the first thing he might want to do would be.

He showed some knowledge of how to approach the problem (wrote a BTree
interface, then applied it to a class), but didn't seem comfortable
just diving right in and getting his hands dirty, which is what we DO
need for this position.

E.g.:

1. Will the person need to write code that represents a binary tree? Or do
you already have an existing library that provides that functionality?

2. Does the coding a representation of a binary tree represent the common
type of programming task your team members face?

3. What other kinds of coding do team members need to do? Can you list
categories, and prioritize them? Where does coding a binary tree fit in?

I can say that coding a binary tree won't be a requirement for the job,
no; but understand what one is, how one might code one, how one might
write the kinds of methods needed to maintain one, etc. to me are
the _kind_ of skills that show how well-versed somebody is.

I want someone who doesn't have to be taught any programming skills
on the job; they may need to learn a new API, or how existing code works,
but they're knowledge of patterns, data structures, algorithms, and
Java syntax is rock-solid.
Only you can determine the answers to these kinds of questions. Now, I will
say that from my own personal experience, I believe that being able to code
a binary tree probably isn't that important. First, it's been done; you
can find implementations already coded for you. Second, it's the kind of
thing that throw coders for a loop if they're not familiar with it, but once
you understand what a binary tree is, it's not terribly difficult to code
it.

But isn't knowing what a binary tree is, and how to code one,
something that's kind of Computer Science 101-ish?
Are you perhaps indulging yourself in trying to make interviewees jump
through a hoop that you once had to jump through yourself? Don't think I'm
trying to be insulting; I know I can be prone to just that kind of
indulgence myself.

I may be, but they're also hoops I WANTED to learn to jump through.
I have read my Knuth. I have read my Dragon Book. I currently read
the Javasoft website and these newsgroups. I expect no less of someone
I'd want to hire.

Is that unreasonable?

I also grew up playing on the Arpanet machines, reading stuff by
all the old MIT hackers, and developed a strong idea that any programmer
worth his salt spent TIME to LEARN all these minutiae of programming.
They could code in their sleep. That kind of thing.
Personally, I think the most important attributes of coders are 1) the
ability to "get things done", however nebulous that sounds, 2) the ability
to work as part of a team, and 3) the ability not to annoy the living hell
out of me with bizarre personal habits and mannerisms. A good coder can
quickly learn what a binary tree is, and code it, even if he's never heard
of the concept before. I'd concentrate more on best practices (for example,
emphasizing the uses of interfaces rather than inheritance whenever
possible) rather than something like the ability to code a particular
concept or algorithm. But even then, best practices can be learned.

Quite true... I just want a big background in these "basics of programming"
kinds of things. Doesn't anybody keep up with that stuff these days?

- Tim

--
 
G

Guest

Matches? That term is kind of ambiguous.

public class Node {

private Node leftNode, rightNode;
private String value;

... etc ...


public List find(String value) {

...

if (value.equals(this.getValue())) {
...
}

...
}
}

(for example)
However, ignoring that (as clarification can easily be asked for and
given), the problem seems very reasonable to me. It's a simple data
structure problem. It's not like you're asking them to implement an
m-tree or something. Heck, you're not even asking them to make it
self-balancing.

Really, all programmers should be able to explain (and implement) simple
data structures. And I'd say binary search trees are simple data
structures, though just about the most complex that I'd still call simple.

That's my opinion, too. But I'm finding that most folks that come in to
be interviewed can't do this problem. One guy even went on about how
nobody DOES that kind of thing anymore, and it was a silly question to
ask, etc.

*sigh* What's the world coming to? :)

- Tim

--
 
G

Guest

Spammay Blockay wrote:

<snip>

This is the part which confuses me. How can you implement a tree,
requiring left and right branches, if the node isn't permitted to
contain the appropriate references?

Okay wise-guy. :) The only DATA value it holds (as opposed to
values/members needed to implement the structure of the tree itself).
Anyway, I made that clear in my instructions to him. At least I
hope I did. I wonder if he misinterpreted it to mean you can't have
ANY other members but that. I don't think he did, since his solution
didn't have just a single String value... and, of course, a good
programmer would say "What do you mean? How can I have a Node without
a left/right node as members?"
Most of us know that you need left and right references, plus the
actual value of the node; values which lexically evalute to less
than this node can be found in the left subtree while ones which
are lexically greater are found in the right subtree.

That's only if you're requiring adding a value to the tree
to include placing it in the proper place in the tree to
maintain sorting in that way. I made sure he understood that
this wasn't a requirement.
If both left and right are null then you've got a leaf node.
So why the unusual limitation?

I think you misunderstood me, that's all.
Apart from that, it's a standard programming exercise.
So maybe it's a matter of problem statement which is causing the
difficulty...
YMMV

Could be... I'll assure that I am 100% clear next time. Although I
was there to answer any questions he had, and was more clear in my instructions
to him than just here.

- Tim

--
 
R

Richard Chrenko

I've been tasked with doing technical interviews at my company,
and I have generally ask a range of OO, Java, and "good programming
technique" concepts.

However, one of my favorite exercises I give interviewees seems
to trip them up all the time, and I wonder if I'm being too much
of a hardass... it seems easy enough to ME, but these guys, when
I get them up to the whiteboard, seem to get really confused.

The exercise is this:

Create one or more classes that represent a binary tree.

This class(es) must be able to do standard sorts of operations
one would do on a binary tree in a good, OO sort of way.

A node in this tree holds only a single, String, value.

Now write for me a method named 'find' that takes an argument
of a String (or a String and a Node, depending upon your
implementation) and returns a java.util.List of all nodes,
from the node it's called upon and all descendent nodes, inclusive,
who's value matches that of the String argument.

The code must be syntactically correct, and would compile.

As an added exercise, how would you make this code thread-safe?

Seems pretty simple, huh? But most guys we've brought in just sit there
staring at the board, and have trouble even writing the basic
Node class... they get all confused, don't know how to traverse a
tree, etc.

Am I unreasonable in expecting someone to be able to do this???

- Tim


You say you are responsible for "technical interviews". But the
applicability of your exercise depends to a large extent on the particular
job for which the person is interviewing. For a software architect your
question is way too detailed, for a web developer a bit off-base, but for a
nuts-and-bolts programmer quite relevant. I got my degree in applied
physics and have been architecting scientific simulations and writing core
algorithm code for for nearly 10 years, but have never had to implement a
binary tree. I freely admit that I would struggle with your test - not
because I am an incompetent Java developer, but because it is not
applicable to my particular expertise.
 
J

Jesper Nordenberg

Am I unreasonable in expecting someone to be able to do this???

I don't think so. I wouldn't hire a programmer that can't solve your
problem. It's a good problem because it emphasizes on the ability to
understand data structures, algorithms and how to solve problems,
rather than just knowing the Java API and how to use it. I think the
former is MUCH more important for a good programmer. The latter is
what Javadoc is for. :)

/Jesper Nordenberg
 
T

Tim Ward

Spammay Blockay said:
Am I unreasonable in expecting someone to be able to do this???

Possibly. Depends what you're after. A perfectly competent Java application
level programmer (who knows all about, say, multi-tier web applications)
could well not have a clue how to do this sort of stuff - because a Java
application level programmer never has to do anything like this, they just
use the stuff in the library that already does it for them.

If on the other hand you're after someone to do low level computer-sciency
library type work then maybe you should do the test in some other language.
 
A

Andy Fish

Jesper Nordenberg said:
(e-mail address removed) (Spammay Blockay) wrote in message

I don't think so. I wouldn't hire a programmer that can't solve your
problem. It's a good problem because it emphasizes on the ability to
understand data structures, algorithms and how to solve problems,
rather than just knowing the Java API and how to use it. I think the
former is MUCH more important for a good programmer. The latter is
what Javadoc is for. :)

/Jesper Nordenberg

I agree - this is a very good test.

I have always set programming tests (usually slightly easier than yours)
when recruiting and I am amazed at the low average quality of the results.
It's quite scary how many programmers muddle through using a "darwinian"
approach - just changing things almost at random until it works and then not
really understanding why it worked. I have looked at many other people's
code in my time and a lot of it only hangs together by coincidence.

Also I don't think you should lay down the requirements 100% explicitly. If
someone is able to pick faults with the problem and have a discussion about
what the exact requirements are (such as some of the messages in this
thread) I would see that as a very good sign too - infact someone who goes
away on their and produces "working" code when the requirements are unclear
might count against them.

Stick at it though - if you manage to build a team where everyone pulls his
weight you will be surprised how much you can achieve. and always err on the
side of hiring a few good people rather than a lot of mediocre ones.

Andy
 
C

Chris Uppal

Spammay said:
[sniped description of programming problem]
Seems pretty simple, huh? But most guys we've brought in just sit there
staring at the board, and have trouble even writing the basic
Node class... they get all confused, don't know how to traverse a
tree, etc.

Am I unreasonable in expecting someone to be able to do this???

I think there's an important point here that no one else has yet mentioned.

I think this exercise is *way* too difficult -- so difficult that it will be
giving you little or no useful information.

The problem is that writing and thinking code while standing up in a stressful,
and above all, *social*, situation is just about impossible. At least I know
/I/ can't do it, and I've done a bit of interviewing and seen that other people
can't either. The bits of the brain you need for programming are occupied
reading the interviewer's body language, and trying not to shit yourself....

An example of how difficult it is to write code on a whiteboard from when I was
interviewing Java programmers (a thing I /hate/ doing, but that's another
story...) I wanted to ask the old "how to return two values from a method"
question in a way that had a bit more meat to it, so I decided to ask
candidates to write a method that took an array of ints and returned the max
and min elements. The first candidate -- a genuine programmer, I think -- just
froze up. Couldn't even see how to do a loop over the elements of the array to
/find/ the extrema (which I'd thought was too trivial to discuss). We never
even got close to considering how to pass both values back to the caller or
opening a discussion about whether the gain of looping over the array once
instead of twice was worth the extra bother -- which is what I was hoping
/good/ candidates would do). I simplified the question for the second
candidate. I forget now who it was that suggested sorting the array and then
taking the end-points... I dropped the question after that.

As a sit-down exercise, either on paper or (better, since you are looking for
approximate syntactic correctness) at a computer without the interviewer
watching, and with no set time, just "tell me when you're done", I think your
question would probably work. Although perhaps still be a bit too hard for
many applicants -- but that's OK, if your object is to winnow out those without
(IMO) basic skills and talents. But be prepared for most candidates to flub
it -- which is what you'd expect unless you happen to believe that /most/
programmers are in fact reasonably competent...

An example of how few programmers can pass a "simple" test -- at least in an
interview situation. A colleague at the same shop was doing the C++
interviewing, and one of his pet "practical" questions was to ask the candidate
to write a *very simple* string class (just simple constructors, a destructor,
and a length() method, iirc). He used that question for a long time, and must
have asked it dozens of times, but he told me later that nearly all
interviewees (who were not beginners) had real trouble with it, and only one
candidate (guess who ;-)) ever answered it completely.

Incidentally, for anyone who is wanting to respond "but the C++ standard
library has a String class, it's not a representative task to program something
that already exists". If a candidate said that then I (or my colleague) would
take that as a plus. But we'd still ask him/her to do the code -- after all,
if you can't code up a simple API that has already been defined for you (or a
simplified version of it) what hope do you have of creating *real* code ?

-- chris
 
G

Gawnsoft

I've been tasked with doing technical interviews at my company,
and I have generally ask a range of OO, Java, and "good programming
technique" concepts.

However, one of my favorite exercises I give interviewees seems
to trip them up all the time, and I wonder if I'm being too much
of a hardass... it seems easy enough to ME, but these guys, when
I get them up to the whiteboard, seem to get really confused.

The exercise is this:

Create one or more classes that represent a binary tree. ....
Now write for me a method named 'find' that takes an argument
of a String (or a String and a Node, depending upon your
implementation) and returns a java.util.List of all nodes,
from the node it's called upon and all descendent nodes, inclusive, ....
The code must be syntactically correct, and would compile.

As an added exercise, how would you make this code thread-safe?

As to whether this is a good test or not, it depends on

- how applicable knowledge of Binary trees is to the domain area your
group works in.

and, if not,

- whether the interviewee has to have a priori knowledge of binary
trees for you to feel s/he succeeeded.

You say later you are searching for:
" 1) Have a broad knowledge of common data structures, how
they work, and how they are implemented (and be able to
implement them themselves, even if perfectly good, complete
implementations exist in easily-found libraries)."

Which is fair enough.

But I'd suggest you want their greatest knowledge on the common data
structures most used, or used at all, in the areas of your application
base you're hiring for.

Imagine an interviewee didn't have prior knowledge of binary trees.

As has been pointed out on the thread, it's a relatively simple
concept to explain to someone, but not every coder has experience or
even knowledge of what they are.

If you explained it, and they then coded it well, would that pass your
test?

If they knew what it was already, and therefore were just spouting off
what they knew, would that be as informative to you?


2) Have experience in all tiers of common sorts of applications
(UI, Business Logic/Middleware, Database, Network)

a) I note that you put UI as first in the list, but your questioning
seems concerned with middleware, and I suspect you are nothing like as
rigorous in your probing of the interviewee's ability to design
learnable, memorable UIs with good affordance, visibility and
feedback.

Often this is /should/ be a key skill looked for, but because it's
seens as a 'soft' human skills issues, and not a 'hard' techie area,
it is not checked at interview, even for people who will be writing
lots of user interfaces.


b) There's nothing wrong with hiring folk with experience of only a
couple of these, if they have an appreciation of the others. - a lot
of places have their developers specialise in a couple of those areas.

You'd be cutting yourself off from that pool of potential hires.




3) Be able to quickly come up with relatively clever algorithms
that solve common (or uncommon) sorts of problems.

If they knew already what a BT was, this wasn't necessarily tested.

If they did not know what a BT was, then it might have been tested.

4) Be very comfortable with most uses of boolean logic,
as they appear in programming environments (eg. the
ability to code complex if/then/else's and not lose
track of the logic they're trying to code)

Again, depends on the familiarity of the problem space (BTs) how much
this was tested.

5) Know that it is important to make your code readable,
clear, and concise

There will be much less cognitive capacity left for this in the
'BT-newbies', but not for the fok who are just reciting from their
previous knowledge.

6) Be able to quickly write code that accomplishes simple tasks
(eg. write a Java Bean, write a Comparator, know how to use
the Java Collections API, etc.)."

This would still be tested if you had to explain what a BT is.


Personally, I'd want them in a different priority order.

I'd want you to probe their knowledge of what a BT /is/ separately
from implementing one.

At the moment, you're conflating too much into one big lump, and
trying then to work out what your results mean.

You have no way of demultiplexing them.

In general, your first two objectives are against the interviewee's
knowledge, and your last four are against the interviewee's process
skills.


My view is : concentrate on 3,4,5,6

Test on whichever of 2) the interviewee is claiming to have.

Test for /ability to pick up new stuff/.

Currently your test does not test for this. It primarily tests for
existing knowledge of tree structures.

(i.e. that knowlefdge is a hurdle. If you jump the hurdle, you can go
on to demonstrate knowledge of the List class, thread-safing, etc.,
ability to pick up

But if they fall at the first hurdle you don't get to check the other
stuff. Worse, you may think that you are and that they are failing
those parts.

If they are good at what they know, and show ability to learn knew
stuff, then you'll get them to cover all areas if that's what you want
in your teams.

In the case of 1) test it on order of importance/frequency of use in
/your/ application base.

--
Cheers,
Euan
Gawnsoft: http://www.gawnsoft.co.sr
Symbian/Epoc wiki: http://html.dnsalias.net:1122
Smalltalk links (harvested from comp.lang.smalltalk) http://html.dnsalias.net/gawnsoft/smalltalk
 
D

Dave Monroe

I've been tasked with doing technical interviews at my company,
and I have generally ask a range of OO, Java, and "good programming
technique" concepts.

However, one of my favorite exercises I give interviewees seems
to trip them up all the time, and I wonder if I'm being too much
of a hardass... it seems easy enough to ME, but these guys, when
I get them up to the whiteboard, seem to get really confused.

The exercise is this:

Create one or more classes that represent a binary tree.

This class(es) must be able to do standard sorts of operations
one would do on a binary tree in a good, OO sort of way.

A node in this tree holds only a single, String, value.

Now write for me a method named 'find' that takes an argument
of a String (or a String and a Node, depending upon your
implementation) and returns a java.util.List of all nodes,
from the node it's called upon and all descendent nodes, inclusive,
who's value matches that of the String argument.

The code must be syntactically correct, and would compile.

As an added exercise, how would you make this code thread-safe?

Seems pretty simple, huh? But most guys we've brought in just sit there
staring at the board, and have trouble even writing the basic
Node class... they get all confused, don't know how to traverse a
tree, etc.

Am I unreasonable in expecting someone to be able to do this???
--
If you posed that problem to me, I'd ask if you know about XML.

That's the de facto standard for representing a tree structure. Nodes
are defined as part of the API.

If you still insisted on your bizarre exercise, I'd ask why you are
trying to re-invent the wheel. Why not ask the interviewee to write a
compiler?
 
L

Luke Tulkas

Spammay Blockay said:
I've been tasked with doing technical interviews at my company,
and I have generally ask a range of OO, Java, and "good programming
technique" concepts.

However, one of my favorite exercises I give interviewees seems
to trip them up all the time, and I wonder if I'm being too much
of a hardass...

From what I read below, yes, absolutely! Appart from
1. writing programs on whiteboard and
2. demanding that they "would compile",
there are some other issues.

1. How long does an interview (with a particular candidate) last?
2. Why don't you put your candidates behind a machine with a nice IDE?
3. <sarcastic>Why on Earth would anybody name some class "Node"? Is that
a part of test instructions or does the candidate automatically fail if
he/she names it Vertex, for example?</sarcastic>
4. If you're such a hot shot that, faced with a similar task (b-tree for
example, or even somehing more complex), you only think for a second (no
staring at the board ;-)) and then
a) write all the lines (consecutively, including comments) for all the
classes
b) on whiteboard,
c) compilable,
d) threadsafe,
e) in 15 minutes,
d) and guarantee with, say, a couple of grand, that it does what you say
it should do
then, my friend, you come work for me. You're accepted.
 
D

D Rolfe

Spammay said:
I've been tasked with doing technical interviews at my company,
and I have generally ask a range of OO, Java, and "good programming
technique" concepts.

However, one of my favorite exercises I give interviewees seems
to trip them up all the time, and I wonder if I'm being too much
of a hardass... it seems easy enough to ME, but these guys, when
I get them up to the whiteboard, seem to get really confused.

The exercise is this:

Create one or more classes that represent a binary tree.
[ snip ! ]
Am I unreasonable in expecting someone to be able to do this???

- Tim


IMHO Yes. It's hard to get something like this to work while being
watched. It's also about as relevent as roman numeral generators to a
lot of people.

I ask people who claim to know Java what they think should have been
done differently when it was designed.

That seems to be pretty effective at identifying people who *know* Java.
Open ended and possinbly answerless questions will reveal more about
what's going on in their head than computer science 'challenges' like
the above. Also I've never met a real expert who went all quiet when
asked that question.

David Rolfe
Orinda Software
Dublin, Ireland
 
L

Luke Tulkas

Spammay Blockay said:
Well, I can see your point... the thing is, I guess I have
some pretty strong ideas about what "good programmers" *should*
be able to do, and the kinds of things they should know.
Basically, they should:

1) Have a broad knowledge of common data structures, how
they work, and how they are implemented (and be able to
implement them themselves, even if perfectly good, complete
implementations exist in easily-found libraries).

2) Have experience in all tiers of common sorts of applications
(UI, Business Logic/Middleware, Database, Network)

3) Be able to quickly come up with relatively clever algorithms
that solve common (or uncommon) sorts of problems.

4) Be very comfortable with most uses of boolean logic,
as they appear in programming environments (eg. the
ability to code complex if/then/else's and not lose
track of the logic they're trying to code)

5) Know that it is important to make your code readable,
clear, and concise

6) Be able to quickly write code that accomplishes simple tasks
(eg. write a Java Bean, write a Comparator, know how to use
the Java Collections API, etc.).

In the interview I had today with this guy, he knew what a Binary Tree
was. But then he started coding it as an N-ery tree, with an add(Node myNode)
method. That's not a binary tree.

Are you saying that having a method add(Node myNode) in one of the
classes automatically disquallifies a particular data structure as a
binary tree?
 
C

Chris Smith

Dan said:
Personally, I think the most important attributes of coders are 1) the
ability to "get things done", however nebulous that sounds, 2) the ability
to work as part of a team, and 3) the ability not to annoy the living hell
out of me with bizarre personal habits and mannerisms. A good coder can
quickly learn what a binary tree is, and code it, even if he's never heard
of the concept before.

When I first started interviewing job candidates several years ago, I
had the same basic attitude. The problem, though, is that you have to
go on what you can observe and measure. Writing code to implement a
binary tree like this demonstrates at least a certain minimum requisite
ability to think about code in abstract terms, and get something working
without a lot of compiler trial-and-error. Eventually, you'll have to
pick some concrete questions and tasks, and it *can't* always be
acceptable to get an answer of "I could learn that if I needed it".

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top