2015 Practice Exam MCQ - Review Ticket
2015 Practice Exam MCQ - Review Ticket
2015 Practice Exam MCQ - Review Ticket
2015 Practice Exam MCQ - Scores
My score is 34/39 (87%)
Corrections:
Q33: Find maximum in 1D int array
- The correct answer should be Answer E because Choice I sets max to Integer.MIN_VALUE, which is the smallest possible integer value. Then it accesses each element in arr and assigns them value.
Q35: Iterative binarySearch of 1D int array
- The correct answer should Answer C because in the first iteration of the binary search, it will check the value at index (0 + 7) / 2 which is index 3. Since 8 is greater than data[3], start is assigned mid + 1 which is 4 and the process will repeat. In the second iteration of the while loop, it will check the value at index (4 + 7) / 2 which is index 5. Since data[5] is 8, 5 is returned.
Q37: concatWords method with String array
- The correct answer is Answer E because Choice I adds duplicates, Choice II reverses order, and Choice III correctly reverses and selects elements.
Q38: mystery method with 1D int array, v and numVals
- The correct answer is Answer C because the method recursively counts occurrences of
v
innumbers
, summing 1 for matches and 0 otherwise.
Q39: Consider the following code segment.
- The correct answer is Answer C because the first loop replaces all elements with “Alex” while printing original values, and the second loop prints “Alex” for each element.