PDA

View Full Version : Interviewing someone today, need code questions.




detz
Mar 16, 2009, 09:02 AM
When I get interviewed I hate the brain teaser and algorithm questions and I want to test his ability to actual program so I would like to give him some simple functions in C, Perl, Php and Python and have him tell me the answers. Anyone have some simple but not to easy functions I could print out and have him solve?



dbell
Mar 16, 2009, 10:21 AM
Have him solve for D.

8=D(0)^8

lee1210
Mar 16, 2009, 11:04 AM
Have him solve for D.

8=D(0)^8

I might not understand the question, but shouldn't D just be:
double D(int dummy) {
return pow(8,(1.0/8));
}

Obviously there are some precision issues, but perhaps you meant something more general, like:
Write a function D such that D(X) raised to the power of X evaluates to X.

I may have also misinterpreted the problem. i read that as math, where ^ is exponentiation and = is equivalence. If = were assignment, 8 isn't a modifiable lvalue, so... no matter what D is, that's not compiling... unless...
#define D =
so after the preprocessor you got

8==(0)^8

which would evaluate to true...

If you meant bitwise XOR, but = is equivalence... then D just needs to return its argument, or always return 0.

Do i get the job? =)

-Lee

glossywhite
Mar 16, 2009, 11:16 AM
Ask them if they can disable 3D Dock, Dashboard and delete .plist files :D

ChrisA
Mar 16, 2009, 11:27 AM
Anyone have some simple but not to easy functions I could print out and have him solve?

What will this person do after you hire him. Will he be asked to write code for well defined "toy" projects like you might have handed to you in school. If so then give him some well defined functions and ask him to write some code. Do you really want to hire a person who can solve "simple but not to easy functions."

But just maybe you want a person who can think about the bigger picture and larger projects. This kind of person is far more valuable, likely older and will cost more. Projects fail not because coders can't write for loops and if statements it is because that is about all they know. You need people who know the subject domain backwards and forwards

During the interview ask questions related to what you want him to do. If that is solving toy problems then ask that. If it is to know how to build larger complex systems ask about how many of those he has built and if he has seen any big systems fail and how to avoid those issues.

Also you are trying to find team players, some one who can work with those you already have and at the same time brings skills you don't already have into the mix.

HiRez
Mar 16, 2009, 12:07 PM
Um...is it just me or is that ASCII "art" and not really a function at all? Or did I totally miss that Lee was onto it the whole time? :P

lee1210
Mar 16, 2009, 12:58 PM
I would also say, it would be better to present a realistic situation. If you've closed a bug recently that you consider "simple"... roll the code back to the revision before it was fixed, give them the steps to reproduce the bug, and let them try to fix it. Even if you don't have time to have them work through the whole thing, at least have them walk you through the steps they're taking. Is their first instinct to put in a print statement or fire up a debugger? Can they find the actual executing code, or are they stumbling around in the dark?

-Lee

savar
Mar 16, 2009, 01:55 PM
When I get interviewed I hate the brain teaser and algorithm questions and I want to test his ability to actual program so I would like to give him some simple functions in C, Perl, Php and Python and have him tell me the answers. Anyone have some simple but not to easy functions I could print out and have him solve?

I like to do the following:

1) Ask specific questions about languages and constructs
2) Ask high-level questions about technologies

I have interviewed a few people for a web developer position. For part 1 I ask questions like:

* What is the syntax to pass a variable by reference in PHP?
* What is the syntax for declaring a style for a class in CSS?

These are super-easy questions that the individual should answer correctly without hesitation.

For the second part, I ask general questions that don't necessarily have specific answers, but somebody who has intelligence and experience should be able to discuss the solution:

* What is the difference between HTML and XHTML?
* In MySQL, describe what an index is and a scenario in which you would use one.
* If you were designing an application that requires authentication, how would you store the password credential?

This is all applicable to web programming, but you could come up with similar questions for any language or environment.

Asking to write code an interview is tricky. The thing I like about my approach is that I can quickly understand the extent to which the person has actually grappled with the common problems in our programming domain. If they understand basic syntax as well as high level issues, that indicates to me experience, intelligence, and a genuine desire to be an expert in their field.

dbell
Mar 16, 2009, 02:08 PM
I might not understand the question, but shouldn't D just be:
double D(int dummy) {
return pow(8,(1.0/8));
}

Obviously there are some precision issues, but perhaps you meant something more general, like:
Write a function D such that D(X) raised to the power of X evaluates to X.

I may have also misinterpreted the problem. i read that as math, where ^ is exponentiation and = is equivalence. If = were assignment, 8 isn't a modifiable lvalue, so... no matter what D is, that's not compiling... unless...
#define D =
so after the preprocessor you got

8==(0)^8

which would evaluate to true...

If you meant bitwise XOR, but = is equivalence... then D just needs to return its argument, or always return 0.

Do i get the job? =)

-Lee

:p You're Hired.

For those wondering... The other acceptable answer is 8=D~(O)^8

glossywhite
Mar 16, 2009, 03:54 PM
:p You're Hired.

For those wondering... The other acceptable answer is 8=D~(O)^8

Wow :confused: that's a bit much for me, seeing as I'm only JUST starting to grasp OOP. haha.

lee1210
Mar 16, 2009, 04:14 PM
I think that was a little joke that i missed early on a monday morning...

-Lee