Software, technology, sysadmin war stories, and more. Feed
Wednesday, May 1, 2013

My AP Comp Sci exam disaster story

Back in high school, I bought into the whole "advanced placement" thing. It was supposed to be a magic wand which could be waved to somehow improve your college experience. That would then somehow translate into a better job, or something like that. I imagine most people have heard some variation on this theme in their own lives... or will soon.

The particular flavor I went for was AP Computer Science. I already knew a bit about programming, and was already helping out with day to day operations of my school's Unix box, so why not? It also seemed like the logical progression from the "Computer Programming 1/2" classes I had taken the year before.

I signed up for the class. It was rather loosely run. On one side of the classroom, maybe 20 or so students did the AP Comp Sci curriculum. On the other side, at the same time, another similarly-sized group of kids were doing "Computer Applications" - they were using WordPerfect and things like that. Somehow, one teacher ran the whole thing at the same time.

Not much really happened in there. We'd be pointed at our latest assignment, and then we would go off and work on it. There were sufficient ambiguities to where it was possible to just sort of get something working and it wouldn't really matter how it happened. One time, I wound up "inventing" (not really) my own pathetic "sort" because the assignment required a sorted output.

Want to know how bad it was? Okay, here, I'll spill the beans. I don't remember all of it, but I do know that it involved actually doing "inserts" and "deletes" on the array. Yes, an array. Not a linked list. When I say insert, I mean in the sense where you have "abcd", and you put your cursor on "c" and hit your - key, and now you have "ab-cd".

To actually do this, I would start below the insertion point and I would just copy everything down a spot. Then I'd stick in the new value at the insertion point. Then I'd go do a deletion for the old position, and that involved similar stupid copy gymnastics: start there and copy everything up a space.

This actually worked because the stuff we were doing wasn't very complicated and nobody really cared about speed, but looking back, it's supremely horrible. Nobody noticed. Nobody tried to set me straight. It was basically rubber stamped and I was sent to work on the next assignment.

I actually didn't start writing this post to talk about the useless assignments which didn't really help me at all because I was allowed to flail around without any sense of feedback from the teacher. Oh no. This is about something which failed in a much bigger sense. It's about the actual AP exam at the end of the year.

Here's how the whole thing happened. The tests weren't held at my high school. We all had to find our own way to this special site which actually wasn't a school at all. It was some auxiliary building of the school district which had been a school many years before but now housed something else. I had a license by this point in my life, but didn't have a car, so I borrowed my dad's for the day. One of the students in my class needed a ride so I helped him out, too.

After our first class, we hopped in the car and set out for the testing center. Even though it was mid-May, the weather didn't care, and we had sleet coming down. This is the thick stuff which actually sticks to your windshield and needs to be wiped off. I turned on the wipers.

About halfway between my school and the freeway entrance, the wipers quit -- they actually stopped dead-center on the windshield. The controls did nothing. Off, low, high, intermittent, whatever. They wouldn't move no matter what I did. I was going maybe 35 mph when this happened, and within a couple of seconds had zero visibility. Fortunately, nobody was around, and I knew what the road was like from experience, so I just pulled off to assess things.

While on the shoulder I tried turning the car off and on (hey, it worked for Windows machines) and a bunch of stupid things like that. Initially, nothing happened. Then, oddly, they came back to life. I decided to get moving before something bad happened, and we took off again.

A minute or two later, I was on the freeway for a short hop - it was perhaps a mile to the next exit, and that would lead us to the testing place. What happened? Yep, they quit. On the freeway. At 55 mph. Once again, I had zero visibility in a matter of seconds. This time I was really in trouble. Pulling over wasn't an option this time. The exit ramp was coming up soon... just... when?

I did something relatively bold and stupid and rolled down the passenger side window, and told my classmate to watch for the white line. When it moved over to the right, that was the beginning of the exit and we were going to take it. Then, out of the flow of relatively fast freeway traffic, we'd figure it out.

He leaned his head out and watched. I just drove straight, trying to see out my own window, all the while fighting with the stupid knob. The exit ramp started, he called it out, and we exited. Just then, the wipers came back on at full speed, making a terrible racket since there wasn't enough moisture to keep them busy. I didn't care. I wasn't touching that selector again. Instead, I took off at an expedited pace for the testing center, some two miles up the road.

Somehow we got there without running any red lights or hitting anything. We were actually early and had to wait around for our session to open. It was held in a big open room with a bunch of normal classroom desks. There were no computers present.

In the actual test, the first part was a bunch of questions in a booklet. I don't remember much about it, and it's not important anyway. Where things turned into a disaster was part two.

When they turned us loose on the second half of the exam, I opened the booklet to discover a ton of code for some kind of "directory manager" program. I had never seen it before. I guessed based on that name and a quick scan of the source that it was something like Norton or PC Tools or whatever: it probably gave you a list of stuff, and you could rename things, or copy, or move, and things like that.

The test asked me to add some kind of feature to the program. I don't remember the finer points of it, but this is how I interpreted the situation, and about what my inner monologue sounded like:

Okay, so they want me to read through all of this and understand it, effectively compiling it and running it in my head, since I've never seen this before. I have to do this to the point of understanding where everything is, and how it works, and how it might be extended. Then I have to figure out how to extend it, and then actually extend it. Finally, I get to write this code out with a pencil, since, again, no computers.

I just sort of looked at the test pamphlet and pondered my options. I couldn't exactly get up and leave. They wouldn't let me disturb the environment by getting up, and besides, I had to give my friend a ride home after the test.

I could try to actually do it, but that would be a serious amount of work, and for what? Just so I can possibly get a 4 or 5 on the exam and maybe turn that into class credit in some college I haven't even selected yet? What if I do all the work and don't even get a 4? Then it's all for nothing.

The inner monologue continued.

This is a ton of work: all on paper, no computer, not even a compiler to make sure it'll parse and actually run, never mind run correctly. If they're going to demand this much work from me in a stupidly short amount of time, they should be paying *me* for the privilege, not the other way around!

I decided to not do it. I still couldn't get up and leave, and I'm sure there would be some kind of anomaly if I didn't write anything, so I picked up my pencil and wrote something really stupid to establish that yes, I was physically present and just didn't do it for some reason. The "code" I wrote looked approximately like this:

foo := bar;

That done, I put down my pencil, closed my booklet, and just sat there and stewed until time ran out and they let us go. I took my classmate home and then went home myself.

A couple of days later, I was told what had happened to me. Supposedly, we should have encountered the "Directory Manager" thing as part of our curriculum. That is, we should have been working on it all year to get familiar with it, and extend it in other ways. That way, when we encountered it again on the exam, it wouldn't have been a surprise.

[ I should note that I had no way to verify this, so this may have been a yarn someone spun to "explain it away" for me. I can't prove this is how things were supposed to work. It's just what I was told. It's also possible I took the wrong test somehow (A? AB?) but why would my teacher let that happen? ]

The source code they provided in written form was just there as a reference. We should have known our way around it from the past 9 months of hacking away at weekly assignments on the thing. Instead, we just putzed around in this textbook doing a bunch of stupid assignments that didn't really get graded anyway. Oh, they got a score, but they weren't sanity-checked. The "bogo sort" flavor I created proves it.

When my score arrived, it was uselessly low as I expected. The whole thing had been a waste of time and energy. I should have just skipped it and gone to my usual classes that day instead.

What happened here is simple enough, and it's a pattern which has reappeared in my life: when faced with sufficient stupidity, I decide to walk away from it. Sure, in theory, I could have tried to do some kind of heroic "save" to figure it out on the spot. In practice, who the hell cares? I may have been an ignorant teenager but I still had a bogon detector, and it was pinging wildly at the events of that day.

Instead of stressing out, I just wrote the whole thing off.

The actual impact on my life seems to have been zero in the long run. Nobody cared about that test when I applied to schools a year later.


After writing the above, I went digging through my old floppy images... and found the infernal 'sort' code. Ready to be sick? Okay. Here are the innermost parts which did the really nasty push/pull stuff:

PROCEDURE PushDown (Var ToPush: ListArray; PushFrom: BYTE);
  PushIdx: BYTE;
  FOR PushIdx := 100 DOWNTO PushFrom DO
    ToPush [PushIdx + 1] := ToPush [PushIdx];
  ToPush [PushFrom] := ' ';
 PROCEDURE PullUp (Var ToPull: ListArray; PullTo: BYTE);
  PullIdx: BYTE;

BEGIN FOR PullIdx := PullTo TO 100 DO ToPull [PullIdx] := ToPull [PullIdx + 1]; ToPull [101] := CHR (255); END; PROCEDURE SortArray (Var ToSort: ListArray; ListPos: BYTE); VAR SortIdx: BYTE; CurrCh: CHAR; NextCh: CHAR; NextCh2: CHAR; BEGIN ToSort [0] := 'A'; ToSort [101] := 'Z'; CurrCh := ToSort [ListPos]; FOR SortIdx := 0 TO 100 DO IF ListPos <> SortIdx + 1 THEN BEGIN NextCh := ToSort [SortIdx]; NextCh2 := ToSort [SortIdx + 1];

IF ((CurrCh >= NextCh) AND (CurrCh <= NextCH2)) THEN BEGIN PushDown (ToSort, SortIdx + 1); ToSort [SortIdx + 1] := CurrCh; IF (SortIdx < ListPos) then PullUp (ToSort, ListPos + 1) ELSE PullUp (ToSort, ListPos); Sound (500); Delay (1); NoSound; Exit; END; END; END;

See the "Sound(500)"? This thing actually ticked every time it did a pass because it took a while to run. This way you could be sure the machine hadn't locked up. I had forgotten about that.

All that to sort 100 random characters. What a miserable mess.