APCSP

I joined APCSP relatively new to coding, and pretty garbage at it. I remember making my “About Me Page” at the beginning of tri one, which was coded in HTML and consisted of an image and a couple <p> tags. I felt like I was about to be the next Bill Gates with these skills, but I was proven very wrong during the rest of the course.

Most of the time when Mr. M held TechTalks or our technical officers had a presentation on key topics, I used every ounce of my brain power to try and figure out what they were even talking about. Obviously, it didn’t work, and I spent most of the class very lost, stressed, and a little sad.

However, through this struggle I learned the magic of StackOverflow and my very smart teammates Akhil and Avinh. Whenever I had a I problem, I asked them and they would always help me. The very few instances in which they didn’t know why my code was broken, I went to Mr. M.

Now, this doesn’t sound like a very productive way to go through a computer science class, but as the class progressed, I slowly began learning more and more. Although I am no Anthony (an absolute legend), there were days when I made something good enough to make me feel like I was.

As the AP test approached, I genuinely thought I was going to fail because I was pretty incompetent and didn’t understand major concepts on College Board. So, I went on the grind, and started watching more CB videos and doing thorough test corrections on the practice AP tests we did in class. I got a 5 on the exam which was kind of a shocker

APCSA

Week 0:

I struggled to download literally everything because my computer is like jacked and just hates me.

Week 1:

After thinking I successfully downloaded everything, I realized my Java Kernel was broken and I had to go through this very long and painful process to fix it. In that process, I broke a lot of other things, which Mr. M so kindly fixed for me

Week 2:

I honestly don’t really understand what is going on right now. Java is significantly more confusing than Python and it lowkey hurts my brain. Doing the code.org lessons kind of helped, but I’m definitely struggling a lot.

Week 3:

I really enjoyed doing the boolean lab, it helped me solidify my knowledge of if-else and if-elseif-else statements. I learned about switch statements and De Morgan’s law. De Morgan’s law is a little confusing but I will pick it up eventually. My deployment mostly went smoothly besides the last step. I was able to get a domain and everything

Psychology and the Good Life:

  • We can control a lot more of our happiness than we think
  • Becoming happier takes a lot of effort
  • Money has a big influence on happiness
    • Can create stress or pressure

Like many others, I believe that success and prestige makes me happy. That’s why I stress so much about getting good grades, trying to get the best scores, and taking hard classes. I convince myself that the suffering and stress now will lead to happiness and wealth later. After watching this video, I’ve realized that although I want to be succesful, that is not the only thing that makes me happy. My friends, family, dog, videogames, and food are all things that make me happy. I also know that I have control over my mindset and actions, both of which influence a happy lifestyle. Living under the pressure of having to become what society deems “succesful” is hard, but the hardest kind of success is being happy with life and yourself.

Week 4:

I’m lowkey struggling with the array assignment thing because arrays confuse me. I don’t really understand how the whole printing thing works and all the different rows and columns. I enjoyed putting in my ASCII fish though. :)

Week 5:

My group has a good idea for a class manager for Mr. M and we made a wireframe and everything. I don’t really understand the fibo lab. I understand the concept of extends but have absolutely no idea how it works.

Week 6:

I was thinking of using a weather API to change the home page based on what the weather is outside. Our project is interesting to me because my teachers used to use a website called class dojo and I think it’d be cool if I could make something similar to that. The array images assignment was somewhat comprehensible and I was able to fix the scaling of the ASCII image.

Week 7:

I watched a YouTube video of some guy explaining arrayList and made a notebook page that is like a reference for me. I actually understand the purpose of an arrayList. I tried making a student arrayList and practiced adding and editing the values in the list. We have a very rough draft of our website going, but backend and frontend are not connected yet.

Week 8:

We were supposed to have presentations on Unit 1 and Unit 2 but since there was the plague going around school it was cancelled.

Week 9:

We made a video of our website and everyone’s role. Since I’m the scrum master, I basically explained all the collaboration and tools we are using to work on our website. We also got presentations on Unit 3-5.

Week 10:

We had a presentation on Arrays. Afterwards, Mr. M told us that we weren’t going to do anymore presentations because we needed to work on our projects. I’m slighly concerned given that our project barely had any features but I have confidence in my teammates

Week 11:

We were on the coding grind this week and were cranking out majority of our project this week. The day of Night at the M, we finally got frontend and backend working. Our project wasn’t great, but we at least had something tangible.

Week 12/AP MCQ

Screen Shot 2022-11-08 at 9 52 47 AM

Q17. Shift element in ID int array

Screen Shot 2022-11-09 at 11 03 58 AM

Wrong: {1, 2, 3, 4, 5, 6, 7} Right: {1, 2, 3, 5, 6, 7, 7}

Explanation: The for loop control variable k starts with the value 3, is incremented by 1 and terminates the loop when its value is arr.length – 1. In the first iteration, when k is 3, arr[3] is assigned the value arr[4]. The contents of the arr have been updated to {1, 2, 3, 5, 5, 6, 7}. In the second iteration, when k is 4, arr[4] is assigned the value arr[5]. The contents of arr have been updated to {1, 2, 3, 5, 6, 6, 7}. In the third iteration, when k is 5, arr[5] is assigned the value arr[6]. The contents of arr have been updated to {1, 2, 3, 5, 6, 7, 7}. Then k is incremented to 6 and the loop terminates.

Q18. Generate random index for ArrayList

Screen Shot 2022-11-09 at 11 05 17 AM

Explanation: The indices for myList are 0 through myList.size() – 1, for a total of myList.size() elements. Using Math.random()generates a random floating point number between 0 and 1, not including 1. When this value is multiplied by the number of elements we want in our range, myList.size(), a random floating point number between 0 and myList.size(), not including myList.size(), is generated. When this value is typecast as an int, the result is an integer value between 0 and myList.size() – 1 inclusive.

Q23. Manipulate method and animals List

Screen Shot 2022-11-09 at 11 06 26 AM

Wrong: [“bear”, “baboon”, “zebra”, “bass”, “cat”, “koala”] Right: [“bear”, “zebra”, “bass”, “cat”, “koala”, “baboon”]

Explanation: List is an interface, which an ArrayList implements. Please note that List is no longer tested as part of the AP CSA exam and ArrayList will be used instead. The manipulate method contains a for loop with a loop control variable k that starts at the right most index of animals, decrements by 1 each time, until k is equal to 0. In the first iteration, when k is 5, if the element of animals at 5 (“baboon”) starts with a “b”, which it does, then this value is removed from the list and inserted at index 1. The list would then be {“bear”, “baboon”, “zebra”, “bass”, “cat”, “koala”}. In the second iteration, when k is 4, the element of animals at 4 (“cat”) does not start with a “b” and no changes are made to the list. In the third iteration, when k is 3, the element of animals at 3 (“bass”) starts with a “b”. This value is removed from the list and inserted at index 3. Since it was already at index 3, the list would not change. In the fourth iteration, when k is 2, the element of animals at 2 (“zebra”) does not start with a “b” and no changes are made to the list. In the fifth iteration, when k is 1, the element of animals at 1 (“baboon”) starts with a “b”. It is removed from the list and inserted at index 5. The list would then be {“bear”, “zebra”, “bass”, “cat”, “koala”, “baboon”}. Finally, k decrements to 0 which is not greater than 0 so the loop terminates.

Q24. Translate 1D array into 2D array enhanced for

Screen Shot 2022-11-09 at 11 08 22 AM

Wrong: 8 Right: 7

Explanation: The enhanced for loop iterates over the array oldArray. In the first iteration, newArray[0][0] is assigned the value 1. The value of row is incremented to 1. Since 1 % 3 does not equal 0, the statements in the if are not executed. In the next iteration, newArray[1][0] is assigned the value 2. The value of row is incremented to 2. The algorithm continues to fill column 0 with the subsequent values of oldArray. Once row is 3, the if condition is true and row is assigned 0 and col is incremented to 1. The algorithm proceeds to fill column 1. When the for loop terminates, newArray contains the following values { {1, 4, 7}, {2, 5, 8}, {3, 6, 9} }. The value of newArray[0][2] is 7.

Q30. Scramble method with String and int parameters

Screen Shot 2022-11-09 at 11 11 11 AM

Wrong: “ilercomp” Right: “ilercom”

Explanation: The two parameter substring method returns the substring beginning at the first parameter and ending at the second parameter – 1. When word is assigned “compiler” and howFar is assigned 3, the value of word.substring(howFar + 1, word.length()) is “iler”. This is the substring of “compiler” beginning at 3 + 1 or 4 and ending at 8 – 1 or 7. The value of word.substring(0, howFar) is “com”. This is the substring of “compiler” beginning at 0 and ending at 2. The method returns “ilercom”.

Q34. Point and Circle Classes

Screen Shot 2022-11-09 at 11 12 11 AM

Wrong: II and III only Right: II only

Explanation: Choice I uses the no parameter Point constructor to assign center a new Point with x and y both equal to 0, instead of x assigned the value a and y assigned the value b. Choice II correctly uses the two parameter Point constructor to create a new Point with x assigned the value a and y assigned the value b. Choice III uses the no parameter Point constructor to assign center a new Point with x and y both equal to 0. It attempts to update x and y, however since they are private instance variables in Point, they are not able to be accessed directly in Circle. This code will cause a compile time error.

Q39. Recur method with int parameter

Screen Shot 2022-11-09 at 11 13 18 AM

Wrong: 9 Right: 16

Explanation: The call recur(27) returns the value of recur(recur(9)) since 27 is greater than 10. The call recur(9) returns 18, since 9 is less than or equal to 10. Therefore, recur(recur(9)) is recur(18). The call recur(18) returns recur(recur(6)) since 18 is greater than 10. The call recur(6) returns 12, since 6 is less than or equal to 10. Therefore, recur(recur(6)) is recur(12). The call recur(12) returns recur(recur(4)) since 12 is greater than 10. The call recur(4) returns 8, since 4 is less than or equal to 10. Therefore, recur(recur(4)) is recur(8). The call recur(8) returns 16, since 8 is less than or equal to 10. Therefore, recur(27)returns the value of 16.

Reflection: I missed 5 questions from unit 2 and 2 questions from unit 1, so I think those are areas that I need to focus on a little more. I tend to have difficulty fully understanding code, and I think I need to work on taking my time when reading it and trying to break it down piece by piece.