*** OFFICIAL 2013 AP Computer Science A Thread***

<p>@avg100 calculators aren’t allowed</p>

<p>kiwiasian, did you recieve the 2009 exam?</p>

<p>@Miami24 what happens when you do

is that list now refers to a different array, a new one with 5 elements. The original array still exists, but list no longer points to it because it now points to the new 5 element array. This is the array that is modified.</p>

<p>When you return from the method, this new 5 element array is discarded. nums still points to the original array though, so it will print out the contents of the original array (which have not been modified).</p>

<p>miami24, can you please send me the 2009 test, I pmed you…</p>

<p>@Miami24
This is a more thorough explanation of why those two cases differ.
Java is always pass by value. What the value is, however, depends on the variable type. If the variable is a primitive type (int, long, double, etc.), the value that is passed into methods is the value of the primitive itself. If, however, the variable is an object type (String, Object, an array, etc.), the value passed into the method contains a reference to the object in question.</p>

<p>What this means is that a method cannot change the value of anything passed into it and have that change be reflected in the calling method. For example:</p>

<p>void method1(){
int i = 0;
method2(i);
System.out.println(i); //prints “0”;
}</p>

<p>void method2(int i){
i = 1; //i = 1 inside this method, but the original i is unaffected because it only passed its value, 0, into this method
}</p>

<p>In essence, method2 gets this: method2(0), and changes that 0 to a 1 inside itself, but nothing it can do can change the i variable’s value in method1.</p>

<p>With objects, it becomes slightly more complex.</p>

<p>void method1(){
int[] arr = new int[1];
arr[0] = 0;
method2(arr);
System.out.println(arr[0]); //prints “1”
}
void method2(int[] arr){
arr[0] = 1; //this method accesses the actual array by getting its reference from the parameter and grabbing the array from the heap. It then modifies the array’s only value to be 1
}</p>

<p>In this case, when the programmer types method2(arr), he/she is really passing the value of the reference to the actual array stored somewhere in the heap. method2 sees this: method2(ref to array), grabs the actual array from the heap, and modifies it to contain the value 1. When method1 accesses the array again, it gets the same array from the heap and reads the value back as 1.</p>

<p>However, if you use new (or assign the variable arr to a different object), a whole different thing happens.</p>

<p>void method1(){
int[] arr = new int[1];
arr[0] = 0;
method2(arr);
System.out.println(arr[0]); //prints “0”
}
void method2(int[] arr){
arr = new int[1];
arr[0] = 1;
}</p>

<p>Here is where pass by value becomes apparent. Originally, the variable arr has a value of the reference to the original array with contents {0}. However, it passes that value to method2, which promptly ignores that value and replaces the contents of variable arr with a new value containing a reference to a newly created array with size one. It then changes the single int inside that array to be an int equal to 1. When method2 completes, the original array created in method1 remains the same as it was originally, and the new array created in method2 loses all of its references and will eventually be garbage collected. Since method2 never grabbed the original array from the heap, it never modified what method1 sees.</p>

<p>Think of variables as boxes containing a value. If the variable is of a primitive type, then the value is simply its innate value. If the variable is an Object, then what the box holds is a reference to the actual Object stored somewhere on the heap. When passing variables across methods, the actual box is never copied, only its contents.</p>

<p>Yes, above explanation is correct. I was just too lazy to spell it out. </p>

<p>I suggest looking up pointers, something C++ uses extensively but Java does not have. It’s a similar concept. </p>

<p>Sent from my GT-N7100 using Tapatalk 2</p>

<p>does anyone else here have the 2009 test on pdf?</p>

<p>Just a reminder to everyone about the confidentiality rules regarding the exam … you’re not allowed to reveal the content MC problems at all after the exam (since ETS re-uses those questions), and you’re only allowed to reveal the content the FRQs after they’re released on the AP Central website (usually, 48-ish hours after the exam), so that folks in different time-zones worldwide don’t get an unfair advantage …</p>

<p>Can we use the quick reference guide on the multiple choice questions?</p>

<p>Yes, I believe you’ll have the quick reference guide during both portions of the exam.</p>

<p>Anyone with the 2009 pdf want to pm me the link?</p>

<p>@jkhuggins thanks!</p>

<p>According to the 2009 scale, you need a 62 raw score for a 5. Has that number increased (in general) due to the elimination of the guessing penalty? </p>

<p>Also, I find that the toughest questions involve things like a a1 = new b(); where b is a subclass of a. Does anybody know what I’m talking about?</p>

<p>@sup210 yes that is polymorphism. And yes it can be a bit confusing sometimes. Is there a specific question you need help with?</p>

<p>I did the 2008 practice exam,
Link: <a href=“http://www.pkwy.k12.mo.us/homepage/jheath/File/Computer_Science/AP_Sample_Exam/CS-A_Test.pdf[/url]”>http://www.pkwy.k12.mo.us/homepage/jheath/File/Computer_Science/AP_Sample_Exam/CS-A_Test.pdf&lt;/a&gt;
but I really would like the 2009 exam; can someone please upload it/send(or post) me a link.</p>

<p>Guys, is Quicksort tested in the AP Exam? I’m looking at the Barron’s book, and it says it’s an “Optional topic”. Can anyone please reassure me on this?</p>

<p>I haven’t seen it on any practice tests and it wasn’t in the Litvin’s Book so I dont think it’ll be tested. </p>

<p>I’ve taken 4 practice tests – 2 Litvin’s and 2 Barron’s. </p>

<p>For Multiple Choice: The first test, I got a 28 which was Litvin’s. Then I got a 30 on Barron’s. Then, I got a 33 on another Barron’s. Then I got a 38 on another Litvin’s. </p>

<p>For Free Response: I’m not getting less than 31 and I’m averaging about 33. </p>

<p>Would you say I’m in 5 range? I know, according to the '09 scale, I am – but I don’t know how the scale has changed since then. </p>

<p>Also, how would you compare Litvin’s and Barron’s to the actual exam for any of you who have taken the actual exam or past exams?</p>

<p>@sup210</p>

<p>A dumb question, but seriously, How do you get such good scores in Barron’s??</p>

<p>Haha, I didn’t even know that’s good – that’s why I’m asking if anyone knows the scale!</p>

<p>i really hope that i can do this. the multiple choice always seems hard</p>