473,838 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Java Interview Questions: Am I Being Too Difficult?

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

--

Jul 17 '05
54 17456
Chris Smith wrote:
Eric Sosman wrote:
The question you ask, though, is "Demonstrat e knowledge of
data structure X." Perhaps a better question might be "Tell me
all about your favorite data structure, and sketch an implementation. "
Less coercive, more open-ended -- and you might even learn a thing
or two ...

Eric,

I get your point here, but I'm just imagining being in an interview and
being asked that question. I suppose I'd feel very awkward and wonder
what kind of an answer is desired. "Well, I've always felt a special
bond of friendship with the red-black tree..."


Aside from the "special bond" part, this is exactly the
sort of response I'd hope to get. I'd ask you to explain what
a red-black tree is, what it's good for, and what makes it good
for those purposes. I'd ask you to show how to perform some
operation like deleting a node -- I'd probably settle for
diagrams on a whiteboard rather than insisting on compilable
code, but might require the latter in unusual circumstances
(e.g., if the job required knowledge of an uncommon language
and I felt the need to probe some of your resume's claims).
I'd ask you if there were any circumstances in which you'd
abandon your beloved R-B tree in favor of something else.

The point of all this isn't really to test your knowledge
of R-B trees, but to tell whether you actually know something
or are merely blowing smoke, to get an idea of how you deal
with trade-offs, to find out how well you understand your
chosen tools. After all, once I've hired you (big bonus in
your case, I'd think) I'm not going to ask you to write new
R-B implementations ! That would be a shameful betrayal of
*my* favorite data structure, the skip list, and you better
not say anything mean about her ;-)

--
Er*********@sun .com

Jul 17 '05 #31
Eric Sosman sez:
Chris Smith wrote:
Eric Sosman wrote:
.... Perhaps a better question might be "Tell me
all about your favorite data structure, and sketch an implementation. "
Less coercive, more open-ended -- and you might even learn a thing
or two ...


I get your point here, but I'm just imagining being in an interview and
being asked that question. I suppose I'd feel very awkward and wonder
what kind of an answer is desired. "Well, I've always felt a special
bond of friendship with the red-black tree..."


Aside from the "special bond" part, this is exactly the
sort of response I'd hope to get.


If I were asked about my favourite data structure, "special bond"
part is exactly what'd be going through my mind, followed by "do
I want to work with people who have _favourite_ _data_ _structures_,
ffs?!!"

Besides, any competent programmer should answer "char(0)" because
it has small memory footprint, is well understood, easy to implement,
debug, etc.

Dima
--
Sufficiently advanced incompetence is indistinguishab le from malice.
Jul 17 '05 #32
On Tue, 18 May 2004 23:36:53 GMT, SP*********@BLO CKEDTOAVOIDSPAM .com
(Spammay Blockay) wrote:
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
The only two points I have a problem with are:
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.
You might want to specify the tree type and operations you want
implemented, because my idea of "standard" might be different than
yours. The basics might be search, insert, delete. Other functions
that may or may not make it into someone's idea of "standard"
functions might be the order traversals, finding the level of an
entry, rebalancing (if required by the requested tree type), and
likely others that you've thought of, but I've not.

Also a generic BT only specifies a nodes with data and two node-links,
with no specific insertion organization. This may be the source of
the traversal confusion, because the output from the order traversals
will be different depending on how the BT was implemented (though I
guess the code would be the same).
The code must be syntactically correct, and would compile.


This is another bone of contention. Unless you give the applicant a
computer, with a compiler installed on it, this isn't terribly fair.
Typos and other small error can arise in hand written code, making
impossible to compile, and yet would be easily catchable under normal
conditions.
---------------------------------------------

MCheu
Jul 17 '05 #33
Spammay Blockay wrote:
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 problem with this, is two-fold:

First this is good for "performers ", but just because you can play
programmer on TV by hauling concepts out of a recendly completed
programming class, doesn't mean you will be good in other situations.

Second, Java isn't the perfect language, in 4 or 5 years, your company
may be moving to something else, do you want Java experts, or people who
can learn the company methodology, and can apply it, in Java, or some
other newer language.

A better excercise, would be to draw up a case study that you know has
major issues, then ask candidates how they would deal with the issue, if
they tell you the major issues or at least some of them, you have a good
candidate, if they don't raise some issues, then they are a clueless
Microserf, even though they could be a great performer.

Paul


Jul 17 '05 #34
Liz

"Paul Schmidt" <wo*******@yaho o.ca> wrote in message
news:_p******** *************@n ews20.bellgloba l.com...
Spammay Blockay wrote:
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 problem with this, is two-fold:

First this is good for "performers ", but just because you can play
programmer on TV by hauling concepts out of a recendly completed
programming class, doesn't mean you will be good in other situations.

Second, Java isn't the perfect language, in 4 or 5 years, your company
may be moving to something else, do you want Java experts, or people who
can learn the company methodology, and can apply it, in Java, or some
other newer language.

A better excercise, would be to draw up a case study that you know has
major issues, then ask candidates how they would deal with the issue, if
they tell you the major issues or at least some of them, you have a good
candidate, if they don't raise some issues, then they are a clueless
Microserf, even though they could be a great performer.

Paul


Maybe if you are hiring a code monkey you can ask s/him to jump through
hoops like this, but if you want someone to do more you can't get a
good indication of their merit this way.
Jul 17 '05 #35
"Liz" <Li*@nospam.com > wrote in message news:ftBrc.7772 $JC5.729348@att bi_s54...

"Paul Schmidt" <wo*******@yaho o.ca> wrote in message
news:_p******** *************@n ews20.bellgloba l.com...
Spammay Blockay wrote:
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 problem with this, is two-fold:

First this is good for "performers ", but just because you can play
programmer on TV by hauling concepts out of a recendly completed
programming class, doesn't mean you will be good in other situations.

Second, Java isn't the perfect language, in 4 or 5 years, your company
may be moving to something else, do you want Java experts, or people who
can learn the company methodology, and can apply it, in Java, or some
other newer language.

A better excercise, would be to draw up a case study that you know has
major issues, then ask candidates how they would deal with the issue, if
they tell you the major issues or at least some of them, you have a good
candidate, if they don't raise some issues, then they are a clueless
Microserf, even though they could be a great performer.

Paul


Maybe if you are hiring a code monkey you can ask s/him to jump through
hoops like this, but if you want someone to do more you can't get a
good indication of their merit this way.


A similar situation when I would interview assembler
language applicants: I would explain how a compare-and-swap
machine instruction worked, how the registers are specified
and the memory location, condition code result, etc. Then I
would ask the applicant to write a small code fragment that
uses the compare-and-swap to update a linked-list. The intent
was to determine how the applicant *thinks* about problem
solving, not whether he can cough up some canned code he
memorized from a book.

So, I think that giving an applicant the basic problem
solving *tools* and seeing how that applicant applies those
tools to solve a problem is more important than coding.

2 cents worth. Your mileage may vary.
Jul 17 '05 #36
At one of the companies I worked for, they hired people straight out
of college, and sometimes people who came from non-IT backgrounds who
had studied IT on their own or at night. Therefore, they gave tests
to everyone as part of the interview process. But after we got bought
out by a bigger company, they changed the policy to only hire
experienced candidates with appropriate academic degrees, so as a
result, giving tests at interviews was deemed unnecessary. So it
depends on the rest of the person's qualifications. If they've got
PhDs from Cambridge or Imperial College with experience developing
safety kernels for BAE or the like, then I wouldn't feel the need to
test them. If I didn't see evidence of their skill in programming,
it's a reasonable test. Also, are you expecting to see fully
compileable code from them, or will pseudocode suffice?
Jul 17 '05 #37
In article <t9************ *************** *****@4ax.com>,
MCheu <mp****@yahoo.c om> wrote:

The only two points I have a problem with are:
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.
You might want to specify the tree type and operations you want
implemented, because my idea of "standard" might be different than
yours. The basics might be search, insert, delete. Other functions
that may or may not make it into someone's idea of "standard"
functions might be the order traversals, finding the level of an
entry, rebalancing (if required by the requested tree type), and
likely others that you've thought of, but I've not.


The reason I don't specify these things is to see what
ideas the interviewee *has* of "standard". That is,
what kinds of things might one want to do to a binary
tree that seem like useful, utility sort of methods.
Also a generic BT only specifies a nodes with data and two node-links,
with no specific insertion organization. This may be the source of
the traversal confusion, because the output from the order traversals
will be different depending on how the BT was implemented (though I
guess the code would be the same).


The manner of traversal isn't that important to me, so long as
they traverse it SOMEHOW... the output of the 'find' method is
a java.util.List, and I don't care about the order of the found
nodes in the List.
The code must be syntactically correct, and would compile.


This is another bone of contention. Unless you give the applicant a
computer, with a compiler installed on it, this isn't terribly fair.
Typos and other small error can arise in hand written code, making
impossible to compile, and yet would be easily catchable under normal
conditions.


Pretty true... but, well, *I* can write syntactically correct code
on a whiteboard, so I'm using myself as a benchmark. I write code
using 'vim', don't depend on IDE's... although IDE's are really useful,
I tend to think that a "good programmer" should be able to code
without one. A little help is allright (syntax highlighting, brace
matching, etc.), but needing an IDE to know Java syntax, or even well-known
API's, is using a crutch (in my opinion, anyway).

- Tim

--

Jul 17 '05 #38
In article <_p************ *********@news2 0.bellglobal.co m>,
Paul Schmidt <wo*******@yaho o.ca> wrote:
The problem with this, is two-fold:

First this is good for "performers ", but just because you can play
programmer on TV by hauling concepts out of a recendly completed
programming class, doesn't mean you will be good in other situations.

Second, Java isn't the perfect language, in 4 or 5 years, your company
may be moving to something else, do you want Java experts, or people who
can learn the company methodology, and can apply it, in Java, or some
other newer language.

A better excercise, would be to draw up a case study that you know has
major issues, then ask candidates how they would deal with the issue, if
they tell you the major issues or at least some of them, you have a good
candidate, if they don't raise some issues, then they are a clueless
Microserf, even though they could be a great performer.


Good points... I don't usually think in "who would be a good
problem-solver in general" but "who would be a good programming-problem
solver, and who knows general syntactical concepts and rules
like the back of their hand". Your suggestion is a good'n. :-)

- Tim

--

Jul 17 '05 #39
In article <d6************ **************@ posting.google. com>,
Herman <he*******@hotm ail.com> wrote:
At one of the companies I worked for, they hired people straight out
of college, and sometimes people who came from non-IT backgrounds who
had studied IT on their own or at night. Therefore, they gave tests
to everyone as part of the interview process. But after we got bought
out by a bigger company, they changed the policy to only hire
experienced candidates with appropriate academic degrees, so as a
result, giving tests at interviews was deemed unnecessary. So it
depends on the rest of the person's qualifications. If they've got
PhDs from Cambridge or Imperial College with experience developing
safety kernels for BAE or the like, then I wouldn't feel the need to
test them. If I didn't see evidence of their skill in programming,
it's a reasonable test. Also, are you expecting to see fully
compileable code from them, or will pseudocode suffice?


If they said "I'm kind of dependent on my IDE, so do you mind
if I use pseudocode?" then I'd accept it.

A guy I interviewed was very demeaning of my desire to have him
write syntactically correct (or even close to it) code, which
made me wonder about how well he actually knew Java.

- Tim

--

Jul 17 '05 #40

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3499
by: abcd | last post by:
kutthaense Secretary Djetvedehald H. Rumsfeld legai predicted eventual vicmadhlary in Iraq mariyu Afghmadhlaistmadhla, kaani jetvedehly after "a ljetvedehg, hard slog," mariyu vede legai pressed Pentagjetvedeh karuvificials madhla reachathe strategy in karkun campaign deshatinst terrorism. "mudivae maretu winning or losing karkun global varti jetvedeh terror?" Mr. Rumsfeld adugued in a recent memormariyuum. vede velli jetvedeh madhla...
0
6172
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of attending interviews. If you own a company best way to judge if the candidate is worth of it. http://www.questpond.com/InterviewRatingSheet.zip 2000 Interview questions of .NET , JAVA and SQL Server Interview questions (worth downloading it)
2
6978
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of attending interviews. If you own a company best way to judge if the candidate is worth of it. http://www.questpond.com/InterviewRatingSheet.zip
2
7230
by: freepdfforjobs | last post by:
Full eBook with 4000 C#, JAVA,.NET and SQL Server Interview questions http://www.questpond.com/SampleInterviewQuestionBook.zip Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of attending interviews. If you own a company best way to judge if the candidate is worth of it. http://www.questpond.com/InterviewRatingSheet.zip
0
9853
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9696
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10584
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10289
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9423
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7827
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7014
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4482
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.