473,839 Members | 1,494 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 17457
Spammy...

YOU ARE NOT and i do mean NOT being difficult at all....

If more interviewers were like you companies would hire people that knew
that they were talking about get a whole lot more done. I'll give you a
real example.... I have a cousin who has never been around a computer in
his life except for looking over my shoulder, couldn't write a program
to save his life. Much less did he spend 10 to 15 years as a programmer
and systems analyst with a variety of high tech firms with numerous
projects and numerous technologies... . yet HE is in NEW YORK as a
"COmputer Consultant" and I'm waiting for John Kerry to get in office....

What he does know how to do is tell people what they want to hear. A
most valuable skill in of itself but that has nothing to do with a
technical background. How did he manage to get a past the border guard?
well, at that time when Bill Clinton was in office, the demand for
computer people was so huge that if you could even spell computer you
were hired. This is NOT the case with George Fucking Bush. I don't know
precisely why the economy tightens it's belt when a Replican gets into
office, but thats what happens.

Anyway, getting back to your question, I simple love it when I get an
interviewer who knows what he is talking about and you can have a 1/2
decent interview and not walk away like you were either giving a lecture
on basic algoritms or talking to a gawd damn wall....

I would dearly love to have someone like yourself as an interviewer!

- perry
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


Jul 17 '05 #41

Spammy,

Not the least one bit are you being too difficult. Many people think
that just because you are an interviewer that you automatically know
your stuff. Quite often this is not the case. I think one of my most
frustrating interviews came as a result as someone not asking me a
question like this... a question that's relative and shows intelligence
on the side of the people looking for help. Once i was asked a question
"How many bits does it require to store the number 1000?" Normally that
wouldn't be a problem but they way he asked it just caught me completely
off guard.

Instead had I realized the level of non-technical knowledge that this
fellow possessed I wouldn't have raised an eye brow....

1 2 4 8 16 32 64 128 256 512 (1024) = 2^10 bits

now thats how a programmer would have answered the question but what was
funny is that he didn't explain his answer like that at all... instead
he simple reworded his question and then used "math" to show what he was
talking about (which showed no real technical expertise on his part,
much less any knowledge of formal algoritms that you've demonstrated).

And I also remember telling a fellow later i knew about the inicident
and asking him the same question. little did i not realize that i was
speaking with a pathalogical liar who... proceeded to spend 10 minutes
explaining to me how 45000 zenon-atoms and 17 electrons conspired to
require just 2 bits to store the number 1000.... yes, i soon learned
what M.P.D. stands for. And on top of that, I have a cousin who is also
a complete newbie when it comes to computers and in fact, when it comes
to brain power he'll never be able to answer any of your questions but
boy.... does he ever know how to tell people what they want to hear....
he managed to hook in in the midst of the dot-com boom and makes a
living in the jungles of New York, he's still there today yet he can't
turn a computer on, never worked for a computer company in his life, but
he's considered a "computer consultant".... so much for 20 years of IT
experience and 50+ projects...

i'm not sure why the economy goes bust when ever a Republican gets into
office but boy let me tell you, I'm never complaining when a Democrat
gets in there.... bring me back the problems like 850,000 unfilled High
Tech jobs averaging $50 to $125 per hour each....

- perry

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


Jul 17 '05 #42
SP*********@BLO CKEDTOAVOIDSPAM .com (Spammay Blockay) wrote in message news:<c8******* ***@bolt.sonic. net>...
In article <t9************ *************** *****@4ax.com>,
MCheu <mp****@yahoo.c om> wrote:
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


So, I guess you're saying that you're a bit more lenient than the
wording suggests. A misplaced semicolon, a missing brace, or
brainfreeze on a necessary import line can make hand written code
uncompileable. As for IDEs, I didn't say anything about those. In
fact, because of the differences in IDE designs, plunking someone in
front of an unfamiliar IDE might be a bit sadistic.

-----------------
MCheu
Jul 17 '05 #43
SP*********@BLO CKEDTOAVOIDSPAM .com (Spammay Blockay) wrote in message news:<c8******* ***@bolt.sonic. net>...
The code must be syntactically correct, and would compile.

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,

Let's turn the tables a little, if I interview you and ask you to
write perfect Java code on a whiteboard to implement a Hashtable or
someother ADT you haven't implement for a while how would you go?

Cheers
Alex
Jul 17 '05 #44
The world rejoiced as perry <pe***@cplusplu s.org> wrote:
i'm not sure why the economy goes bust when ever a Republican gets
into office but boy let me tell you, I'm never complaining when a
Democrat gets in there.... bring me back the problems like 850,000
unfilled High Tech jobs averaging $50 to $125 per hour each....


You'll have to recreate the Y2K problem, where there is a need for a
vast phalanx of programmers to repair some massive problem. That's
what "President Bill" was able to benefit from...
--
"cbbrowne","@", "cbbrowne.c om"
http://cbbrowne.com/info/languages.html
Rules of the Evil Overlord #89. "After I captures the hero's
superweapon, I will not immediately disband my legions and relax my
guard because I believe whoever holds the weapon is unstoppable. After
all, the hero held the weapon and I took it from him."
<http://www.eviloverlor d.com/>
Jul 17 '05 #45
"perry" <pe***@cplusplu s.org> wrote in message
news:oA******** ************@ne ws20.bellglobal .com...

"How many bits does it require to store the number 1000?" Normally that
wouldn't be a problem but they way he asked it just caught me completely
off guard.


"Insufficie nt data" is the only really sensible answer.

If the requirement is to be able to distinguish between 1000 and 12312834,
those being the only two possible values for the parameter, then the answer
is one bit. If the parameter is *always* 1000, then then answer is no bits.
And so on.

--
Tim Ward
Brett Ward Limited - www.brettward.co.uk
Jul 17 '05 #46
Tim Ward wrote:
"How many bits does it require to store the number 1000?" Normally that
wouldn't be a problem but they way he asked it just caught me completely
off guard.
If the requirement is to be able to distinguish between 1000 and 12312834,
those being the only two possible values for the parameter, then the
answer is one bit.


Or indeed, if the potential values range between 0 and 1023, but 1000 comes up
a million times more often than any other...

(Assuming variable-length encoding, of course)

-- chris
Jul 17 '05 #47
In article <c8**********@b olt.sonic.net>,
SP*********@BLO CKEDTOAVOIDSPAM .com enlightened us with...

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.


So those of us who code in multiple languages and don't memorize the
syntax aren't "good programmers"?

In any given day, I might code in the following languages:
C, C++, Java, Unix KSH, ASP (JScript/VBScript), Javascript/HTML, PHP,
and/or Perl.
Forgive me for mixing up the different syntax sometimes.

--
--
~kaeli~
A bicycle can't stand on its own because it is two tired.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 17 '05 #48
In article <MP************ ************@nn tp.lucent.com>,
kaeli <ti******@NOSPA M.comcast.net> wrote:
In article <c8**********@b olt.sonic.net>,
SP*********@BL OCKEDTOAVOIDSPA M.com enlightened us with...

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.
So those of us who code in multiple languages and don't memorize the
syntax aren't "good programmers"?


If you apply to me for a job as a "Java Programmer", you'd better
know Java well, without syntax aids. If as a "C Programmer", the same
goes as well. I don't think that's too unusual.
In any given day, I might code in the following languages:
C, C++, Java, Unix KSH, ASP (JScript/VBScript), Javascript/HTML, PHP,
and/or Perl.
Forgive me for mixing up the different syntax sometimes.


You sound offended or something... is that the case?
Anyway, if I were interviewing you and you mixed up syntax
between languages, but caught yourself and could tell me
what language syntax you were getting mixed up, that would be
fine, too.

- Tim

--

Jul 17 '05 #49
In article <c9**********@b olt.sonic.net>,
SP*********@BLO CKEDTOAVOIDSPAM .com enlightened us with...
In article <MP************ ************@nn tp.lucent.com>,
kaeli <ti******@NOSPA M.comcast.net> wrote:
In article <c8**********@b olt.sonic.net>,
SP*********@BL OCKEDTOAVOIDSPA M.com enlightened us with...

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.


So those of us who code in multiple languages and don't memorize the
syntax aren't "good programmers"?


If you apply to me for a job as a "Java Programmer", you'd better
know Java well, without syntax aids. If as a "C Programmer", the same
goes as well. I don't think that's too unusual.


Perhaps not that unusual. I myself am a "jack of all trades", so to
speak, and code in whatever language I need to code in. I fix other
people's mistakes and modify other people's code as well as make my own
if the situation warrants it. I built an entirely new order tracking
system, complete with database, in a language I'd never before used
because my customer wanted it done in that language (which was Java).
And I do mean *I* built it - no one else worked on it with me. I also
admin the servers the applications run on if I need to.
I don't consider myself a "Java Programmer". I consider myself a
computer applications programmer. I graduated with a B.S. in Comp Sci,
not Java.
I can learn syntax. It's really hard to teach someone how to program
well if they don't have the right education, mindset, aptitude, desire,
and intelligence. But you can surely teach a good programmer a new
language.
In any given day, I might code in the following languages:
C, C++, Java, Unix KSH, ASP (JScript/VBScript), Javascript/HTML, PHP,
and/or Perl.
Forgive me for mixing up the different syntax sometimes.


You sound offended or something... is that the case?


Yes. I take exception to the implication that not memorizing syntax
makes people bad programmers. I consider myself an excellent programmer.
My code is stable, well-designed, "dies" well if the machine dies,
doesn't bring down the server if it has any exceptions, is organized,
easily modified, easily followed. Most importantly of all, my customers
are very happy with it.
There is much more to good programming than syntactically correct code.
Any compiler can catch syntax errors. It's those logic errors that will
kill you. Which you obviously know from your other posts.

I take no exception at all to your desire for a Java Programmer. ;)
I just really had a problem with that "good programmer" statement.
Sorry.

I'm going back to lurking and learning now. *grin*

--
--
~kaeli~
"No matter what happens, somebody will find a way to take
it too seriously."
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 17 '05 #50

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
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
10903
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
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
10290
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...
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
7015
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
5681
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
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
2
4063
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.