On May 4th, the 2010 Advanced Placement Exam took the nation by storm with 40 multiple choice questions and 4 dazzling free response questions. As I have sworn secrecy to protect the integrity of the multiple choice questions for the rest of my life, I will reveal my own personal solutions to the free response questions.
For the record, I did not get my green packet back yet and probably never will. I took AP Chemistry last year and never got it back.
The very first question was CookieOrder and MasterOrder. Part a required a method to get the total number of boxes for a variety supplied by an argument in the master order. Part b requested that a method be written to remove all of the CookieOrder objects stored in an array list and also count and then return the number of boxes removed.
The class and methods I wrote may differ slightly in naming and also contents because I wanted to test these things and also because I forgot the actual method names. I used an ListIterator which is a wonderful thing to remove my CookieOrders.
The second question was about writing a class. APLine was supposed to contain a method to get the slope
-a/b and a method for testing whether a point supplied by x and y arguments is on the given line with a custom constructor. Seriously, I wanted to mess with the AP people; I used the scary
this keyword. It’s not in the course material. Really, nothing was hard about this class; I threw in a boolean return as required, but without the if statement, so it’s not explicit, it’s implicit.
A curve ball that threw a few classmates was Question 3. Basically, a class called Trail had an array called markers. The markers store an elevation of the said trail. Part a was about writing a method that use two arguments defining the start and end positions; then find the minimum and maximum elevations between the given start and end positions. It would find the absolute difference and check to see if it was equal or greater than 10. If it was, it would return true otherwise false.
Part b was actually easier to write. The goal was to write an isDifficult method. It would check to see if the trail had 3 or more 30 or more changes in the trail elevation. This was indeed easier than the logic for the level path method.
The grid world question was not as tough as I thought it would be. If they had asked, Write a SomethingOrOtherCritter and make it do SomethingOrOther,” I would have lost that question. Yet, they asked for a GridFinder or something like that.
Part a was going to find the actor with the most neighbors. The idea was to get all the occupied locations. Then, knowing that, loop through all of those. Two variables were initialized to 0, index and total. During the loop, the grid would get the neighbors array list for each location. Then the
size() method would be called on each list, and compared against the current total. If it was greater then the total would be assigned the list’s size and the current loop index would be set to the index. After the loop, the grid would get the actor at the location that was stored in index. It was pretty neat.
A bit more abstract, part b was basically get occupied with in 2 rows and columns. That’s a mouthful. Anyway, the my custom solution might be a bit odd, but I’m sure it works. Let’s walk through that one. First, the given location’s row and column are stored. Then, an empty Location array is created and all of the occupied locations are found. All of those occupied locations are then looped through. During the loop, the occupied location’s row and column are also stored. Then the master piece logic: if the given row is not equal to the occupied row and the absolute difference of the given and occupied row are less or equal 2 and the absolute difference of the given and occupied column are less or equal to 2, then add the occupied location to the list of valid locations. After the loop is done, return the list of locations.
Now that’s a mouthful.
I really loved the questions on the free response. I lucked out in my mind; they were well suited to my abilities. They were deadly abstract nor did they rely on bizarre string manipulations. I think I got
8 + 9 + 9 + 8 although not in any specific order on those questions. I’m happy with that.
I seriously want to see what other solutions to these questions are. If you have any of your own solutions or have comments for mine, please, leave a comment or write your own post describing your solution.