Scripting exercises and tech interview theory?
October 17, 2011 1:28 PM   Subscribe

Help me prep as an applicant in an imaginary interview for a junior programming position centered around Linux shell scripts, PHP, and Python, with an emphasis on processing text and URLs (availability, routing, etc).

I can think of three kinds of answers that would be helpful:

1. Things you might look for as an interviewer that transcend language/OS minutiae (does the applicant make a checklist for complex questions? Does s/he restate the problem? etc.)

2. Simple problems for the imaginary applicant (me) to write out a solution for on the blackboard during the interview, such as:

Reverse a string
Reverse an array
Check if the first character of a string is a letter (etc)

3. More complicated, actually useful(ish) scripting problems that should take me no more than an hour or two to complete, such as:

Create an automated script that checks whether a website is available and logs that information
Create a cript to extract the content size information from a URL header
Create a script that removes duplicate lines from a text file with an arbitrary number of lines (etc)
posted by jsturgill to Computers & Internet (10 answers total) 2 users marked this as a favorite
 
Well in php #2 would be strrev and array_reverse
For checking a website availability you'd probably want to use curl and check the http response code. I dont have time to look up the specific code but you could google it in 5 minutes. After the curl call curl_getinfo() has all sorts of information you could use.
posted by missmagenta at 1:41 PM on October 17, 2011


...or were you asking for more questions/problems like those?
posted by missmagenta at 1:46 PM on October 17, 2011


Response by poster: I was looking for problems such as those to help me quiz myself on, not answers.
posted by jsturgill at 1:47 PM on October 17, 2011


You've seen the Guerilla Guide to Interviewing, right? He has his prospective coders do some tricky stuff involving recursion (and pointers, though that's probably irrelevant in this century.)
posted by modernserf at 3:51 PM on October 17, 2011


Response by poster: Yeah, I saw that. I also searched StackOverflow. They provided some excellent perspective.

I was hoping for at least some simple script/utility ideas to hash out as exercises and to cement my grasp of the Linux way of manipulating data. I feel like coming up with such tasks on my own would do little to illuminate my blindspots. Like a mini Project Euler, only focused on problems you might conceivably be asked to code or pseudocode a solution for during a job interview.
posted by jsturgill at 5:07 PM on October 17, 2011


Best answer: #3 For any given ask metafilter question Id, write a script that will output the best comment(s) to stdout. Make sure to try it on some random IDs too. Solve once with BASH/curl/grep and once with python for extra credit.

so:
$ ./best-comments 43242
That's so totally foo
OMG, I've never thought to bar before
$
posted by yeoldefortran at 7:45 PM on October 17, 2011 [3 favorites]


I like yeoldfortran's suggestion.
posted by tylerkaraszewski at 8:13 PM on October 17, 2011


Response by poster: Yes! Like that, yeoldefortran. More would be welcome.
posted by jsturgill at 7:10 AM on October 18, 2011


Read this book: http://shop.oreilly.com/product/9780596528126.do

And practice some things that might be useful on a Linux box:
Search for a username that matches a certain pattern and change the user id.
Find all of the files matching a certain pattern that have been changed in the last month and email them to yourself.
Find all of the variables that contain xyz in a code base.
The possibilities are endless, and it's a skill that most junior programmers/sysadmins seem to lack.
posted by brian o'blivion at 6:29 AM on November 6, 2011


Response by poster: Excellent suggestions. Thank you.
posted by jsturgill at 12:44 PM on November 7, 2011


« Older My ADD needs help can you...wait what was I...   |   On a safari to nowhere Newer »
This thread is closed to new comments.