Time for another "interview question" post. We're in the process of hiring some programmers. Naturally, we go through the typical interview process and as them some questions to assess the Perl knowledge, but we're also interested in their programming knowledge. I've been somewhat disappointed with some of their answers, so I'm curious as to how Monks would respond to these questions and how you would change them. These questions are deliberately language agnostic as we're focusing on aptitude here.

1. The following code snippet works, but has been identified as a significant performance problem in a production program.

a. Why is it a problem?
b. What would you do to fix it?

foreach a_item in a_array foreach b_item in b_array if a_item equals b_item put a_item in c_array end if end for end for

The order of elements is not important.

2. Write a function (language of your choice) to do an in-place reversal of array elements. For example:

array = ( 'foo', 'bar', 'baz', 'cheeze whiz' )


array = ( 'cheeze whiz', 'baz', 'bar', 'foo' )

If the "language of your choice" has a built-in method for doing array reversal, disregard it.

3. Briefly sketch out how you would implement a program/system to handle multiple requests (perhaps from Web forms), query a database based upon the request and display the results. There are multiple request sources and multiple display formats.

Code is not required for this one. We're looking for how you would organize this.

I'd give a list of what we're looking for on these, but that would be giving you hints. Many of the programmers that we have interviewed have plenty of experience, but fail miserably when faced with the above questions, though they seem fair to me.


Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.