My Score: 35/40, 87.5%

Overview

The Good

  • I didn’t miss any questions in 5 out of the 8 tested units
  • I didn’t miss any questions when it came to analyzing how correct a program was or conditions to produce some output
    • I did okay on the other two skills as well, with an 80% to a 90% on them

The Bad

  • I struggled to notice when College Board put certain sneaky things into certain questions (like subtracting 1 from the end of a loop or starting at 1 in a loop to make things tricky)
  • I struggled with Skill 2.B and 2.C, both related to evaluating code and determining the output
    • Skill 2.B: Determine the result or output based on statement execution order in a code segment without method calls (other than output).
    • Skill 2.C: Determine the result or output based on the statement execution order in a code segment containing method calls.
  • I did very bad with certain topics
    • Topic 2.7: String Methods
    • Topic 2.9: Using the Math Class
    • Topic 6.2: Traversing Arrays

What I must do

  • I must practice my ability to evaluate Java code by hand
    • How? I will do previous MCQs that have been released by College Board

The Questions I got Wrong

Question 12

Topics

  • 2.7: String Methods
  • 4.3: Developing Algorithms Using Strings

Skill

  • 2.C: Determine the result or output based on the statement execution order in a code segment containing method calls.


Question

Consider the following method.

Question Image

What is returned as a result of the call mystery("computer")?

A. “computer”

B. “cmue”

C. “optr” ✅

D. “ompute”

E. Nothing is returned because an IndexOutOfBoundsException is thrown. ❌


Reflection

I thought there would be an error since I made the mistake of forgetting that substring()’s second parameter is exclusive. However, in reality this method simply takes every other character of the string, creating "optr".

Question 15

Topics

  • 6.2: Traversing Arrays

Skill

  • 1.B: Determine code that would be used to complete code segments.


Question

Consider the following method, isSorted, which is intended to return true if an array of integers is sorted in nondecreasing order and to return false otherwise.

Question 15 Image

Which of the following can be used to replace /* missing code */ so that isSorted will work as intended?

Question 15 Image 2

A. I only. ✅

B. II only.

C. III only.

D. I and II only.

E. I and III only. ❌


Reflection

I thought option III would work since it seemed correct for the most part. However, I missed a small detail, which was that the loop will immediately return when it detects that one pair of elements are in sorted order, meaning it won’t check the rest of the array.

Question 21

Topics

  • 2.9: Using the Math Class
  • 8.2: Traversing 2D Arrays

Skill

  • 1.B: Determine code that would be used to complete code segments.


Question

Consider the following method, which is intended to return the element of a 2-dimensional array that is closest in value to a specified number, val.

Question 21 Image

Which of the following could be used to replace / * missing code * / so that findClosest will work as intended?

A. val - row [num] < minDiff

B. Math.abs (num - minDiff) < minDiff ❌

C. val - num < 0.0

D. Math.abs (num - val) < minDiff ✅

E. Math.abs (row [num] - val) < minDiff


Reflection

This mistake seems to have been an error that came from rushing and not taking my time on the problem, since this is a problem I should’ve been able to solve.

Question 24

Topics

  • 8.1: 2D Arrays

Skill

  • 2.B: Determine the result or output based on statement execution order in a code segment without method calls (other than output).


Question

Consider the following code segment.

Question 24 Image

What is printed as a result of executing the code segment?

A. 3 ❌

B. 4

C. 5

D. 7 ✅

E. 8


Reflection

Like with question 21, I seem to have been rushing here. I was thinking of what was at row 2 column 0, when the question asked for the value at row 0 column 2.

Question 30

Topics

  • 2.7: String Methods

Skill

  • 2.C: Determine the result or output based on the statement execution order in a code segment containing method calls.


Question

Consider the following method.

Question 30 Image

What value is returned as a result of the call scramble(“compiler”, 3)?

A. “compiler”

B. “pilercom” ❌

C. “ilercom” ✅

D. “ilercomp”

E. No value is returned because an IndexOutOfBoundsException will be thrown.


Reflection

I did not read the method properly. It starts the substring at howFar+1, not at howFar.