Go Back  Xtreme Visual Basic Talk > General Discussion > Tech Discussions > Interview Question


Reply
 
Thread Tools Display Modes
  #1  
Old 08-12-2002, 12:08 PM
quwiltw quwiltw is offline
Junior Contributor
 
Join Date: Sep 2001
Location: Washington, D.C.
Posts: 302
Default Interview Question


I have been using a particular question when interviewing developers for a while now and I've just been told that it's too hard a question. I totally disagree and think it's a basic concept that everyone should understand and be able to answer relatively quickly. Do you think it's unfair to expect an applicant for a Junior Software Engineer to do the following?

Implement a function accepting n and returning n! and it must be implemented recursively.

(It's not supposed to be an 8th grade math test so I willingly provide the definition of n! and provide 0! to 5! as examples to eliminate potential embarrassment.)

All I'm attempting to do is see if they can actually program and if they understand the concept of recursion. Anyone think this is an unfair expectation for a Junior Software Engineer? (Most are straight out of 4 years of college)
Reply With Quote
  #2  
Old 08-12-2002, 12:15 PM
lebb's Avatar
lebb lebb is offline
Disillusioned Code Poet

Retired Moderator
* Guru *
 
Join Date: Apr 2002
Location: Tennessee, USA
Posts: 12,808
Default

That sounds perfectly reasonable to me, and is in fact quite a bit simpler than the programming challenges I have been given in interviews.
__________________
Laura

Ita erat quando hic adveni.
Reply With Quote
  #3  
Old 08-12-2002, 12:20 PM
quwiltw quwiltw is offline
Junior Contributor
 
Join Date: Sep 2001
Location: Washington, D.C.
Posts: 302
Default

Thanks lebb, his main complaint was the demand of implementing it recursively. I've been trying to think of another non-recursive question, but it's difficult to find something that's sufficiently hard enough to make sure they can actually program but sufficiently easy enough so that they aren't sitting in my office for two hours trying to figure it out. If you've got any suggestions that are a good balance between the two I'd love to hear them.
Reply With Quote
  #4  
Old 08-12-2002, 12:27 PM
Memnoch1207's Avatar
Memnoch1207 Memnoch1207 is offline
Junior Contributor
 
Join Date: May 2002
Location: Guess! It's really HOT!!
Posts: 314
Default

I think the question is fine, it may be the way you phrase the question to the applicant, that gets them confused?

after all a recursive function is just a function that keeps calling it self (looping) until a condition is met. I would think that these college graduates would know this, but maybe not!
__________________
He who laughs last...Thinks slowest.
Reply With Quote
  #5  
Old 08-12-2002, 12:29 PM
BillSoo's Avatar
BillSoo BillSoo is offline
Code Meister

Retired Moderator
* Guru *
 
Join Date: Aug 2000
Location: Vancouver, BC, Canada
Posts: 10,441
Default

Much as I like recursion, you don't see too much of it outside of school. In production environments, the possible problem of a "stack overflow" reduces it's utility.

I wrote a simple function in Tutors Corner that might do the trick...

The title is "Recursively searching a Directory" but that code was lost in the forum shuffle. Instead, I had a NON-recursive version. You can ask them to write something like that:
http://www.xtremevbtalk.com/show...6990#post16990
__________________
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
Reply With Quote
  #6  
Old 08-12-2002, 12:32 PM
quwiltw quwiltw is offline
Junior Contributor
 
Join Date: Sep 2001
Location: Washington, D.C.
Posts: 302
Default

My wording is intentional. In the interview, my desire is not to teach recursion, but to tell them how I want it implemented and see if they understand. For example, if I wanted them to solve the problem with counter controlled loop, I wouldn't want to explain what a counter-controlled loop is.
Reply With Quote
  #7  
Old 08-12-2002, 12:36 PM
quwiltw quwiltw is offline
Junior Contributor
 
Join Date: Sep 2001
Location: Washington, D.C.
Posts: 302
Default

Thanks BillSoo, I do have that internal debate. It's kinda contradictory I suppose, in that, if they were ever required to implement n! "by hand" I'd be pretty ****ed if they implemented it recursively. On the other hand, asking them to traverse a BST is a bit more than I want to wait for in an interview. I just think it's a nice clean problem, that's relatively easy to implement.
Reply With Quote
  #8  
Old 08-12-2002, 12:37 PM
Thinker Thinker is offline
Iron-Fisted Programmer

Retired Moderator
* Guru *
 
Join Date: Jul 2001
Location: Fayetteville Arkansas USA
Posts: 18,127
Default

I agree it is a reasonable question, difficulty-wise, but my opinion
is recursion is only useful in specialized situations. By using a
question like this you might be implying that you expect
programmers to use it anytime it could be used, most of which
would create slower, more inefficient code. Now if this is just one
of many questions, and they otherwise get all the other ones
correct, you might still consider them for a junior position on the
condition they learn how (and when) to use recursion.

As to an alternate question, I think it should relate to the kind of
programming that they would normally be doing. For instance, if
the type of programming requires alot of string manipulation, then
a function that receives a string (and possibly some other params)
and returns a substring (making use of InStr, Mid$, etc.). If the
main programming is numeric calculation based, make the correct
function very dependent on proper variable types, including them
having to select the right types for the size and precision of the
params and result you need. If database programming is involved
make sure they have a clue about using SQL.
__________________
Posting Guidelines
Reply With Quote
  #9  
Old 08-12-2002, 10:01 PM
Robert Neilson's Avatar
Robert Neilson Robert Neilson is offline
Junior Contributor
 
Join Date: Apr 2002
Location: Newcastle
Posts: 289
Default

i dont see anything wrong with it and i am by no means qualified as a programmer
__________________
As technology develops, so does our imagination
Reply With Quote
  #10  
Old 08-12-2002, 10:12 PM
Robby's Avatar
Robby Robby is offline
Code Factory

Retired Moderator
* Expert *
 
Join Date: Jan 2001
Location: Montreal, Ca.
Posts: 5,565
Default

I was interviewed last week, 50 questions, most all were theory (very advanced) and very few had code.

I wish there was more coding on the quiz simular to yours (quwiltw)
__________________
Visit...Bassic Software

Last edited by Robby; 08-12-2002 at 10:37 PM.
Reply With Quote
  #11  
Old 08-13-2002, 06:40 AM
Mill Mill is offline
Just another Excel nerd

Retired Moderator
* Guru *
 
Join Date: Feb 2000
Location: Michigan, USA
Posts: 2,624
Default

I think that the question is fine, but I agree with Bill and Thinker that recursion is mostly just used in college. Plus, if you don't want them to use recursion while they're actually working for you, it seems a bit odd.

You could ask them to write some somewhat simple procedures, such as:[list=1][*]Write a function that takes a string as a parameter and returns the reverse of the string.[*]Write a function that takes a string as a parameter and determines if it is a (sorry, brain-freeze)... if the word reads the same forward and backward.[*]Write a simple encryption or sorting algorithm.[/list=1]
__________________
"The face of a child can say it all, especially the mouth part of the face." - Jack Handey
Reply With Quote
  #12  
Old 08-13-2002, 07:43 AM
quwiltw quwiltw is offline
Junior Contributor
 
Join Date: Sep 2001
Location: Washington, D.C.
Posts: 302
Default

Quote:
Plus, if you don't want them to use recursion while they're actually working for you, it seems a bit odd.
I didn't say that. I said I wouldn't want them to implement n! recursively. I *would* want them to know when a recursive solution was appropriate. There are a number of cases, such as when the data structure is naturally recursive (ex. tree-like) where it's a obvious fit. As I said, the only reason I use n! in my test is because it's simple, clean, and quick. Asking an applicant to do a traversal of an AVL tree (something more realistic) using recursion is a bit too much for an interview methinks.

BTW, It's called a palindrome and I like that one, I think I'll use it.


Thanks,
Reply With Quote
  #13  
Old 08-13-2002, 07:45 AM
Mill Mill is offline
Just another Excel nerd

Retired Moderator
* Guru *
 
Join Date: Feb 2000
Location: Michigan, USA
Posts: 2,624
Default

Quote:
Originally posted by quwiltw
BTW, It's called a palindrome and I like that one, I think I'll use it.
Thanks. It's been one of those days. LOL

If you want to make sure that they know about the concept of recursion, then I think it's an excellent question because it covers the most basic aspects of recursion (what to do in your base case, what to do otherwise) without needing a whole lot of extra brainpower.
__________________
"The face of a child can say it all, especially the mouth part of the face." - Jack Handey
Reply With Quote
  #14  
Old 08-13-2002, 07:50 AM
John's Avatar
John John is offline
Bit Flipper
 
Join Date: Feb 2002
Location: The Inner Loop
Posts: 5,550
Default

Quote:
Originally posted by Mill
...Write a function that takes a string as a parameter and determines if it is a (sorry, brain-freeze)... if the word reads the same forward and backward....
That is what I was thinking, similar to our recent palindromes contest.

Orbity
__________________
Subclassing|Magnetic Forms|Operator Overloading (VB2K5)|QuickSnip.NET

"These Patriot playoff wins are like Ray Charles songs, Nantucket sunsets, and hot fudge sundaes. Each one is better than the last." - Dan Shaughnessy
Reply With Quote
  #15  
Old 08-13-2002, 07:51 AM
Mill Mill is offline
Just another Excel nerd

Retired Moderator
* Guru *
 
Join Date: Feb 2000
Location: Michigan, USA
Posts: 2,624
Default

Quote:
Originally posted by Orbity
That is what I was thinking, similar to our recent palindromes contest.
Exactly. It's bad to have a Monday kind of morning on a Tuesday.
__________________
"The face of a child can say it all, especially the mouth part of the face." - Jack Handey
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->