SCORE: 32/39

Screenshot w/ name

Screen Shot 2023-12-21 at 11 02 58 PM

Overall improvements to be making

  • Timing: While I originally timed each question, I realized I needed more time to read through the given pseudocode, and gave up on keeping within time limits. This lead to questions taking anywhere from 4-9 minutes – way too long for an actual test

Screen Shot 2023-12-21 at 11 05 38 PM

  • 2D Arrays: These were the questions I struggled most on

Questions I used outside help for/ struggled on:

Question 8

Screen Shot 2023-12-21 at 11 08 31 PM

I had to watch a walkthrough of someone doing this on paper to understand the question. First they focused on the two numbers passed in (1,2), which were assigned to the variables r and c. They multiplied the two numbers identified in the matrix [r][j] * matrix [j] [c] to get the result. Then they put the 4 multiplied values together for the answer.

REVIEW MATRIX MULTIPLICATION

Question 10

Screen Shot 2023-12-21 at 11 11 35 PM

Had to go back and look at notes on class inheritance but I understand it now.

Question 20

Screen Shot 2023-12-21 at 11 13 15 PM

Had to find someone working through the problem. Here is a summary of what they said:

Two for loops used to compare current index in array to all other numbers. The inner for loop is one number higher in the array, so if statement in the inner loop has correct counter values (outer vs. inner). The ‘m’ variable is a temporary holder for the max number of duplicates (-1 initially since there can’t be -1 duplicates). It us set once in first pass through, then replacaed if a higher number of duplicates is found.

Question 26

Screen Shot 2023-12-21 at 11 17 53 PM

I had made a (slightly educated) guessed on this one to save time. However after going back to work out the problem on paper I understood it.

Corrections:

Question 9

Screen Shot 2023-12-21 at 11 20 12 PM

This would give a sum between the possible values of 0 - 10 (since a random integer is generated between 0-5, NOT 1-6). Also, two dice can not give a sum of 0 or 2. So two needs to be added to the initial sum to give a true sum for the simulation.

Question 14

Screen Shot 2023-12-21 at 11 22 47 PM

If a and b are equal in value, but still larger than c, the code would still return c since the statements a > b or b > a are not evaluating to truw.

Question 18

Screen Shot 2023-12-21 at 11 23 45 PM

REMEMBER the calculations are being done as an integer – not a double.

404 / 10 * 10 +1

404 / 10 = 40 40 * 10 = 400 400 + 1 = 401

Question 22

Screen Shot 2023-12-21 at 11 26 54 PM

The answer I picked would lead to an out of bounds error, since there are 2 rows, not 3. For the correct answer, each row is assigned to the array row temporarily, and then iterated through. As the code iterates through row, each index is assigned to the value (n), and then returned.

Question 24

Screen Shot 2023-12-21 at 11 31 13 PM

This question was a complete guess. However, for the right answer, II and III can be added to the class without creating a compile time error is because they are new methods with new signatures. For I, it’s a change to an existing method so programs that use this class need to be recompiled.

Question 25

Screen Shot 2023-12-21 at 11 32 03 PM

the inner loop starts at y = x or the same index as the outer loop, so it is one less pass for each increment of the outer loop. By working through each pass on paper, the final value of the count variable ends up being 10 (not 8, since that would be the value of count if the inner loop started iterating at 0 each time instead of x.)

Question 32

Screen Shot 2023-12-21 at 11 35 15 PM

Code cell 1 works as well, since integer.MIN_VALUE is 0. The max is initialized to 0. Next, the for loop iterates through the array comparing max to the current value in the array. The variable max is replaced with value when max is less than value, meaning a new max was found.