None of the above Question 28 What is the output of this code sequence? Scanner parse = new Scanner("AA%:BB:CC"); parse.useDelimiter(":"); while(parse.hasNext()) { System.out.print(parse.next() + " "); System.out.println(); } | a. | AA% :BB :CC | | b. | AA% BB CC | | c. | AA% BB CC | | d. | None of the above | 2.5 points Question 29 It is legal to have more than one catch block to match a try block but you must have a finally block if there is more than one catch block. True False 2.5 points Question 30 Assuming file data.txt exists and is successfully opened and contains the following text CS1 What does the file data.txt contain after this code sequence is executed? try { FileOutputStream fos = new FileOutputStream("data.txt ", false ); PrintWriter pw = new PrintWriter( fos ); pw.println( Java Illuminated); pw.close( ); } catch( IOException ioe ) { ioe.printStackTrace( ); } | a. | Java Illuminated | | b. | CS1Java Illuminated | | c. | CS1 Java Illuminated | | d. | Java Illuminated CS1 | Question 33 A non abstract subclass extending an abstract superclass must provide the implementation for all direct abstract superclass abstract methods. True False Question 37 True or False, a method from a subclass that overrides a superclass method having the same method signature cannot call that superclass method from within the overriding subclass method body. True False 2.5 points Question 38 For Question 38 consider the following two classes: public abstract class C { private void foo1() { System.out.println( Hello foo1 ); } public abstract void foo2(); public abstract int foo3(); public void foo1Call() { foo1(); } } public class D extends C { public void foo2() { System.out.println( Hello foo2 ); } public int foo3() { return 10; } private void foo4() { System.out.println( Hello D foo4() ); } } To instantiate an object of class C we could use the following statement(s): | a. | C c2; c2 = new C(); | | b. | C c2 = new C(); | | c. | a or b | | d. | none of the above | 2.5 points Question 39 For Question 39 consider the following two classes: public abstract class C { private void foo1() { System.out.println( Hello foo1 ); } public abstract void foo2(); public abstract int foo3(); public void foo1Call() { foo1(); } } public class D extends C { public void foo2() { System.out.println( Hello foo2 ); } public int foo3() { return 10; } private void foo4() { System.out.println( Hello D foo4() ); } } Which of the following code sequences, if any, will successfully access private method foo1 in class C? | a. | C c2 = new C(); c2.foo1(); | | b. | C c2 ; c2 = new D(); c2.foo1(); | | c. | D d1 = new D(); d1.foo1(); | | d. | C c1 = new D(); c1.foo1Call(); | | e. | None of the above | 2.5 points Question 40 Assuming a StringIndexOutOfBoundsException exception class exists and is a subclass of IndexOutofBoundsException, what is the output of this code sequence? try { String word = new String("avaJ"); System.out.println( word.charAt( 3 ) ); } catch( StringIndexOutOfBoundsException e ) { System.out.println( OOPS! ); } catch( IndexOutOfBoundsException ie ) { System.out.println( ie.getMessage() ); } finally() { System.out.println("Id rather be sailing "); } | a. | OOPS! A message indicating the cause of the exception thrown Id rather be sailing | | b. | J Id rather be sailing | | c. | OOPS! Id rather be sailing | | d. | J | |