1. T/F: The following code will print out 1: String[] strings = new String[10]; strings[0] = "banana"; System.out.println(strings.length); 2. T/F: Given a class B that extends class A, the following code is legal (will compile and run) assuming B has a zero parameter constructor: ArrayList a = new ArrayList(); B b = new B(); a.add(b); 3. What is the benefit of using the "final" keyword? 4. What does this method do and what is the big-O runtime? public String mystery(ArrayList input ){ String mysteryVar = ""; int c = 0; for( int i = 0; i < input.size(); i++ ){ int num = 1; for( int j = i+1; j < input.size(); j++ ){ if( input.get(i).equals(input.get(j))){ num++; } } if( num > c ){ c = num; mysteryVar = input.get(i); } } return mysteryVar; } 5. What does the main method in the Mystery class below print out? public class Mystery { private int mystery; private int original; public Mystery(int m){ mystery = m; original = m; } public void mystery1(int num){ mystery += num; } public void mystery2(){ mystery = original; } public boolean mystery3(){ return mystery == original; } public String toString(){ return "The mystery number is: " + mystery; } public static void main(String[] args){ Mystery m = new Mystery(0); System.out.println(m); System.out.println(m.mystery3()); System.out.println("--"); m.mystery1(10); System.out.println(m); System.out.println(m.mystery3()); System.out.println("--"); m.mystery2(); System.out.println(m); System.out.println(m.mystery3()); System.out.println("--"); } } 6. Write a method called reverseFile that reverses the ordering of the lines in a file. (Hint: use an ArrayList). 7. Which of the following things could be done fast (O(1)) in the worst case on an ArrayList: - Remove the first thing from the list - Remove the last thing from the list - Remove a value at a particular index in the list - Swap two values in the list, given their indices - Remove all items from the list, i.e., clear the list (justify your answer for this one)