[Free] 2018(Jan) EnsurePass Testinsides Oracle 1z0-809 Dumps with VCE and PDF 31-40

By | January 25, 2018

Ensurepass.com : Ensure you pass the IT Exams
2018 Jan Oracle Official New Released 1z0-809
100% Free Download! 100% Pass Guaranteed!
http://www.EnsurePass.com/1z0-809.html

Java SE 8 Programmer II

Question No: 31

Given the structure of the STUDENT table: Student (id INTEGER, name VARCHAR) Given:

public class Test {

static Connection newConnection =null;

public static Connection get DBConnection () throws SQLException {

try (Connection con = DriveManager.getConnection(URL, username, password)) { newConnection = con;

}

return newConnection;

}

public static void main (String [] args) throws SQLException { get DBConnection ();

Statement st = newConnection.createStatement(); st.executeUpdate(“INSERT INTO student VALUES (102, ‘Kelvin’)”);

}

}

Assume that:

The required database driver is configured in the classpath.

The appropriate database is accessible with the URL, userName, and passWord exists. The SQL query is valid.

What is the result?

  1. The program executes successfully and the STUDENT table is updated with one record.

  2. The program executes successfully and the STUDENT table is NOT updated with any record.

  3. A SQLException is thrown as runtime.

  4. A NullPointerException is thrown as runtime.

Answer: D

Question No: 32

public class StringReplace {

public static void main(String[] args) { String message = quot;Hi everyone!quot;;

System.out.println(quot;message = quot; message.replace(quot;equot;, quot;Xquot;)); }

}

What is the result?

  1. message = Hi everyone!

  2. message = Hi XvXryonX!

  3. A compile time error is produced.

  4. A runtime error is produced.

  5. message =

  6. message = Hi Xveryone!

Answer: B

Question No: 33

Given the code fragment:

Path p1 = Paths.get(“/Pics/MyPic.jpeg”); System.out.println (p1.getNameCount() “:” p1.getName(1)

“:” p1.getFileName());

Assume that the Pics directory does NOT exist. What is the result?

  1. An exception is thrown at run time.

  2. 2:MyPic.jpeg: MyPic.jpeg

  3. 1:Pics:/Pics/ MyPic.jpeg

  4. 2:Pics: MyPic.jpeg

Answer: C

Question No: 34

Given the definition of the Country class:

public class country {

public enum Continent {ASIA, EUROPE} String name;

Continent region;

public Country (String na, Continent reg) { name = na, region = reg;

}

public String getName () {return name;} public Continent getRegion () {return region;}

}

and the code fragment:

Listlt;Countrygt; couList = Arrays.asList (

new Country (“Japan”, Country.Continent.ASIA), new Country (“Italy”, Country.Continent.EUROPE),

new Country (“Germany”, Country.Continent.EUROPE)); Maplt;Country.Continent, Listlt;Stringgt;gt; regionNames = couList.stream ()

.collect(Collectors.groupingBy (Country ::getRegion, Collectors.mapping(Country::getName, Collectors.toList())))); System.out.println(regionNames);

What is the output?

  1. {EUROPE = [Italy, Germany], ASIA = [Japan]}

  2. {ASIA = [Japan], EUROPE = [Italy, Germany]}

  3. {EUROPE = [Germany, Italy], ASIA = [Japan]}

  4. {EUROPE = [Germany], EUROPE = [Italy], ASIA = [Japan]}

Answer: A

Question No: 35

Given the code fragment:

Listlt;Stringgt; str = Arrays.asList (“my”, “pen”, “is”, “your’, “pen”); Predicatelt;Stringgt; test = s -gt; {

int i = 0;

boolean result = s.contains (“pen”); System.out.print(i ) “:”);

return result;

};

str.stream()

.filter(test)

.findFirst()

.ifPresent(System.out ::print); What is the result?

  1. 0 : 0 : pen

  2. 0 : 1 : pen

C. 0 : 0 : 0 : 0 : 0 : pen

D. 0 : 1 : 2 : 3 : 4 :

E. A compilation error occurs.

Answer: E

Question No: 36

The protected modifier on a Field declaration within a public class means that the field

.

  1. Cannot be modified

  2. Can be read but not written from outside the class

  3. Can be read and written from this class and its subclasses only within the same package

  4. Can be read and written from this class and its subclasses defined in any package

Answer: D

Reference:

http://beginnersbook.com/2013/05/java-access-modifiers/

Question No: 37

A method is declared to take three arguments. A program calls this method and passes only two arguments. What is the results?

  1. Compilation fails.

  2. The third argument is given the value null.

  3. The third argument is given the value void.

  4. The third argument is given the value zero.

  5. The third argument is given the appropriate falsy value for its declared type. F) An exception occurs when the method attempts to access the third argument.

Answer: A

Question No: 38

Which statement is true about the single abstract method of the java.util.function.Function interface?

  1. It accepts one argument and returns void.

  2. It accepts one argument and returns boolean.

  3. It accepts one argument and always produces a result of the same type as the argument.

  4. It accepts an argument and produces a result of any data type.

Answer: C

Reference: http://winterbe.com/posts/2014/03/16/java-8-tutorial/ (functions)

Question No: 39

Given:

public final class IceCream { public void prepare() {}

}

public class Cake {

public final void bake(int min, int temp) {} public void mix() {}

}

public class Shop {

private Cake c = new Cake (); private final double discount = 0.25;

public void makeReady () { c.bake(10, 120); }

}

public class Bread extends Cake {

public void bake(int minutes, int temperature) {} public void addToppings() {}

}

Which statement is true?

  1. A compilation error occurs in IceCream.

  2. A compilation error occurs in Cake.

  3. A compilation error occurs in Shop.

  4. A compilation error occurs in Bread

  5. All classes compile successfully.

Answer: D

Question No: 40

Given:

Ensurepass 2018 PDF and VCE

What is the result?

  1. Marrown String out of limits JesOran

  2. Marrown String out of limits Array out of limits

  3. Marrown String out of limits

  4. Marrown NanRed JesOran

Answer: A

100% Ensurepass Free Download!
Download Free Demo:1z0-809 Demo PDF
100% Ensurepass Free Guaranteed!
1z0-809 Dumps

EnsurePass ExamCollection Testking
Lowest Price Guarantee Yes No No
Up-to-Dated Yes No No
Real Questions Yes No No
Explanation Yes No No
PDF VCE Yes No No
Free VCE Simulator Yes No No
Instant Download Yes No No

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.