Page 1360 - AP Computer Science A, 7th edition
P. 1360
39. (E) In choice E, findMost returns the value 5. This is because count has not been reset to 1, so that when 5 is encountered, the test count>maxCountSoFar is true, causing mostSoFar to be incorrectly re-assigned to 5. In choices A, B, and C, the outer while loop is not entered again, since a second run of equal values doesn’t exist in the array. So mostSoFar comes out with the correct value. In choice D, when the outer loop is entered again, the test count>maxCountSoFar just happens to be true anyway and the correct value is returned. The algorithm fails whenever a new string of equal values is found whose length is shorter than a previous string of equal values.