Overall Thoughts

This exam was pretty interesting to me, as it was really one of the first ones where I went with next to zero help in, hence the drop in score. I wanted this test to just be a review of my understanding, in order to see where the holes in my knowledge lie. As I cover in the reflection section, I am very dissapointed with my approach to many of these problems and in retrospect, I can see a lot of issues as to the way I take these tests and if I want to succeed in the AP Exam, I NEED to change my strategies.

Corrections

Here, I will provide explanations for the questions I missed, the estimated time it took to do that question, and when applicable, code examples.

Question 4

image.png Here, I picked A as I believed that having the largest value in the start would somehow mess with the loop, but to be honest, it was a dumb mistake. The correct answer is C, the code will not work as intended if the largest value in arr is negative. This is obvious, as the precondition is that the largest value must have a value greater than 0. However, something to note is that Java does have native support for negative integers, so this precondition is pretty useless in real life application.

Time Taken: 2:39

Question 6

image-2.png Here, I picked D as I thought that the mixed arrangement of the letters, which did spell art, would confuse the program. This was another unfounded assumption, as the program would just show false if none of the conditions are met. Throughout this question, I was constantly second guessing myself and that’s what most likely led to this incorrect answer. The correct answer was A because in this case, the method should return false since the word “art” is not found in “rattrap”, “similar”, or “today”. When the method concatenates all three words together, all is assigned the value “rattrapsimilartoday”. The “ar” in “similar” gets concatenated with the “t” in “today”, resulting in the letter combinations for “art” to be in all, causing the method to incorrectly return true.

Time Taken: 4:10

Question 7

image-3.png I picked A here, as I thought that iterating once over the outside would only print the values one time per cycle, however that is incorrect. C is correct because the outer iterating by one while the inner iterating by two would lead to the value printing twice. The outer loop iterates six times for when outer is assigned the values 1 through 6. For each iteration, the number of times the inner loop iterates is dependent on the value of outer. When outer is 1, the inner loop iterates from 1 to 6, incrementing by 1 each time, and prints all even numbers followed by a space (2 4 6). When outer is 2, the inner loop iterates from 2 to 6 and prints all even numbers followed by a space (2 4 6). When outer is 3, the inner loop iterates from 3 to 6 and prints all even numbers followed by a space (4 6). When outer is 4, the inner loop iterates from 4 to 6 and prints all even numbers followed by a space (4 6). When outer is 5, the inner loop iterates from 5 to 6 and prints 6 followed by a space. When outer is 6, the inner loop iterates one time and prints 6 followed by a space.

Time Taken: 8:11 (note that I spent 3 minutes zoning out… this is a repeating thing that is a “grow” for me)

Question 8

image-4.png Here, I had a mishap of forgetting that in this class, CollegeBoard doesn’t use their asinine base 1 system, but just regular java. B is correct, as in the first iteration of the for loop, j is 0. The value of result[0] is assigned the product of row 1, column 0, which is 1 and row 0, column 2, which is 1. Therefore, result[0] is assigned the value 1. The second iteration of the for loop, when j is 1, result[1] is assigned the product of row 1, column 1, which is 2, and row 1, column 2, which is 3. Therefore, result[1] is assigned the value 6. The third iteration of the for loop, when j is 2, result[2] is assigned the product of row 1, column 2, which is 3, and row 2, column 2, which is 1. Therefore, result[2] is assigned the value 3. The final iteration of the for loop, when j is 3, result[3] is assigned the product of row 1, column 3, which is 4, and row 3, column 2, which is 1. Therefore, result[3] is assigned the value 4.

Time Taken: 7:39 (note that I spent 2 minutes zoning out)

Question 9

image-5.png I picked C, as I figured that the statement (int) (Math.random() * 6) would generate a number between 0 and 6, as Math.random() generates a number between 0 and 1. HOWEVER, I missed the fact that it’s not inclusive, meaning it’s really going 0-5. This is why E is correct, as adding 2 to this raises the minimum output from 0 to two, and it raises the maximum output from 10 to 12. Overall, this was a pretty low mistake, and I’m dissapointed I made it.
Time Taken: 11:36 (spent some time discussing things with team)

Question 10

image-6.png I picked A because I believed that Athlete needed to be initialized too in order for TennisPlayer to work. Honestly, I don’t know how I reached this conclusion. Looking back on this, it’s clear as day that the reason A’s statement does in fact work is because even though you extended on another class, at the end of the day, you have a standalone class TennisPlayer that can be called upon without depending on Athlete being called. I, for the life of me, do not know how I spent 4 minutes thinking about this to miss this. D is the correct answer, as variables of the type Student need to reference objects of types that implement Student. The Athlete class does not implement the Student interface.
Time Taken: 4:31

Question 12

image-7.png This is another question where I’m shocked at my clear lack of focus and attention to the question. I picked C because I did not see the exclamation point following the %%, which indicates “and NOT”. There’s not much to say here, as the very little time taken shows that I rushed this question without actually looking at it properly, causing me to make a really stupid mistake.
Time Taken: 0:46 (yes, 46 seconds.)

Question 16

image-8.png I picked C as I thought that the statement row[y] indicated that this has something to do with the index overall. So I connected the dots and thought that it aimed at finding the index of an element with the largest value in the two-dimensional array. This understanding is incorrect, because the algorithm uses a for-each loop to traverse the rows, the row index is not being stored. E is the correct answer, as pior to the start of the nested for loops, the value of found is initialized to the element at row 0, column 0 in values and result is initialized to 0.The outer for loop iterates across all rows in values. The inner for loop iterates across the column indices of each row. When an element is located in the two-dimensional array that is larger than the current value stored in found, then this value is assigned to found and the column index is assigned to result. When the nested loop structure stops executing, the largest element in values is stored in found and the column in which that element was located is stored in result.

Question 19

image-9.png I got this question partially correct. I picked A, which states that only option 1 would print nothing. Although I was right to assume option 1 would print nothing, I falsely assumed the others wouldn’t work either. I was wrong because in condition 2, the while loop will execute one time, since 1, the value of x is less than or equal to 1, however, 1 is not even, so nothing will be printed. The value of x will then be incremented to 3, which is not less than or equal to 1, and the loop will terminate. When the condition is x < 10, as in condition 3, the while loop will execute for x having the value 1, 3, 5, 7, and 9. When x becomes 11 the loop will terminate. Even though the loop executes multiple times, the values assigned to x are not even, so nothing is printed.
Time Taken: 1:17

Question 21

image-10.pnghttps://github.com/h4seeb-cmd/CSA-BLOG/blob/main/images/q21.png?raw=true Here, I picked B, as that is what I believed would be printed at the end. That isn’t entirely wrong, however the reason it’s incorrect is because what I failed to see was the recursive calling of whatsItDo, which would cause D to be correct, as it would constantly take substrings of the current string until there’s nothing to take. This problem took me as long as it did because I was trying to break it down in my head, while eventually just resorting to messing around with it in VSCode, as I wanted to see how substring() worked. I wrote example code that breaks down a string with substring, I then tried subtracting letters to see what would happen. The code is in the below cell:
Time Taken: 9:31

public class SubTest {
    public static void main(String str){
        String sub = str.substring(0, str.length() - 3);
        System.out.println(sub);
    }
}
SubTest.main("HASEEB");
HAS

Question 22

image.png Here, I picked E as I second guessed myself. I orginally got the correct answer, A, but I overthought it and picked E, as I thought going through the rows and columns in that order would pick out the right values in the right orders. I missed that it was just column major order, and that it would not be correct. A is correct as it just iterates over the rows in numbers after going through the rows themselves in a nested for loop format.

Think of it like this: [Goes to next row in numbers after completion [ Goes through each number in the row. Finishes once row is cleaned out ] ]

Time Taken: 3:00

#

Reflection

I am thouroughly dissapointed with myself and how I took this test. If you look at the problem split, it’s clear that all my mistakes were in the first half of the exam, when I took it in class. This is very telling, as combined with the large amount of time I spent doing nothing and zoning out, this test shows that I have a big issue with focus. Most of these mistakes were extremely preventable and frankly stupid, and had I slowed down to read EVERY part of the question, and spent the time actually thinking about what I was putting down, I would have gotten these. I need to work on my ability to focus, and I plan to train myself by doing more of these practice tests online. Doing lots of these tests will help me learn how to manage my focus in these long-winded testing scenarios, and it’s frankly needed if I want to succeed, or even pass the AP exam; as not only did I fail to keep my focus while taking this exam, I also took forever on the questions too, this goes beyond what I worked on in class. Even on the problems I tackled at home, I spent 3-4 minutes on them, which is way too long. Taking more tests will help me with speed as well. Additionally, I need to go back and review the lessons on Java anatomy and inheritance, as I found a clear gap in my knowledge in the way “extends” works and general structure.

However, I do think this test was a “success” as although I performed poorly and I’m dissapointed with myself, this failure taught me what I need to work on, and if I did take this with outside help, I would not have diagnosed all of these massive issues.