Overall Score: 36/39

Question Wrong Answer Right Answer
Q16 calculate method with 2D int array parameter Answer A. Incorrect. The largest value in the two-dimensional array is stored in found, but result is returned. Answer E. Correct. Prior to the start of the nested for loops, the value of found is initialized to the element at row 0, column 0 in values and result is initialized to 0.The outer for loop iterates across all rows in values. The inner for loop iterates across the column indices of each row. When an element is located in the two-dimensional array that is larger than the current value stored in found, then this value is assigned to found and the column index is assigned to result. When the nested loop structure stops executing, the largest element in values is stored in found and the column in which that element was located is stored in result.
Q18 Print statement with mathematical operators Answer E. Incorrect. This would be the result if the division used was floating point division instead of integer division and the result was cast to an int, as in (int)(404.0 / 10 * 10 + 1). Answer D. Correct. The first operation that is executed is 404 / 10. Since both 404 and 10 are integers, integer division is used resulting in 40. The value 40 is then multiplied by 10, resulting in 400, and finally 1 is added, meaning 401 is printed.
Q20 mystery with 1D int array and nested iteration Answer C. Incorrect. This would only be correct if the maximum value in nums was also the value that occurred the most number of times. Answer E. Correct. The outer loop starts at 0 and loops through all the indices in arr. The inner loop starts at the index that is one more than outer and iterates through all indices to the right of this element. For each iteration of the inner loop, the element at the current value of outer is compared with each subsequent element. If the elements are equal, then count is incremented. This results in counting the number of occurrences of each value in the arr. After the inner loop terminates, if the number of occurrences of the current value is greater than previous highest count, the new count is assigned to m and the index of this element is stored in index. The method then returns the value of index, which represents the index of a value that occurs most often in nums.