Interview test......

  • Thread starter Thread starter Nicholls.Mark
  • Start date Start date
N

Nicholls.Mark

I want to set some simple coding tests for an interview....Joel
recommends (for C programmers)....

1. Reverse a string in place
2. Reverse a linked list
3. Count all the bits that are on in a byte
4. Binary search
5. Find the longest run in a string
6. atoi
7. itoa

I'm tempted to use 1....but it seems a little contrived....and 5 seems
reasonable.....
(unless people know of ways of shortcutting the test.....)

any other suggestions....

I obviously want to test ability rather than knowledge...so I don't
want things that is easy if you happen to know some obscure (or not)
method.....
 
Simple... Which test is closest to the task you are hiring the person to
perform within your team?
 
What exactly are you looking to get from the test? I ask because I'm not a
fan of this type of interview scenario.

Ability does not come from being able to write a snippet of code in an
interview - its usually faster to download a snippet off the web these days
as an example and code from that - and most good coders have a library of
common functions they refer to (like string reverse etc.).

Its not really a good assesment of whether someone can disseminate a
problem, work out a strategy to solving it, plan an approach to solving the
problem, design and implementing that strategy to completion. I actually
prefer to pass a flawed piece of code to a candidate and ask them to try and
identify the problem with it, based in given inputs and outputs - which is
more like the real world problem a coder will face daily. You can then
assess how they dealt with the problem and how they sought solution which
shows experience and ability much better.

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog
 
What kind of developer are you looking for?
A C# web-developer can work magic, without knowing how to complete any of
the tasks below.

Hehe, I think I can do Joels test in like a minute:
1. Use google
2. Use google
3. Why?
4. Use google
5. What?
6. old c stuff
7. old c stuff

Am I hired?

Jokes aside, having a dev actually submit the code says nothing.
And as far as I remember, Joel says that the answer is not important,
but how the dev thinks.

Instead of having the applicant give you the code for a binary search,
ask him/her what a binary search is, and if the applicant can explain
it to you, and tells you about Ordos(log2N),
the cost of having the list sorted and so on,
the applicant is probably a good hire.

My old trick is to show some of the code we are working on.
Except that the code is mined with stupid code in some places.
And while I talk about the code I look at the applicants reaction.
But you have to be carful making judgement, as the applicant may
be nervous and might not give critique as of politeness.

The key is to get the applicant talking about the code,
and while you promote bad code as being super smart,
if the applicant looks at you like you are a mad-man,
you have a good hire.

Also, it may be good idea telling the applicant you mined your code.
If the applicants leave still thinking you are a mad man, they probably
won't want to work for you anyway. =)

My 2 cents
- Michael Starberg
 
I want to set some simple coding tests for an interview....Joel
recommends (for C programmers)....

1. Reverse a string in place

public class Demo
{
public void Start()
{
Console.WriteLine(Reverse("I know how to reverse in .NET 3.5
*s*"));
}

string Reverse(string s)
{
var q =
(from c in s
select c).Reverse();

var sb = new StringBuilder();
q.ToList().ForEach(c => sb.Append(c));

return sb.ToString();
}
}

Oops, forgot about the 'in place' part of the task.
Guess I have to go unsafe or to solve task number 1
as strings are immutable in .NET. =)

- Michael Starberg
 
Hi,

I want to set some simple coding tests for an interview....Joel
recommends (for C programmers)....

1. Reverse a string in place

This is good in C, not work in C#, string in C# are inmutables. But you can
ask that and if the answer is other than a stare look like "what r u
talking about" he does not know it.

Recently I got in a similar situation I was asked to implement a tree
structure. The code itself was useless, but it gave to a good conversation
of why/how to implement the stuff. How to test it, etc. so in resume the
test itself was not important, the answers derived from it were the
determinant criteria.
 
My old trick is to show some of the code we are working on.
Except that the code is mined with stupid code in some places.
And while I talk about the code I look at the applicants reaction.
But you have to be carful making judgement, as the applicant may
be nervous and might not give critique as of politeness.
....
- Michael Starberg

Isn't that a little dangerous? If someone showed me the code that
they said was what they were working on and it was lined with stupid
stuff, my first reaction would be to appologize for waisting their
time and leave. :-)

Sam
 
Samuel R. Neff said:
Isn't that a little dangerous? If someone showed me the code that
they said was what they were working on and it was lined with stupid
stuff, my first reaction would be to appologize for waisting their
time and leave. :-)

Sam

Well, they key is to notice that and explain that the code was mined.
Also, to get the applicant talking. Show that you want critique and talk
about code.
What applicant would start of by saying that the interviewers code sucks?
You need to invite them into a conversation about code.
You need to be nice.

From what I can tell, and from the dudes and gals that got hired as coders,
sitting in front of a computer and talk about code,
was an important factor for them when they took the job.

They liked that, they felt comfortable with that,
instead of being crammed in a conference room
and reply to silly questions.

But it is a little dangerous, and it is important to stay low,
as you are not just hiring, you are selling something,
a workplace.

So let the applicant talk, and not be a bigot, like:
- This is my cool code, I am supercool and you just an applicant newbie.

That would make anyone appologize for waisting their time and leave.
I'd wouln't even apologize. I'd laugh.

But Sam, wouln't you be comfortable sitting around talking about C#,
perhaps comparing it to C++, Java and Delphi, and see actual code,
and by so get proof that your co-workers code won't wind up on
worsethanfailure/dailyWTF =)

- Michael Starberg
 
Michael Starberg said:
Jon Skeet;
I expect you to use this code and write an article on premature
optimization.
Maybe you can publish it on your excellent website, April 1. =)

LOL. No, interview code is often pointless for anything other than
finding out about the candidate.

I had a Java test I gave which had about 35 problems in about 60 lines
of code. Some of the problems were obvious, some weren't. I converted
it to C#, but lost my favourite problem (String.Split in Java uses a
regular expression, and the idea was to split on a dot - so it had to
be escaped).

There are lots of different kinds of coding tests, of course...
 
Hehe.

If you ever applied for a new job,
all you have to do is submit your webpage,
- Any questions?

You are a inpiration for all of us

But back to our first guru, Joel on software,
his c programming tasks are pure c oriented.
Perhaps good if you are hiring a nerd that is supposed
to code embedded systems in microcode,
or an os-kernel.

But what would be good C# questions?
Being inspired by you and this usenet channel,
I think I would want to know and ask a see-sharper:

1. What are events and tell me about delegates.
2. What does internal protected mean, and have you ever used it?
3. What is the difference between overriding and reintroducing?
4. What is the PME-model?
5. How many pages would you need to write a paper on threading in .NET? *s*
6. What is Linq?
7. What is generations in the garbage collector, and how does it work?
8. What is IDisposable and why do .NET rename the OO-term 'destructor' into
'finalalizer'?
9. Tell me about generics and co/contra-variance.
10. What is Ordos?
11. What are normal forms in a relational database?
12. How should you comment your code?

This summer, I got 'upgraded' from MCAD to MCPD.
I took me three tries until I passed the exam,
and got my new nifty certificate.
While non-MCAD can take 2 tests and become MCTS,
I had to take three tests at the same time.
88 random questions from a 700 question bank of stupidity.

Not one question asked anything about the 12 bullets above.
Stupid test. I remember one question boiled down to
if I should call Assembly.Load() or Assembly.LoadFrom().
The correct answer was Assembly.LoadFrom()
as there are no static Assembly.Load() metod
on the Assembly class. Tjeesus.

Hello??? Am I supposed to know these things by heart?
I think not. I installed the gigabytes of MSDN for a reason,
and I know how to press F1, or use intellisense,
when I want to load an assembly in runtime.

Another question I remember was about instrumentation,
and I got to learn that I should not instrument on a daily basis,
nor stop using it, but the correct answer was to instrument
according to the maintanance plan. WTF?

It took me three tries to pass the exam, and every time
I tried, it felt surreal. What is it Cypher says in the movie The Matrix?

- Buckle up Dorothy, 'cause Kansas is going bye-bye.

This is why I downplay my MCPD certificate.
as it only shows that I can remember facts good enough
to pass a microsoft exam.

It says nothing, about my coding-skillz nor anything of
my skillz in system development and design. Or anything
about me not knowing how to spell skills correctly.

If an applicant came to me and started bragging about his
MCPD status, I'd end the interview with a laugh.

- Michael Starberg
 
Michael Starberg said:
If you ever applied for a new job,
all you have to do is submit your webpage,
- Any questions?

You might be surprised, actually...
You are a inpiration for all of us

But back to our first guru, Joel on software,
his c programming tasks are pure c oriented.
Perhaps good if you are hiring a nerd that is supposed
to code embedded systems in microcode,
or an os-kernel.

Well, there's more to it than that - there's seeing how someone thinks
and solve problems. That doesn't show you their object orientation
skills, but it shows a few interesting things.
But what would be good C# questions?
Being inspired by you and this usenet channel,
I think I would want to know and ask a see-sharper:

1. What are events and tell me about delegates.
2. What does internal protected mean, and have you ever used it?
3. What is the difference between overriding and reintroducing?
4. What is the PME-model?
5. How many pages would you need to write a paper on threading in .NET? *s*
6. What is Linq?
7. What is generations in the garbage collector, and how does it work?
8. What is IDisposable and why do .NET rename the OO-term 'destructor' into
'finalalizer'?
9. Tell me about generics and co/contra-variance.
10. What is Ordos?
11. What are normal forms in a relational database?
12. How should you comment your code?

Ha - you have high standards. If someone can tell me the different
between a value type and a reference type, what the "using" statement
is for, and when they'd use StringBuilder, they're better than most
candidates. Sad, isn't it?

To be honest, what I look for in a candidate is a spark (once I've
satisfied myself that they're at all competent). The questions that are
appropriate to find that spark are open-ended, and depend on the
experience of the candidate, but things like:

o What do you like most about C# 2 over C# 1?
o What would you change in C# if you could?
o What benefits does C# have over Java and vice versa?

If an applicant came to me and started bragging about his
MCPD status, I'd end the interview with a laugh.

Agreed. People could claim I'm biased though, never having taken any
certification myself :)
 
I find this very interesting Jon.
Great way to spend a saturday night.
(23:29 in sweden now, 00:26 when finished)


Jon Skeet said:
You might be surprised, actually...

... that you work for Apple,
and are working on the macintiosh core in RISC-assembler? *s*

CISC = Complex Instruction Set Computer
RISC = Reduced into Silly Code
Well, there's more to it than that - there's seeing how someone thinks
and solve problems. That doesn't show you their object orientation
skills, but it shows a few interesting things.

And communicate a solution, or a problem.
While I am not a great fan of eXtreme programming,
being able to communicate, and work with other people,
is much more valuable in my business, than actual coding-skillz.

Back in the old days, Joels test was cruical for knowing if
a coder was worth hiring. But for C# and Java, and also for C++,
I think the business of system development has moved from magic,
and personal coding-styles,
into mature best practices.

So if a dev wants a job, you can expect that he or she has the skill
to write good code. If not, they comform and learn really fast.
Ha - you have high standards. If someone can tell me the different
between a value type and a reference type, what the "using" statement
is for, and when they'd use StringBuilder, they're better than most
candidates. Sad, isn't it?

Well, I'd say way too high standard.
I would not actually ask those questions at an interview,
or not so many questions at one session,
as it would probably just make the coder feel uncomfortable,
and we can't have the interview take 3 days, now can we? *s*

So maybe my bullets above is something that any see-sharper should ask
themselves.
Heck, I'll try that next time we need a .NET developer.

- These are my 12 questions that I need you to think about when you work
here.

- Do you find them interesting or boring? If the latter, you don't want to
work here.
To be honest, what I look for in a candidate is a spark (once I've
satisfied myself that they're at all competent). The questions that are
appropriate to find that spark are open-ended, and depend on the
experience of the candidate, but things like:

Yes. The spark!
That is excactly what I am looking for when interviewing a candidate,.
I refer to the old idiom of:
- Nothing is easy or hard, just fun or boring, or not worth the effort
learning.

This is also why the original post, and this whole thread started
out wrong, or from the wrong perspective;
as it started with a bias of trying to weed out bad coders,
while most coders really wants to do a great job.

- Managing programmers is like herding cats!

While that statement is all so true, *s*
Programmers today are really great cats.
They really wants to do The Right Thing(tm).

If they are newbies, and you correct them, like:
- While a public field is not as bad in C# as in Java, it is still better to
use a property.

... my experience is that people listen to such advice, or call it a militant
order,
and you won't see a public field in the coders code no more.

I default to think coders are proud of their work,
but want to improve themselves, always!

I call that the spark!

But now I am going to answer your questions below.
o What do you like most about C# 2 over C# 1?

- Generics! That made C# a complete and mature language.

I'd also says C# 3 outshines C++,
while C# 1 is a poor excuse for a Java/Delphi langauge.

I had a breif conversation with a C++ dude,
that said that C++ will revive the c keyword of 'auto' to be like 'var'.
Anyone know more on this?

If C++ is following C#,
I know I am coding in the best language ever invented!
o What would you change in C# if you could?

Being able to have multiple indexers.
the this[int i] property thingy is just a silly restriction.
VB.NET can have multiple indexers, Delphi has them.

Sporting a Items[string s], Items[int i], Items[MyType mt] makes
for some complex nested inner classes,
that is simplex as in Java, and not simple as in C#.

Also, the old famous with keyword.
Coming from Delphi, and have been forced to do some VB,
I think a with-keyword would not hurt.

I know you don't like the keyword Jon,
but why not have it, and if you don't want it, then don't use it.
It is as simple as that. =)

And the benefit would be scope, and better intellisense.
If I can work with an object, using the with-keyword,
Intellisense could sport pme on that object,
and not the entire .net framework

You get something like that with initalization in C# 3.0,
but why not go the full monty and give us the with-keyword.
o What benefits does C# have over Java and vice versa?

PME!

I have been following Anders Hejlsberg sinse Turbo Pascal.
That is why I learned most of the .NET framework, in like a week.
I know and can code Delphi very well!
Microsoft bought the entire VCL for $125 mill,
if I remember correctly. Part of that was other patent-infringements.

But Whooops, now I am see-sharper, that was easy. =)
Any other Delphite reading this that also thought .NET was easy to learn?

- You should have a look at Delphi Jon,
as that would give you some insights
of the Homo Neanderthalis of C#. *s*

But if I remember the rumours correctly,
Anders stole/borrowed the idea of PME from
Visual Basic and COM.

PME:
- Properties
- Methods
- Events

I read an article/interview where AH says everything is sugar,
and he says that while Javaits don't think you need property and events,
then by slippery slope, you don't need the keyword class neither,

Not correct qoute by me
(using my poor memory)
(and I am pretty sure AH didn't use the word Heck *s*)

var ah = @"
Heck, we could do OO in pure c or assembler.
But rolling out your own VMTables would be simplexity, not simplicity
";

That is what I love with C#: The simplicity aspect.
While Java can only do simplexity.

I found the link, but let the above qoute stand, as a summary

http://www.artima.com/intv/simplexity.html
Agreed. People could claim I'm biased though, never having taken any
certification myself :)

Trust me, you don't need no stinking certificate.
Also, your MVP makes other MVPs read books, to try catch up. =)

But what I think most people love the most about you,
is your humble way of dealing with simple and simplex questions
in a nice low key, caring way.

What we don't like about you, and even hate,
is that you are seldom wrong.

Please make a post where you make a complete tit of yourself,
so lesser beings can go: - Ha! I corrected Jon Skeet.

=)

With Love
- Michael Starberg
 
There are lots of different kinds of coding tests, of course...

I would never take a coding test.
If they want to hire me, then I ask for a offer.

If they ask for a code-example a la Joel,
we start out with a breach of trust, and per so,
I don't want the job.

This thread is stuck on hiring.
Real programmers don't get hired,
they pick where to work.

And so I flip the entire thread from heads to tail,
and using a Kennedy metaphore,

"Instead of asking what a coder can do for you,
ask what your company can do for the coder"

A happy coder is a bug-free coder. =)

- Michael Starberg
 
John Timney (MVP) said:
What exactly are you looking to get from the test? I ask because I'm not
a fan of this type of interview scenario.

Ability does not come from being able to write a snippet of code in an
interview - its usually faster to download a snippet off the web these
days as an example and code from that - and most good coders have a
library of common functions they refer to (like string reverse etc.).

Its not really a good assesment of whether someone can disseminate a
problem, work out a strategy to solving it, plan an approach to solving
the problem, design and implementing that strategy to completion. I
actually prefer to pass a flawed piece of code to a candidate and ask them
to try and identify the problem with it, based in given inputs and
outputs - which is more like the real world problem a coder will face
daily. You can then assess how they dealt with the problem and how they
sought solution which shows experience and ability much better.

I agree with this assesment.

There are really two skills in computer science: theory and practice.
Theory is knowing what linked lists are, what btrees are, various sorting
methods (and appropriateness of for use), etc. At the theoretical level, I
really don't care if someone can code a linked list, all I care about is
that someone knows how to traverse it. Pseudocode in this case is very
appropriate. I don't want someone to be writing a 2 page function to do a
simple string comparison. Really, though, I want to find out about thought
process more than anything else....

On the other hand, if someone claimes to know the C language, I usually ask
someone to examine a very optimizedfunction in C and ask them under what
conditions it will fail (it's really obvious: there is no argument null
check nor any bounds checking.)

We have situations where it is necessary to be able to at least debug our
legacy code to find issues in current code. I can't tell you how many times
I have had someone who claimed to have C++ experience on their resume but
couldn't tell you the meaning of the word "friend".

My view: If they claim to have experience in a language on their resume, I
will ask them at least 1 question on the syntax of the language. I.e. If
they claim to know VB, will ask them a question about a block of code that
won't compile (because it's missing a '_') I will tell them it's not going
to compile and ask them *why*. That way they can focus on the fact that
it's a syntax problem. I will ask them about include files for "C". You
can find out ALOT about a person just by seeing if they REALLY know what
they claim to know,

<vent>
I can't stand coworkers who are too lazy to debug libraries written by
someone else in the software group to find a root cause and just give the
"owner" of the library an email saying "I got an exception in your library".
Without any other information (including stack trace, inputs and function
call order...sometimes it's as simple as a friggin missed null pointer input
check!) it is next to impossible to figure out the problem...and the
originator is in a better place since he knows exactly what he DID!
</vent>


--
Doug Semler, MCPD
a.a. #705, BAAWA. EAC Guardian of the Horn of the IPU (pbuhh).
The answer is 42; DNRC o-
Gur Hfrarg unf orpbzr fb shyy bs penc gurfr qnlf, abbar rira
erpbtavmrf fvzcyr guvatf yvxr ebg13 nalzber. Fnq, vfa'g vg?
 
Excellent post!
I'll ponder on this and give my 1 cent after some sleep

- Michael Starberg
 
(I'll reply to the longer post when I've got more time.)

Michael Starberg said:
I would never take a coding test.
If they want to hire me, then I ask for a offer.

I don't think I'd ever go that far. I applied for my current job like
anyone else would. I've had a few jobs specifically offered to me, but
really not very many at all.
If they ask for a code-example a la Joel,
we start out with a breach of trust, and per so,
I don't want the job.

I think it's reasonable not to trust CVs too far. I've seen a *lot* of
rubbish talked about on CVs. I'd never assume that someone can code
well just because they claim they can. Of course, if they've got sample
code on the net etc, that helps - but it's better to see someone in
action.
This thread is stuck on hiring.
Real programmers don't get hired,
they pick where to work.

Well, they still have to go for an interview - at least round here.
There was certainly no guarantee I'd get my current job.
And so I flip the entire thread from heads to tail,
and using a Kennedy metaphore,

"Instead of asking what a coder can do for you,
ask what your company can do for the coder"

A happy coder is a bug-free coder. =)

Well, I'd settle for "a happy coder is a more productive coder" :)
 
Jon Skeet said:
I don't think I'd ever go that far. I applied for my current job like
anyone else would. I've had a few jobs specifically offered to me, but
really not very many at all.

Maybe because the recruiters know you spend all your time here,
and are writing a book on top of that. *S*

But I get the feel that you are 'richer' doing that,
than any silly job-offer might offer.

I think it's reasonable not to trust CVs too far. I've seen a *lot* of
rubbish talked about on CVs. I'd never assume that someone can code
well just because they claim they can. Of course, if they've got sample
code on the net etc,

Nice self-promo
that helps - but it's better to see someone in action.

Double-promo.. Jon is on a killing-spree=)

As usually, jokes aside.
I do indeed like when people go:
- I code in this or that open source project
- I written this about techX on my blog.
Well, they still have to go for an interview - at least round here.
There was certainly no guarantee I'd get my current job.

Well sure.
I was not trying to say that it is the byers market.
Especially not in Sweden.

I was doing this from the employers perspective.
It is easy to hire someone,
but how do you get him/her to stay onboard?

Even if we would adopt slavery,
that would make hiring easy.
I know this for a 'fact',
as I play Civilization 4 way too much.

I am thinking of a dilbert strip where the
PHB points at some area of dilberts monitor
and goes: - Type some good code right there!

Well, I'd settle for "a happy coder is a more productive coder" :)

Hmm. Not really.
Productivity goes down,
but Effectivity goes up bigtime.
The overall Quality tends to be excellent.

I think we are looking for the word 'gumption',
and I cannot help to think about Zen and The Art Of Motorcycle Maintenance

- Michael Starberg
 
Michael Starberg said:
Maybe because the recruiters know you spend all your time here,
and are writing a book on top of that. *S*

But I get the feel that you are 'richer' doing that,
than any silly job-offer might offer.

Yeah - I'm very happy doing what I'm doing. I've always enjoyed having
a normal career and a side-line in community work and "extras" like the
book.
Nice self-promo

Not intended, I assure you - but when I get a CV, I always try to look
the person up on the net.
Double-promo.. Jon is on a killing-spree=)

Not at all - by "in action", I mean "coding in front of you". If you
only ever see finished code, you've no idea how people think, how they
solve problems etc. The approaches rejected can be just as important as
the final approach taken.
As usually, jokes aside.
I do indeed like when people go:
- I code in this or that open source project
- I written this about techX on my blog.

Yes - I hear that kind of thing far too rarely :(
Well sure.
I was not trying to say that it is the byers market.
Especially not in Sweden.

I was doing this from the employers perspective.
It is easy to hire someone,
but how do you get him/her to stay onboard?

I'd say it's easy to hire someone, but hard to hire someone *good*. I
rarely see a CV which immediately says to me, "Yeah, that's someone
with a spark."

Hmm. Not really.
Productivity goes down,
but Effectivity goes up bigtime.
The overall Quality tends to be excellent.

I view productivity as an overall package - not "lines of code written
per day" but including quality and maintainability.
I think we are looking for the word 'gumption',
and I cannot help to think about Zen and The Art Of Motorcycle
Maintenance

Ah, quality...
 
A happy coder is a bug-free coder. =)


Every time I hear this i think of the old saying:

Every multiline program can be reduced by at least one line.
Every program has at least one bug.
Therefore, every program can be reduced to one line that doesn't work.

(I think that was from an old unix qotd daemon...)

Boy...this thread got hijacked didn't it <g>


--
Doug Semler, MCPD
a.a. #705, BAAWA. EAC Guardian of the Horn of the IPU (pbuhh).
The answer is 42; DNRC o-
Gur Hfrarg unf orpbzr fb shyy bs penc gurfr qnlf, abbar rira
erpbtavmrf fvzcyr guvatf yvxr ebg13 nalzber. Fnq, vfa'g vg?
 
Back
Top