Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Meditations on the Nature of Code Exams

by Elgon (Curate)
on Mar 20, 2001 at 23:34 UTC ( [id://65784]=perlmeditation: print w/replies, xml ) Need Help??

I have wrestled with my thoughts before bringing this one to the attention of the Perlmonks community, however you guys are the best people I know to ask. This is, I hasten to add, a not-strictly-Perl-related node but pray, forgive me for my presumption.

I received some shocking news today: I have an on-paper coding exam sometime in the next two months.

My first response was: "Whoopeeee! Easy credit!" Mainly because I am on a chemistry course where at least half of the students couldn't code their way out of a for/next loop - and this is me talking here: I rank Perl adept on a good day. I then realised the stark truth that this is not an exam in Perl but in, gasps, Matlab.

I could go on about how Matlab sucks. How Matlab doesn't have nice 'n' nauseating functions like foreach and one of my recent favourites, map. I could also tell you that we only do Matlab because the guy who teaches us helped specify/review/write it but all of this is, well, academic.

What I really want to know is how to prepare for a coding exam (on paper) as opposed to an exam in any other subject. Are there any special techniques to use to analyse the questions? Should I learn specific routines which do neat stuff off by heart in case they come up? Will I get credit for giving answers in Matlab, Perl and badly-written C or will the teacher just downgrade me for being a smartarse? just kidding

Give me the benefit of the combined years of Computer Science and Software Engineering degrees that are surely present here on Perlmonks. How do I go about this? All advice; perceived, imagined or merely sarcastic is welcome!

Many thanks, Elgon

UPDATE: Wow. Thanks for the response, and there I was querying tilly if this was suitable for posting. The level of this exam shouldn't be quite as high as many of the respondants have expected (I hope!) but all the advice is useful, muchas gracias. Elgon

UPDATE2: MUCH LATER: Okay, I've got the exam tomorrow. Thanks for all the help, assuming anyone is going to read this ;-)

Replies are listed 'Best First'.
Re: Meditations on the Nature of Code Exams
by Masem (Monsignor) on Mar 20, 2001 at 23:46 UTC
    It probably all depends on the course and teacher. Mind you, I'm coming from complete left field - I'm a ChemE, no comp sci courses save for some in grad school for algorthms.

    Of the courses I took from comp sci, mostly algorithms with C++ thrown in, the tests were aimed more towards knowing how the algorithms worked and demonstrating them on paper, with little emphasis on the language used. There was some C++ questions, but mostly "code an effective data structure for such-and-such, with prototypes of what member functions you need", so that they know you knew about encapsulation etc. If anything, there was more along the lines of "spot the syntax/runtime error and fix it". So in these cases, I learned the algorithms and passed with no problem (of course, I already knew about C++ well before this point).

    Now, in a class that I help teach in ChemE, the exams required you to know how to use a program called PolyMath which was used to solve differential equations. Before there were massive computer clusters, the tests involved writing out with exact syntax the program text you'd enter into PolyMath, in addition to having a small number of students at a time with limited time to run PolyMath to solve one problem on the test using a small number of borrowed computers. You had no manuals, and PolyMath, being DOS based, had no online help, so you HAD to know how to enter everything. I didn't have to take this course, but I know students hated that concept. However, I doubt this is similar in CS.

    So the best suggestion is to talk to students that have already taken tests with this profession; get in contact with your student chapter of IEEE, or ASM, or a number of other CS-based groups; many of these groups keep copies of tests from previous years archived which you can persue. Many professors are putting old test copies in the library on research, so check there as well. Experience from others will be the only way to tell if things in this class are going to be concept based or syntax based. Hope for the former, of course, as it's much easier to study and perform :D


    Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
      Matlab is pretty easy to learn. Easier than perl, I would say. As it was stated before, matlab is array oriented. (Even scalars are represented by 1x1 arrays of doubles). I was a Math major concentrating on Applied Math. My last year of school was spent in the computer lab writing Matlab code. I've forgotten it now since I don't use it anymore, but I bet that it wouldn't take me very long to get back in the grove of things. My guess is that it will take a book on Matlab and a few nights to get the fundamentals down. Good Luck, thor
(Guildenstern) Re: Meditations on the Nature of Code Exams
by Guildenstern (Deacon) on Mar 20, 2001 at 23:48 UTC
    In my experience in writing code on paper for a grade, the most helpful thing was to know the syntax of the language as best I could. Personally, I feel confident in my ability to write a problem solution in just about any language I'm familiar with, but I'm not always 100% certain of the syntax. I don't know about you, but I had several profs who seemed to be more interested in dinging me points for missing a semicolon than for correctly solving the question. There's no greater frustration than getting a paper back with a lower grade because you should have made your input parameter const, even though your algorithm is correct.

    Isn't Matlab the software with the suspiciously Pascal-like syntax? If that's the one, my sympathies.

    Guildenstern
    Negaterd character class uber alles!
Re: Meditations on the Nature of Code Exams
by mothra (Hermit) on Mar 21, 2001 at 01:59 UTC
    I've written coding exams on paper several times. My advice is simple: when you study write it out. Get used to not using your computer for doing the coding so you know what it feels like.

    Run through exercises for the algorithms and concepts that you expect to be quizzed on (ie. do you have to do a bubble sort? inherit a class? write a constructor? etc).

    If possible ask your prof what assignments the test might be like, and if they even give you a ballpark idea of an answer, then do those assignments over and over.

    I'm not the world's most amazing hacker (yet :), but I know how to write tests. I graduated with a 4.45 GPA. :P

Re: Meditations on the Nature of Code Exams
by jeroenes (Priest) on Mar 21, 2001 at 18:06 UTC
    I'm responding merely on your ranting about Matlab. First a few statements:

    Try to think like:

    The right tool for the job.

    Matlab is different, but not bad because it is different.

    Matlab is a Matrix oriented programming language, where perl is more or less item oriented (but see PDL).


    I have been using perl and matlab on a daily basis for a couple of years, but only recently I ran into a situation that forced me to redo a matlab-solution in perl (or C, but for obvious reasons I choose perl). BTW, I studied chemistry myself.

    What struck me, is that some things can be written very smoothly in the perl way, but that some other things get very complicated when you have to release the matrix approach. It's similar like rewriting some complicated SQL (with lot's of joins and where-statements on different columns from different tables) into perl.

    For the sake of the argument, let's assume that we have some data in a 5x5 matrix. In Matlab it's called 'a', and in perl it's a 2D-array '$a'. Let's assume it's in a tab-delimited text file, than you would fetch it:

    Matlab: load data.txt a=data; Perl: $a = supersplit_open( 'data.txt' ); #Without supersplit, it's more + code
    So far so good. Let's say I want to summate the rows (a basic starting point for statistics):
    Matlab: sum(a') Perl: $sum = map{ my $c = 0; map{ $c += $_; }@$_; $c; } @$a;
    If I want to summate columns:
    Matlab: sum(a) Perl: my $last = $#{$a->[0]}; $sum = [ map {0} 0..$last ]; map{ $sum->[$i] += $_->[$i] for my $i (0..$last) } @$a;
    Maybe you have to see that it is easy to select rows/columns in matlab, and do some logic on it:
    large=find( a(:,1) > 1E10 ); large_ok = find( a(:,1) > 1E10 & a(:,3) > 0 ); sum( a(large,:) ) mean( a(large_ok,:) )
    I refuse to recode that in perl. I had to do it once, and it was really awful. But I can do it in SQL easily as well:
    SELECT mean(a1), mean(a2), mean(a3), mean(a4), mean(a5) FROM a WHERE a1 > 1.0E10 and a3 > 0;
    And these are the basic things I run into daily, in collecting and further analysing data.

    But whenever you run into something that has to be done item-wise, Matlab solutions get uglier. For example, a running sum of an 1D-array 'b':

    Matlab: for i=1:length(b) s(i) = sum(b(1:i)); end Perl: my $localsum = 0; $s = [ map{ $localsum += $_ } @$b ];
    So, whenever you stay as close to the matrix as possible, you will see that much of your coding is quite easy in Matlab, depending on the actual assignment.

    Cheers,

    Jeroen
    "We are not alone"(FZ)

Re: Meditations on the Nature of Code Exams
by indigo (Scribe) on Mar 21, 2001 at 02:22 UTC
    It depends whether the question on the language or on the programming.

    In college, I encountered both kinds of questions, sometimes on the same test. And when I conduct interviews, I ask both kinds of questions.

    Language questions tend to be short, and rarely represent complete programs, and I expect near perfect syntax. Cool language tricks earn bonus points. Some of the Perl questions I might ask are:
    • Print out the keys of the third hash in array @a.
    • Deduplicate the elements in array @a.
    Programming questions tend to be more involved, and can be often answered using pseudocode. Language tricks are dangerous, as they can mask your knowledge. If I ask you to implement an efficient sort routine, and your only response is some library call, you aren't going to score any points with me.

    Bottom line, a test is your opportunity to demonstrate your understanding of the subject matter...correctness is secondary. Make sure you know what is being asked, and what the expectations are.
Re: Meditations on the Nature of Code Exams
by arhuman (Vicar) on Mar 21, 2001 at 00:33 UTC
    I agree with Guildenstern work the syntax !
    (You won't have any debugger,parser to point out misssing/incorrect instruction/syntax.)

    Kwowing the predefined Matlab types/function (As you see I'm not an expert) would help too...

    Play a little bit with the tool to get used to it.
    It's definitly more efficient than just reading the manual...
    Learning by making mistake is one of the best way to remember and avoid them.

    Last advice : if you could find a copy of this exam (from previous years) it could be a good thing to look at.(what is the english translation for the french word 'annales' ?)

    "Trying to be a SMART lamer" (thanx to Merlyn ;-)
Re: Meditations on the Nature of Code Exams
by tinman (Curate) on Mar 21, 2001 at 00:59 UTC

    I finished Info. Sys. last year and I had the same problem... at that point, I loved C, but we had to do most if not all our coding exams in Modula-2

    My personal experience is that it is very much dependent on the lecturer, and how s/he is instructed to grade.. I had a good lecturer for data structures, who actually told us not to worry about the syntax (missing ;, possibly incorrect syntax), that he was going to grade us on ideas alone.. needless to state, I loved his lectures :d

    OTOH, my C++/OO lecturer thought it unfair that anyone should 'get away' with not knowing enough of the language to actually pass.. her argument seemed to go along the lines of 'if you did enough lab, you'd know enough to not goof the syntax in a major way..'..

    So, as far as advice goes, I'd imagine that you're definitely ok with expressing your idea/algorithm in a language of your choice (ie: Perl).. so what remains is to know enough of the syntax/eccentricities of MatLab to 'translate' as it were...

    so, by all means, study as much of the syntax of the language as you can, get that under your belt, and you should be good for any coding exam... Good luck!

Re: Meditations on the Nature of Code Exams
by Sprad (Hermit) on Mar 21, 2001 at 21:30 UTC
    One of my professors was fond of saying that you can't study for a programming (or math) exam. If you don't know it by the night before the exam, no amount of cramming will help.

    This may be true, but was of little consolation to those of us worrying about the upcoming test.

    I've found that the best way to prepare for a programming test is simply to program. Write as much as you've got time for, run it all through the computer, and learn as much as you can from it. Syntax is a big issue, but it's also good to know all the little quirks of a language.

    Write a small program that does nothing but simple file I/O. Write another one that just takes keyboard input. Write one for string manipulation, for math functions, for... whatever you think might trip you up on the test. You've been in the class long enough to have a good grasp of the subject matter. All you need now is the ability to express your knowledge in program form.

    One big issue is whether the professor favors Elegance or Openness. I had a professor (same one who claimed you can't study) who was an elegance nut. The more "elegant" (his word for obfuscated) your code, the higher he'd grade you. If you could write a program in a single bewildering line, using constructs from strange nooks and crannies of the language, you'd get a gold star.

    Conversely, I had another professor who loved programs that were perhaps less efficient and impressive, but easily understandable. If you turned in a one-liner when he was looking for a half page with comments, he'd mark you down for being a smartass.

    Woe be to the student who forgot which class he was in...

      I have to agree with the professor on studying math, but I have to say that it is very strongly subject specific. With a subject that builds on itself like math or any language, you really cannot cram a significant chunk in at midnight before your test. So study a little through the term and get your sleep. However with subjects based on large numbers of facts, such as biology, you most definitely can cram and should.

      Therefore while I agree that cramming won't help in math, it certainly will help in a lot of subjects.

      in reply to Meditations on the Nature of Code Exams in thread Meditations on the Nature of Code Exams One of my professors was fond of saying that you can't study for a programming (or math) exam. If you don't know it by the night before the exam, no amount of cramming will help.

      I'll give you some hope and tell you that it's partially wrong.

      Even If one night of study won't give you as much as a constant learning
      (especially if you want to keep the information learned for a long time),
      It can limit the damages in the case you don't know anything, or even give you an easy success
      (if you're lucky or if the exam is REALLY easy)

      I can't stress it enough : It's definitly not the best way to learn (not even a good one...)
      The best way to learn is through constant practice.
      BUT never give up, it's never too late, when you're lacking time just, optimize it...

      You have to remember that you'll be graded for your exam, not for what you worth.

      You can optimize your learning process to be efficient for the exam :
      coding the way the examinator like it, working on topics the examinator like and may use for the exam,
      learn a lot of little details useful only for the exam that you'll forget later
      (I recall I learnt 5 pages of number defining some protocols just for one exam,
      I have of course forgotten them yet but, being able to cite large part of a protocol,
      long series of technical numbers, was very impressive for the examinator if I refer to the grade I had...
      It didn't made me smarter, It was just an 'exam optimization' but it really improved my prestation)

      It's not cheating or fooling. I call it optimization for it's just that. You optimize your chance of having a good grade.
      They make the rules (your worth is determined by your ability to pass an exam which has not much to do with the reality) you play with them ;-)

      Final note : I really prefer true (long) learning, which is the most fullfilling for me (when I have the feeling that I'm efficient/skilled) but look around inner valour is often ignored in favor of the 'showing'.
      I learnt to play with this fact, I just wanted to share...

      "Trying to be a SMART lamer" (thanx to Merlyn ;-)
Re: Meditations on the Nature of Code Exams
by r.joseph (Hermit) on Mar 24, 2001 at 05:26 UTC
    Just a quick two cents here - in studying for the free response portion of the Advanced Placement Computer Science exam given in May, I have been attempting to learn and understand as many general and useful algorithims as possible. Mainly simple ones, as the AP Comp Sci exam isn't supposed to be that difficult, but I find that if you know a basic and general algorithim, you can usually adapt a certain portion of it to fit whatever you need.

    Just thought I'd chime in, although I realize many have done so already - and good luck on your test!

    r. j o s e p h
    Violence is a last resort of the incompetent - Salvor Hardin, Foundation by Issac Asimov
Re: Meditations on the Nature of Code Exams
by EvanK (Chaplain) on Mar 21, 2001 at 00:15 UTC
    Comp science and software engineer degrees? (And to think, I'm not even out of high school yet. Methinks I may be out of my league?...)

    ______________________________________________
    When I get a little money, I buy books. If I have any left over, I buy food and clothes.
    -Erasmus

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://65784]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-03-29 14:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found