avanthikadaita / avanthika_2025

https://avanthikadaita.github.io/avanthika_2025/
Apache License 2.0
0 stars 0 forks source link

Test Corrections #8

Open avanthikadaita opened 1 week ago

avanthikadaita commented 1 week ago
Question Your Answer Correct Answer Explanation
Test case for seqSearchRec(5) C D Choice II causes an ArrayIndexOutOfBoundsException when last reaches -1, and Choice I doesn’t cause an error. Choice III works correctly.
Replace // Line 1 in seqSearchRecHelper A B Option A incorrectly handles the case where target is at index 0. Option B properly returns -1 when last is -1, avoiding an out-of-bounds error while still returning 0 for valid cases.
Output of given code segment A E Answer A would be correct if arr[k + 1] was printed instead of arr[k]. Answer E correctly prints values where arr[k] > arr[k + 1]: 7 2 5 3 3 0.
Replace / expression / in Fleet class A E Answer A is incorrect because getMileage(v) is not valid syntax. Answer E correctly calls the method on each Vehicle object in the loop.
Book and AudioBook classes explanation C B Answer C is incorrect because subclasses inherit methods like toString from the superclass. Answer B is correct because books[0] is of type Book, which cannot directly call methods defined in AudioBook, like pagesPerMinute().
Print odd integers in an array C A Answer C is incorrect because it misuses x as an index in arr[x]. Answer A correctly iterates through each value in arr using an enhanced for loop and prints odd integers by checking x % 2 != 0.
Code to produce same output as the given loop B E Answer B is incorrect because it starts at 1 and increments by 4, producing values like 1, 5, 9, etc., instead of multiples of 4. Answer E correctly starts at 4 and increments by 4, printing 4, 8, 12, ..., up to 100.
Replace / missing code / in Circle class D B Answer D is incorrect because Choice III attempts to directly access private fields x and y of the Point class, which is not allowed. Choice II correctly initializes center using new Point(a, b) and assigns radius.
While loop condition to print 1, 3, 5 C D Answer C is incorrect because Choice II results in an infinite loop when x is never equal to 6. Choice III works alongside Choice I to correctly terminate the loop after printing 1, 3, 5.
avanthikadaita commented 1 week ago

Reflection: I learned the importance of understanding how code works at a deeper level, especially with loops and conditionals. Some of my answers were off because I didn't fully account for edge cases or misunderstood how certain conditions affect the flow. For example, the infinite loop in the while loop question could have been avoided by paying closer attention to the condition's behavior.

Tips for Improvement: Double-check edge cases: Make sure your logic handles all possibilities, including boundary cases like 0 or maximum values. Break down the code: Test small parts of the code or logic in isolation before applying it to larger structures. Read carefully: Pay attention to how each choice interacts with the variables and their limits. Practice more: The more you work through problems, the more patterns and solutions you'll recognize.

Flying-Book commented 1 week ago

Your blog and reflection looks really good. You did amazing on your college board practice too. Some resources I found helpful for improvement and matched your test were... Unit 8 College Board Videos Extra College Board On Demand MCQ review videos