Chapter 9 Exercises Indicate the effect of the following statements on array scores. Trace each fragment carefully. Show the first 5 elements for parts a and d. a. for (i = 0, i < 100; i++) scores [i] = 100 - i; b. index = -1; cin >> mystery; for (i = 0; i < 100; i++) if (scores[i] == mystery) index = i; cout << index << endl; c. mystery = 0; for (i = 1; i < 100; i++) if (scores[i] < scores [mystery]) mystery = i; cout << mystery << setw (10) << scores [mystery] << endl; d. for (i = 0; i < 100; i++) scores [i] = scores [99 - i]; 1. Rewrite the code fragment for part b of your original exercises as a function that finds the last occurrence of a particular target value and returns its subscript or -1 (not found). Don't print anything in the function. Write a comment for the function preconditions and postconditions too. Show how you would call it to process an array my_data declared as: const int data_size = 100; int my_data[data_size]; Function call: find_last (my_data, data_size); part b. Compare your function to function search in Fig. 9.16. Explain the purpose of the variable not_found in Fig. 9.16. Why do you not need it in your function? 2. Answer question 1 for part c of your original exercises. Your function should return the largest value (not the smallest) in array my_data. part b. After you are done, modify your function so that it finds the smallest value in a subarray bounded by start_index, end_index where 0 <= start_index <= end_index. The boundary points of the subarray, start_index and end_index, should be passed as arguments.