Alright, not really a marathon – more like a couple of long leisurely walks. But I have spent some time away from MT262 over the last week, due to preparing for a job interview and generally being tired out by work, so I’ve set aside a big chunk of time this weekend for getting back to C++ revision.

Today I did Part 2 of the 2006 past paper, then went through my answers for the whole paper with the Black Badge Press solution booklet. I generally did okay, I think, although as always there were some opportunities for improvement. In particular I had trouble with Question 12 (did I mention how much I dislike those “draw a GUI diagram” questions?), and by the end of the marking session I had the usual list of silly mistakes to avoid next time:

  • Forgetting the “Step 1” bit of a for loop statement in a design.
  • Writing that the Shape property of a TShape component should be set to tsCircle rather than stCircle.
  • Forgetting to close an ofstream after opening and writing to it.
  • Using a big complex if-else statement to cycle through the values 0-23, when I could have used a nice elegant modulus operation.

I’m particularly kicking myself about that last point, since I did pretty much exactly the same thing in a previous past paper. Basically, I tend to solve the problem of cycling through a range of values like this:

if (x == 23)
   x = 0;
   x = x + 1;

Whereas the BBP solution booklet has something along the lines of:

x = (x + 1) % 24;

I should probably get some kind of temporary modulus symbol tattoo to remind me of this approach in the exam!