Overall Score: 36/40

Alt text

Question 3

Alt text

My Answer:

double hours = Math.abs(marker1 - marker2 / 60.0);

Reason why incorrect:

Because java uses PEMDAS, this option is only dividing marker2 by 60, rather than the difference of marker1 and marker2.

Correct Answer:

double hours = Math.abs(marker1 - marker2) / 60.0;

Reason:

This will find the change in distance between markers, and then divide by the speed of 60 miles per hour. By taking the absolute value, the result will be the total time elapsed between two markers.

Question 8

Alt text

My Answer

In lines 8 and 9, int values cannot be assigned to double variables.

Reason why incorrect:

You can assign int value to double variables. However, you cannot assign double values to int variables.

Correct Answer

In lines 14 and 15, the variables n1 and n2 are not defined.

Reason:

n1 and n2 variables are not defined in the class, nor in the incrementPoints method. For this reason, they cannot be used in the incrementPoints method. num1 and num2 variables should be used instead.

Question 31

Alt text

My Answer:

I and III only

Reason why Incorrect:

Option III misuses the variable i. Since a for : each loop is used, the variable i represents each element, rather than the index. For this reason, "nums[i]" does not accurately represent each element.

Correct Answer:

I only.

Reason:

Option II does not iterate through the first element of the array.

Question 36

Alt text

My Answer:

When a and b are both even

Reason why Incorrect:

As an example, if a = 6, and b = 4. a/b = 1, and methodOne returns 1. methodTwo runs for when i = 0 and i = 4, which returns 2.

Correct Answer:

When a % b is equal to zero

Reason:

If a % b is not equal to 0, methodOne returns a/b. while methodTwo returns a/b + 1.

Overall Reflection

Skills I missed:

  • Skill 1.B: Determine code that would be used to complete code segments.
  • Skill 4.B: Identify errors in program code.
  • Skill 5.D: Describe the initial conditions that must be met for a program segment to work as intended or described.

I struggled on many problems that required me to understand the issues with broken code. Along with this, I need to improve on being able to figure out if a code segment will work as intended or not. To help myself learn this skill, I should try to explain to myself how provided code works, one step at a time. In doing this, I should be able to figure out how something can go wrong, or what values will be outputted/returned.