Page 1203 - AP Computer Science A, 7th edition
P. 1203
6. (E)
mystery(4)
= 3 ∗ mystery(3)
= 3 ∗ 3 ∗ mystery(2)
=3∗3∗3∗ mystery(1)
=3∗3∗3∗3 = 81
7. (A) The declaration of the colors array makes the following assignments: colors[0] = “red”, colors[1] = “green”, and colors[2] = “black”. The loop in segment I adds these values to colorList in the correct order. Segment II fails because colors is an array and therefore can’t use the get method. The code also confuses the lists. Segment III, in its first pass through the loop, attempts to add colors[2] to index pos it ion 2 of colorList. T his w ill c aus e an IndexOutOfBoundsException t o be t hrow n, s inc e index positions 0 and 1 do not yet exist!