EnsurepassQUESTION 71 Which is a key aspect of composition?   A. Using inheritance B. Method delegation C. Creating abstract classes D. Implementing the composite interface   Correct Answer: B Explanation: In the composition approach, the subclass becomes the "front-end class," and the superclass becomes the"back-end class." With inheritance, a subclass automatically inherits an implemenation of any non-privatesuperclass method that it doesn't override. With composition, by Read more [...]
EnsurepassQUESTION 91 Given the code fragment:     Which code fragment inserted at line ***, enables the code to compile?   A. public void process () throws FileNotFoundException, IOException { super.process (); while ((record = br.readLine()) !=null) { System.out.println(record); }} B. public void process () throws IOException { super.process (); while ((record = br.readLine()) != null) { System.out.println(record); }} C. public void process () throws Exception { super.process Read more [...]
EnsurepassQUESTION 81 Given:     Which two statements, inserted independently at line ***, enable the program to produce the following output:   We have 002 Blue pants that cost $24.99.   A. System.out.printf("We have %03d %s pants that cost $%3.2f.n",quantity, color, price); B. System.out.printf("We have$03d$s pants that cost $$3.2f.n",quantity, color, price); C. String out = String.format ("We have %03d %s pants that cost $%3.2f.n",quantity, color,price); System.out.println(out); Read more [...]
EnsurepassQUESTION 61 Given:     What is the result?   A. 5 B. 6 C. An exception is thrown at runtime D. Compilation fails due to an error on line 6 E. Compilation fails due to an error on line 7   Correct Answer: C Explanation: The code compile fine but java.lang.NullPointerException is thrown at runtime. x has no value. The code would run if line 2 was changed to: Integer x = 3;               QUESTION 62 Given:   ConcurrentMap Read more [...]
EnsurepassQUESTION 51 Given the incomplete pseudo-code for a fork/join framework application:     And given the missing methods:   Process, submit, and splitInHalf   Which three insertions properly complete the pseudo-code?   A. Insert submit at line X. B. Insert splitInHalf at line X. C. Insert process at line X. D. Insert process at line Y. E. Insert splitInHalf at line Y. F. Insert process at line Z. G. Insert submit at line Z.   Correct Answer: Read more [...]
EnsurepassQUESTION 41 Given:     What is the result?   A. peach orange apple B. peach orange C. apple orange D. The program does not compile. E. The program generates an exception at runtime.   Correct Answer: D Explanation: int compare(T obj1, T obj2) 0 if equal positive if obj1 greater negative if obj2 greater The compiler has a problem with the line: public boolean compare(String s1, String s2) { return s1.length() > s2.length(); error: <anonymous comparetest.CompareTest$1> Read more [...]
EnsurepassQUESTION 31 ITEM Table   * ID, INTEGER: PK   * DESCRIP, VARCHAR(100)   * PRICE, REAL   * QUALITY, INTEGER   And given the code fragment (assuming that the SQL query is valid):     What is the result of compiling and executing this code?   A. An exception is thrown at runtime B. Compile fails C. The code prints Error D. The code prints information about Item 110   Correct Answer: C Explanation: Tricky: Compiles successfully ! Not Read more [...]
EnsurepassQUESTION 11 Given the code fragment:     What change should you make to apply good coding practices to this fragment?   A. Add nested try-with-resources statements for the statement and ResultSet declarations. B. Add the statement and ResultSet declarations to the try-with-resources statement. C. Add a finally clause after the catch clause. D. Rethrow SQLException.   Correct Answer: C Explanation: The finally block always executes when the try block exits. Read more [...]
EnsurepassQUESTION 21 Which two codes correctly represent a standard language locale code?   A. ES B. FR C. U8 D. Es E. fr F. u8   Correct Answer: AB Explanation: Language codes are defined by ISO 639, an international standard that assigns two- and three-letter codes tomost languages of the world. Locale uses the two-letter codes to identify the target language.   QUESTION 22 What will the following class print when run?     A. javajava B. lavajava Read more [...]
EnsurepassQUESTION 1 Given the cache class:     A. 101 B. Compilation fails at line 1. C. Compilation fails at line 2. D. Compilation fails at line 3.   Correct Answer: B Explanation: Compilation failure at line:1 Incorrect number of arguments for type Cache<T>; it cannot be parameterized with arguments <>illegal start of typetype cache.Cache does not take parameters.     QUESTION 2 Given:     What is the result?   A. Three Read more [...]