A while back I posted a missive requesting help with code exams, not being a CS or IS major and was glad to receive much help and many useful suggestions. I thought I'd share without the results of my now vast experience ;-) and thank those who gave me such good advice.
- Courtesy of perlmonks Guildenstern, arhuman and tinman I was told to know the syntax and get a 'feel' for the language.
- mothra and r.joseph told me to get to grips with some of the algorithms I might be asked.
- masem told me to seek the ancient wisdom distilled from past exam papers.
Much of what I was told, and indeed what I will relate below, applies to any exam but some, of course, is code-related.
- Know thy enemy, or more correctly know thy friend: Study the syntax of the language. Is it like C, Pascal or (perish the thought ;-) BASIC? Get a feel for control flow syntax and know the basic functions' syntax.
- Know the language and its capabilities: What is the purpose of the language and what are its origins? This will give you big clues above and beyong your lectures about what you may be asked. For example, my exam was on matlab so we were asked mostly mathematical questions, although some on finding strings and characters in sequences. Learn the most used functions off by heart.
- Practice, practice, practice: Get past papers from the same teacher, preferably with answers and corrections. This will teach you not only what questions will be asked by also what the teacher wants, which can turn a good grade into an excellent one.
- Remember the basic rules of programming: This one point is probably worth more than all of the points above combined, at least it was so for me as we were allowed a language reference. Comment your code for example; not with what you have done but why. This means that if you do screw up, you have at least demonstrated a knowledge of programming if not the particular language you are using.
- In homage to Douglas Adams, Don't Panic: If you think that there is something you cannot do, leave it and go on to something else. If there is something which is not clear, ask: There is no guarantee that there isn't a mistake in one of the questions and you may be doing everyone else a favour too. As an example, during our paper I had to find the union and intersection of a pair of sets: As a non-mathematician who hasn't done set theory for about 10 years this meant nothing to me, so I asked the teacher who explained the meaning to me (the exam was in French).
Othewise code exams are just like any other exam and all the usual rules apply: Sleep well the night before, read the question paper thoroughly etc... and all will be well.
Well, there. I've said as much as I can. At the end of the day I only code for fun really, at the moment anyway, and the exam was not too heavy (details below if anyone cares!) From me, to those about to code, I salute you!
Addendum: Exam paper details for completeness sake:
- Write a subroutine using recursion which returns the nth value of a series of Tchebytchev polynomials given a set of rules.(Actually much easier than it sounds.)
- Write a pair of subroutines, one which returns the union (a unique list of the values contained) of a pair of given sets stored in the variables a and b, and one which returns the intersection of the two sets (the common values).
- Write two routines: A subroutine which returns the number of times a string a contains the character 't' and a subroutine which returns the number of times a string contains a character passed to the subroutine as the variable, a.
- Write a subroutine which returns the number of times a subroutine contains any of the chracters passed in the array a occurs in a given string, b. Rewrite the subroutine to be case-insensitive.
Okay, very easy stuff and definitely par 3's in a game of perl golf (I'll admit I gave a perl one-liner for question 3 in the margin) but remember, this is for people who are not coders and have only had about 20 hours practical coding experience. It was also considerably easier than I though it would be as I was expecting something far more involuted.
And me, I got 80%. Matlab isn't really my cup of tea!
"Violence is the first resort of those faced with yet another BSOD."