Practice Final Exam D Part A. Multiple Choice Questions. Give a reason to support each answer. 4 points for the reason, 1 point for the answer. 1. What is the output? int i, temp; int[] a = {32, 49, 42, 12}; for(i = 0; i <= a.length - 2; i += 2) { temp = a[i]; a[i] = a[i + 1]; a[i + 1] = temp; } System.out.println( a[3] + " " + a[2] + " " + a[1] + " " + a[0]); a. 12 42 32 49 b. 42 12 32 49 b. 49 32 12 42 d. 49 42 39 12 2. Which statement is FALSE? a. A BufferedReader always reads its data line by line from an input file on disk. b. A FileReader always reads its data character by character from an input file on disk. c. To perform input from a file on disk, one needs "throws IOException" or a try-catch block. d. To read from an input file on disk, use the line import java.io.*; 3. An ActionListener is a. the code that displays an applet. b. a class that contains an actionPerformed method. c. the object that is created by the init method. d. one of the triggers for the paint method. Page 2 Part B. Problems. 1. What is the output? public static void main(String[] args) { System.out.println( f(g(5) + 1) + 4 + " " + g(f(3) + 2) + 1); } public static int f(int x) { return x * x + 3; } public static int g(int y) { return 2 * y + 5; } 2. A csv file contains lines with the fields name, gender, and salary. Write an application that finds the name of the woman with the largest salary and the man with the smallest salary. You need only write the main method, not the import statement or the class header. 3. Write an applet that finds the average of a list of doubles that are entered in a textfield. Display the average in the same textfield used to enter the numbers. You decide how to notify the applet when a number is ready to be entered.