BobTheFarmer / Colin-Blog3

MIT License
0 stars 2 forks source link

2015 Practice Exam Reflection #10

Open BobTheFarmer opened 10 months ago

BobTheFarmer commented 10 months ago
Screenshot 2023-12-22 at 6 21 23 PM

Corrections

Question 8

Screenshot 2023-12-22 at 6 23 02 PM

I didn't realize this would be the result if the call was operation(mat, 2, 1); or if the code segment in the for loop was result[j] = matrix[j][r] * matrix[c][j]; I mixed up that when accessing an element in a 2D array, the first index is the row and the second index is the column.

Question 19

Screenshot 2023-12-22 at 6 24 32 PM

I didn't realize that in condition III, the while loop will execute for x having the value 1, 3, 5, 7, and 9. So when x becomes 11 the loop will end. Even though the loop executes multiple times, the values assigned to x are not even, so nothing is printed.

Question 20

Screenshot 2023-12-22 at 6 25 30 PM

It returns the index, not m, I read it too fast.

Question 23

Screenshot 2023-12-22 at 6 25 59 PM

At the end of each pass, all original values will still be in the array, however, the order may be altered. So my answer did not make sense for the second line.

Question 28

Screenshot 2023-12-22 at 6 28 49 PM

I didn't think about how the / Assign to temp / expression is evaluated for every iteration of the outer loop. Therefore, the assignment is made 5 times.

Question 30

Screenshot 2023-12-22 at 6 29 41 PM

I oversaw that choice III will compute the incorrect price for numBoxes greater than or equal to 5 and will compute totalCost as numBoxes * 5.00 in all cases. This is because if numBoxes is greater than or equal to 5, it is also greater than 0 and the first if statement will evaluate to true and skip over the else statements.

Question 37

Screenshot 2023-12-22 at 6 30 46 PM

Because for choice II starts at the end of the array words and adds each word to result working right to left until it reaches the startIndex, the elements would be concatenated in reverse order.

Question 39

Screenshot 2023-12-22 at 6 31 51 PM

I read it wrong, this would the result if the first for loop used the get method instead of the set method.

Conclusion

I felt pretty out of practice reading code on a low level. I usually just read the code on a high level and just run it to see if it works, then using debugging techniques rather than looking at the low level too deeply. But, reading how code would compile and run is the biggest part of the ap exam so this is something I should focus on more in general.

Specifically one thing I had trouble with was the details of how inheritance syntax is in Java. I was able to get most of these questions right by narrowing down the other multiple choices by knowing they would not work. But I think it would be worthwhile both for the tests and myself to learn what causes errors with inheritance specially as that was my biggest struggle.

I was also really slow tracing nested loops which was not too big a problem but could be on a real exam.

ChatGPT conclusion

I also gave chatGPT my mistakes and asked it what the biggest problems are