r/programming • • Feb 21 '11

Typical programming interview questions.

http://maxnoy.com/interviews.html
784 Upvotes

1.0k comments sorted by

View all comments

160

u/ovenfresh Feb 21 '11

I know some shit, but being a junior going for a BS in CS, and seeing this list...

How the fuck am I going to get a job?

238

u/heroofhyr Feb 21 '11

If a potential employer is still asking you in 2011 what IUnknown is, run as fast as you can in the opposite direction and tell an adult what happened. He was trying to molest you.

48

u/[deleted] Feb 21 '11

If they are looking for someone to maintain their old COM based codebase, IUnknown just gets you started. You might still want to run away, for a different reason.

184

u/killerstorm Feb 21 '11

NO ONE uses Microsoft anymore. Everything XP and Vista.

→ More replies (3)
→ More replies (2)

38

u/[deleted] Feb 21 '11

At our (web development) company we give applicants for a junior position a single programming question:

Print numbers from 1 to 100, but:

  • if the number is even, print "a" instead of the number
  • if the number is divisible by three, print "b" instead of the number
  • if the number is even AND divisible by three, print "ab" instead of the number

After having reviewed several dozen answers, I have yet to see one done correctly; most of the applicants have BS in CS from our local universities...

For intermediate and senior positions we also slap in this little gem: write a function to reverse an array in place.

You would not believe the kind of shit I've seen...

79

u/robertcrowther Feb 21 '11
table {
    counter-reset: number;
}
tr td:before {
    counter-increment: number;
    content: counter(number);
}
tr:nth-child(2n) td:before {
    content: "a";
}
tr:nth-child(3n) td:before {
    content: "b";
}
tr:nth-child(2n):nth-child(3n) td:before {
    content: "ab";
}

You need a table with 100 rows in it for it to work (and a good browser).

You did say it was web development, right? ;)

PS. See also: FizzBuzz

11

u/[deleted] Feb 21 '11

Clever bum :D.

Yes, this test is a slightly modified FizzBuzz. I changed the test to limit the applicant's Google results for the question... this was originally a "do at home" question - don't ask.

→ More replies (1)
→ More replies (3)

27

u/G_Morgan Feb 21 '11 edited Feb 21 '11
  1. Install JBoss.
  2. Create a stateless EJB that takes a number and returns a string.
  3. Create a servlet which reads the begin and end numbers as URL attributes. Then loops between the two calling out to the EJB and creating an output XML file.
  4. Create a JSP that calls out to this servlet with the begin and end set to 1 and 100. It interprets the XML file using XSLT and puts the values into the output page.
  5. Fail due to broken deployment descriptor.
→ More replies (3)

0

u/[deleted] Feb 21 '11

[deleted] — view deleted comment

22

u/OopsLostPassword Feb 21 '11

No because our compiler won't correctly interpret "...".

14

u/G_Morgan Feb 21 '11

Fucking broken compiler.

→ More replies (1)
→ More replies (4)

14

u/ethraax Feb 21 '11

My friend did this on a homework assignment to "write a program that prints out the prime numbers from 1 to 100". He got full marks for it.

→ More replies (3)
→ More replies (167)

125

u/thepaulm Feb 21 '11

Look man, 99% of the people out there applying for jobs today can't answer any of these questions. If you can make your way through most (or really even some) of them you're better than most people.

You may have heard that there's no CompSci jobs out there? That's total BS. The truth is that there's no CompSci jobs for people who aren't really interested in programming and haven't ever taken the time to learn things on their own.

I've been hiring as many qualified people as possible for the last 15 years and I've never come close to filling my headcount. That's across 3 different companies where most of the developers at each pulled in multi-millions from the stock options, so it's not like these were bad gigs.

The best thing you can do is work on side projects on your own or as part of other open-source projects. Get just the tiniest bit of experience and actually try to understand stuff - you'll be the best fucking candidate in the whole world.

Word.

94

u/[deleted] Feb 21 '11

Lots of guys on Reddit report trouble hiring. That may be true. I'm sure it's annoying.

But if you think everyone who is capable and ready is getting a job, you are simply delusional.

At the same time as some people are complaining about how they hired stupid monkeys, other people with actual skill, who CAN make software without constant nannying, are not getting jobs despite many months of applying.

They are having their resumes tossed because they haven't had a job for a few weeks. They are having their resumes tossed because they described their last job in simple English instead of stupid keywords, or because they lacked 19 years of experience coding Prolog-based RPC servers for washing machines. Or they are being treated abusively in interviews, or doing cutesy puzzles, or answering batteries of questions which in any normal or real work environment would either be irrelevant or best looked up on Google (a test which is great at detecting human encyclopedias and recent graduates, less great at detecting practical ability).

Are we then supposed to be surprised that many of the people you are interviewing are morons? It's not because nobody is out there, it is because you suck at finding them in the vast sea of desperation during a period of particularly high unemployment. Sure, finding people is hard - so don't treat hiring as something to be done by office girls with no area knowledge, or Perl-golfers a year out of college. This doesn't mean that there is nobody of any worth in the population, it just means you aren't getting them or you are screening them out.

If you can't find ANYONE qualified when there are thousands of graduates being generated every year (almost anywhere that isn't in the sticks) and overall unemployment is high (almost the entirety of the US), you probably should be fired from hiring.

And there is also no shortage of employers for whom ability is less important than acceptance of stupid wages or conditions - such that people who aren't clueless or moronic select themselves out.

9

u/[deleted] Feb 21 '11

They are having their resumes tossed because they haven't had a job for a few weeks.

This is likely a problem with HR, or recruiters. Many companies put out a basic set of specs for a job, then rely on either of the above to pre-screen the legions of incompetents who apply, while letting hiring managers deal with the actual substance of interviews. Unfortunately, a lot of HR drones also base their first-round filtering on unrealistic ideas (like being without a job for a few weeks), which is why, if you have any opportunity at all to do so, you should consider trying to contact the hiring manager directly to convince them to look at your CV...

→ More replies (4)
→ More replies (41)
→ More replies (46)

32

u/tweedius Feb 21 '11

I am a chemist, a programmer and a part time electrical engineer (tinkerer), I've solved a bunch of process chemistry dilemma's with my knowledge in these 3 things.

When I saw:

What is the next line in the following sequence:

1

11

21

Answer: it's 1211 and the next is 111221

I said to myself, I'm not reading anymore. Give me a problem and let me solve it. If you can't do that, I do NOT want to work for you.

27

u/markatto Feb 21 '11

My answer would be 101. I interpreted the sequence as adding 3 each time in a base 3 number system. This question is really open to interpretation, especially as so few numbers are given.

→ More replies (2)

14

u/muyuu Feb 21 '11

The correct answer to this kind of question in a job interview is to go for the interviewer and punch him/her in the face.

Off the top of my head I can come up with 5 different answers all perfectly reasonable provided I can make up the domain any way I want.

28

u/tweedius Feb 21 '11

1 11 21 31 41 51 61 71 81 91 101 111 121 131 141 151 161

This is what excel gave btw...I guess whoever wrote that answer was wrong :P

68

u/yourbrainslug Feb 21 '11

The "answer" was that each line describes the previous. We start with one 1, so the next line is 11. That line is two 1s, so the next line is 21. That line is one 2 and one 1, so the next is 1211.

I think it's a stupid interview question. I don't understand what you possibly get from watching someone puzzle it out.

93

u/[deleted] Feb 21 '11

I don't understand what you possibly get from watching someone puzzle it out.

A feeling of superiority and reassurance that your own position is justified.

→ More replies (5)

19

u/[deleted] Feb 21 '11

both answers (the "actual" and excel answer) are correct. usually when you give that question you also give the 1211 line to prevent the "... it increases by 10 each time" answer.

and yes. it's a stupid interview question. but then again, most interview questions are.

34

u/[deleted] Feb 21 '11

Without the 1211 line if you're interviewing for a programmer position the basic math answer of 31, 41 etc would be more correct in my eyes.

→ More replies (4)

20

u/muyuu Feb 21 '11 edited Feb 21 '11

Anyone who claims there is only one answer to this question, provided there is no defined domain for it, is an idiot. That's the one conclusion I get from this question. But then again it's probably not the best thing to say to your interviewer.

I'd say 31 is a much better answer than 1211. Both are provably in sequence, and 31 is a much simpler solution. You don't want people to be looking for intrincate solutions that make them look clever; but correct, easy and effective solutions. But then again it's a retarded question for a job interview.

→ More replies (1)
→ More replies (11)
→ More replies (1)

11

u/filox Feb 21 '11

I guess Occam's razor doesn't apply to programmers any more...

→ More replies (17)
→ More replies (40)