Coding exercise for Linux Systems Admin?
Solution 1:
I don't think data structures, algorithms or sorting questions apply to me role?
Why don't you think that? Mabe not knowing the differences betwen O(n) and O(1) and O(log n) but writing good code - and scripts are code - definatly needs a basic understanding of those three things.
When I intervied for my current job I was asked at least the below quesiotns (I may have forgotten some) I was allowed to use the language of my choice.
- FizzBuzz
- Givin four points and a co-ordinate determine if the co-ordinate is inside or outside the square/rectangle
- Givin a list of names and test scores how would you find who got the high score and average. The test could be retaken so there may be more than one entry per name, only count their high score. How would you find the high score for a particular student.
Some sysadmin specific things:
- How would you search a 100GB log file for entries matching $Pattern?
- Given a list of 1000 people containing: First Name, Last Name, Department and phone number how would you add these people to $Dirctory or $10 *nix servers w/o a central auth system?
- How would you correlate an error event with related logs in 3 different log files?
- How would you convert a log file into a MySQL Database with Structure given to you? How would you change the structure of the database?
Solution 2:
I don't like interviews to feel like exams. It should be more about figuring out if the person is overall a good fit for the position and for the organization, and not so much about putting the interviewee on the spot. Now, sure, a good sysadmin has to be able to whip up a useful script under pressure, but it's not the same kind of pressure.
Therefore, rather than asking a series of questions, I'd be more inclined to chat a bit about scripting language preferences, culture, and so on. (This should be particularly effective for Python, Perl, or Ruby!) Generally, this should be enough to get a feel for the interviewee's engagement with the language or languages of choice, which is more important than the ability to answer some carefully-selected clever question right there on paper.
You can always ask for sample scripts to be e-mailed after the interview. (And then you can Google bits of the code to see if it's plagiarized....)
Solution 3:
In my experience sysadmin questions in interviews tend to often be based on file processing. For example, "take this logfile and extract the unique IP addresses along with a count of each" is something I was asked in an interview not too long ago.
The FizzBuzz test remains one of favorite programming questions too.
Solution 4:
Other folks have provided some great examples of exercises you might encounter, so I'll leave that as handled. I want to mention, though, that as important as getting the code running is making it maintainable - this is maybe more important in sysadmin-land than anywhere else, since we're the kind of people who tend to write a script and then forget about it for years until something breaks it, unlike application developers who spend a lot of time in close contact with their codebase and can get used to its idiosyncrasies. I've hired for sysadmin positions, and that clarity is something I look for in code samples.
Intelligible variable names following a consistent naming scheme; sufficient commenting; separating configuration from code (a lot of my perl-programming coworkers have the very bad habit of storing their script configuration in big comma-delimited inline string scalars, a typo in which turns what should have been a warning into a full-on messy die); etc. I heartily recommend Damian Conway's 'Perl Best Practices' as a reference in this area. Hope it helps; good luck with your interview!