Summer Special - 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: c4sdisc65

1z0-809 PDF

$38.5

$109.99

3 Months Free Update

  • Printable Format
  • Value of Money
  • 100% Pass Assurance
  • Verified Answers
  • Researched by Industry Experts
  • Based on Real Exams Scenarios
  • 100% Real Questions

1z0-809 PDF + Testing Engine

$61.6

$175.99

3 Months Free Update

  • Exam Name: Java SE 8 Programmer II
  • Last Update: Jun 17, 2025
  • Questions and Answers: 196
  • Free Real Questions Demo
  • Recommended by Industry Experts
  • Best Economical Package
  • Immediate Access

1z0-809 Engine

$46.2

$131.99

3 Months Free Update

  • Best Testing Engine
  • One Click installation
  • Recommended by Teachers
  • Easy to use
  • 3 Modes of Learning
  • State of Art Technology
  • 100% Real Questions included

1z0-809 Practice Exam Questions with Answers Java SE 8 Programmer II Certification

Question # 6

Given:

class CheckClass {

public static int checkValue (String s1, String s2) {

return s1 length() – s2.length();

}

}

and the code fragment:

String[] strArray = new String [] {“Tiger”, “Rat”, “Cat”, “Lion”}

//line n1

for (String s : strArray) {

System.out.print (s + “ “);

}

Which code fragment should be inserted at line n1 to enable the code to print Rat Cat Lion Tiger?

A.

Arrays.sort(strArray, CheckClass : : checkValue);

B.

Arrays.sort(strArray, (CheckClass : : new) : : checkValue);

C.

Arrays.sort(strArray, (CheckClass : : new).checkValue);

D.

Arrays.sort(strArray, CheckClass : : new : : checkValue);

Full Access
Question # 7

Given the code fragment:

1z0-809 question answer

What is the result?

A.

A compilation error occurs at line n1.

B.

Logged out at: 2015-01-12T21:58:19.880Z

C.

Can’t logout

D.

Logged out at: 2015-01-12T21:58:00Z

Full Access
Question # 8

Given the code fragment:

1z0-809 question answer

What is the result?

A.

DavidDavid[Susan, Allen]

B.

SusanSusan[Susan, Allen]

C.

SusanAllen[David]

D.

DavidAllen[Susan]

E.

SusanAllen[Susan, David]

Full Access
Question # 9

Given the code fragment:

List str = Arrays.asList (“my”, “pen”, “is”, “your’, “pen”);

Predicate test = s -> {

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?

A.

0 : 0 : pen

B.

0 : 1 : pen

C.

0 : 0 : 0 : 0 : 0 : pen

D.

0 : 1 : 2 : 3 : 4 :

E.

A compilation error occurs.

Full Access
Question # 10

Given the code fragment:

Stream> iStr= Stream.of (

Arrays.asList (“1”, “John”),

Arrays.asList (“2”, null)0;

Stream< nInSt = iStr.flatMapToInt ((x) -> x.stream ());

nInSt.forEach (System.out :: print);

What is the result?

A.

1John2null

B.

12

C.

A NullPointerException is thrown at run time.

D.

A compilation error occurs.

Full Access
Question # 11

Given:

1z0-809 question answer

and the code fragment:

1z0-809 question answer

What is the result?

A.

0

B.

A compilation error occurs at line n1.

C.

An Exception is thrown at run time.

D.

2

Full Access
Question # 12

Given that these files exist and are accessible:

/sports/info.txt

/sports/cricket/players.txt

/sports/cricket/data/ODI.txt

and given the code fragment:

int maxDepth =2;

Stream paths = Files.find(Paths.get(“/sports”),

maxDepth,

(p, a) -> p.getFileName().toString().endsWith (“txt”),

FileVisitOption.FOLLOW_LINKS);

Long fCount = paths.count();

System.out.println(fCount);

Assuming that there are NO soft-link/symbolic links to any of the files in the directory structure, what is the result?

A.

1

B.

2

C.

3

D.

An Exception is thrown at runtime.

Full Access
Question # 13

Given the code fragment:

String str = “Java is a programming language”;

ToIntFunction indexVal = str: : indexOf; //line n1

int x = indexVal.applyAsInt(“Java”);//line n2

System.out.println(x);

What is the result?

A.

0

B.

1

C.

A compilation error occurs at line n1.

D.

A compilation error occurs at line n2.

Full Access
Question # 14

Given:

public class Canvas implements Drawable {

public void draw () { }

}

public abstract class Board extends Canvas { }

public class Paper extends Canvas {

protected void draw (int color) { }

}

public class Frame extends Canvas implements Drawable {

public void resize () { }

abstract void open ();

}

public interface Drawable {

public abstract void draw ();

}

Which statement is true?

A.

Board does not compile.

B.

Paper does not compile.

C.

Frame does not compile.

D.

Drawable does not compile.

E.

All classes compile successfully.

Full Access
Question # 15

Given the definition of the Emp class:

public class Emp

private String eName;

private Integer eAge;

Emp(String eN, Integer eA) {

this.eName = eN;

this.eAge = eA;

}

public Integer getEAge () {return eAge;}

public String getEName () {return eName;}

}

and code fragment:

Listli = Arrays.asList(new Emp(“Sam”, 20), New Emp(“John”, 60), New Emp(“Jim”, 51));

Predicate agVal = s -> s.getEAge() <= 60;//line n1

li = li.stream().filter(agVal).collect(Collectors.toList());

Stream names = li.stream()map.(Emp::getEName);//line n2

names.forEach(n -> System.out.print(n + “ “));

What is the result?

A.

Sam John Jim

B.

John Jim

C.

A compilation error occurs at line n1.

D.

A compilation error occurs at line n2.

Full Access
Question # 16

Given the content of Operator.java, EngineOperator.java, and Engine.java files:

1z0-809 question answer

and the code fragment:

1z0-809 question answer

What is the result?

A.

The Engine.java file fails to compile.

B.

The EngineOperator.java file fails to compile.

C.

The Operator.java file fails to compile.

D.

ON OFF

Full Access
Question # 17

Given:

1z0-809 question answer

and the code fragment:

1z0-809 question answer

Which modification enables the code fragment to print Speaker?

A.

Implement Predicate in the Product.ProductFilter class and replace line n2 with .filter (p -> p.ProductFilter.test (p))

B.

Replace line n1 with:public static boolean isAvailable (Product p) {

C.

Replace line n2 with:.filter (p -> p.ProductFilter: :isAvailable (p))

D.

Replace line n2 with:.filter (p -> Product: :ProductFilter: :isAvailable ())

Full Access
Question # 18

Given:

1z0-809 question answer

and the code fragment:

1z0-809 question answer

Which definition of the ColorSorter class sorts the blocks list?

A.
B.
C.
D.
Full Access
Question # 19

Given:

1z0-809 question answer

and

1z0-809 question answer

Which interface from the java.util.function package should you use to refactor the class Txt?

A.

Consumer

B.

Predicate

C.

Supplier

D.

Function

Full Access
Question # 20

Given the code fragment:

1z0-809 question answer

Assume that:

The required database driver is configured in the classpath.

The appropriate database is accessible with the dbURL, userName, and passWord exists

The Employee table has a column ID of type integer and the SQL query matches one record.

What is the result?

A.

Compilation fails at line 14.

B.

Compilation fails at line 15.

C.

The code prints the employee ID.

D.

The code prints Error.

Full Access
Question # 21

Given the code fragment:

1z0-809 question answer

Which is the valid definition of the Course enum?

1z0-809 question answer

1z0-809 question answer

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 22

Given the definition of the Emp class:

public class Emp

private String eName;

private Integer eAge;

Emp(String eN, Integer eA) {

this.eName = eN;

this.eAge = eA;

}

public Integer getEAge () {return eAge;}

public String getEName () {return eName;}

}

and code fragment:

Listli = Arrays.asList(new Emp(“Sam”, 20), New Emp(“John”, 60), New Emp(“Jim”, 51));

Predicate agVal = s -> s.getEAge() > 50;//line n1

li = li.stream().filter(agVal).collect(Collectors.toList());

Stream names = li.stream()map.(Emp::getEName);//line n2

names.forEach(n -> System.out.print(n + “ “));

What is the result?

A.

Sam John Jim

B.

John Jim

C.

A compilation error occurs at line n1.

D.

A compilation error occurs at line n2.

Full Access
Question # 23

Given the code fragment:

Path file = Paths.get (“courses.txt”);

// line n1

Assume the courses.txt is accessible.

Which code fragment can be inserted at line n1 to enable the code to print the content of the courses.txt file?

A.

List fc = Files.list(file);fc.stream().forEach (s - > System.out.println(s));

B.

Stream fc = Files.readAllLines (file);fc.forEach (s - > System.out.println(s));

C.

List fc = readAllLines(file);fc.stream().forEach (s - > System.out.println(s));

D.

Stream fc = Files.lines (file);fc.forEach (s - > System.out.println(s));

Full Access
Question # 24

Given:

final class Folder {//line n1

//line n2

public void open () {

System.out.print(“Open”);

}

}

public class Test {

public static void main (String [] args) throws Exception {

try (Folder f = new Folder()) {

f.open();

}

}

}

Which two modifications enable the code to print Open Close? (Choose two.)

A.

Replace line n1 with:class Folder implements AutoCloseable {

B.

Replace line n1 with:class Folder extends Closeable {

C.

Replace line n1 with:class Folder extends Exception {

D.

At line n2, insert:final void close () {System.out.print(“Close”);}

E.

At line n2, insert:public void close () throws IOException {System.out.print(“Close”);}

Full Access
Question # 25

For which three objects must a vendor provide implementations in its JDBC driver? (Choose three.)

A.

Time

B.

Date

C.

Statement

D.

ResultSet

E.

Connection

F.

SQLException

G.

DriverManager

Full Access
Question # 26

Given:

1z0-809 question answer

and the command:

java Product 0

What is the result?

A.

An AssertionError is thrown.

B.

A compilation error occurs at line n1.

C.

New Price: 0.0

D.

A NumberFormatException is thrown at run time.

Full Access
Question # 27

Given the code fragment:

1z0-809 question answer

What is the result?

A.

A compilation error occurs at line n1.

B.

courseJava

C.

Javacourse

D.

A compilation error occurs at line n2.

Full Access
Question # 28

Given:

class Student {

String course, name, city;

public Student (String name, String course, String city) {

this.course = course; this.name = name; this.city = city;

}

public String toString() {

return course + “:” + name + “:” + city;

}

public String getCourse() {return course;}

public String getName() {return name;}

public String getCity() {return city;}

and the code fragment:

List stds = Arrays.asList(

new Student (“Jessy”, “Java ME”, “Chicago”),

new Student (“Helen”, “Java EE”, “Houston”),

new Student (“Mark”, “Java ME”, “Chicago”));

stds.stream()

.collect(Collectors.groupingBy(Student::getCourse))

.forEach(src, res) -> System.out.println(res));

What is the result?

A.

A compilation error occurs.

B.

Java EEJava ME

C.

[Java EE: Helen:Houston][Java ME: Jessy:Chicago, Java ME: Mark:Chicago]

D.

[Java ME: Jessy:Chicago, Java ME: Mark:Chicago][Java EE: Helen:Houston]

Full Access
Question # 29

Given:

1z0-809 question answer

and the code fragment:

1z0-809 question answer

Which two code fragments, when inserted at line n1 independently, enable the code to print TruckCarBike?

A.

.sorted ((v1, v2) -> v1.getVId() < v2.getVId())

B.

.sorted (Comparable.comparing (Vehicle: :getVName)).reversed ()

C.

.map (v -> v.getVid()).sorted ()

D.

.sorted((v1, v2) -> Integer.compare(v1.getVId(), v2.getVid()))

E.

.sorted(Comparator.comparing ((Vehicle v) -> v.getVId()))

Full Access
Question # 30

Given the code fragments:

class Caller implements Callable {

String str;

public Caller (String s) {this.str=s;}

public String call()throws Exception { return str.concat (“Caller”);}

}

class Runner implements Runnable {

String str;

public Runner (String s) {this.str=s;}

public void run () { System.out.println (str.concat (“Runner”));}

}

and

public static void main (String[] args) InterruptedException, ExecutionException {

ExecutorService es = Executors.newFixedThreadPool(2);

Future f1 = es.submit (new Caller (“Call”));

Future f2 = es.submit (new Runner (“Run”));

String str1 = (String) f1.get();

String str2 = (String) f2.get();//line n1

System.out.println(str1+ “:” + str2);

}

What is the result?

A.

The program prints:Run RunnerCall Caller : nullAnd the program does not terminate.

B.

The program terminates after printing:Run RunnerCall Caller : Run

C.

A compilation error occurs at line n1.

D.

An Execution is thrown at run time.

Full Access
Question # 31

Given the code fragment:

public class Foo {

public static void main (String [ ] args) {

Map unsortMap = new HashMap< > ( );

unsortMap.put (10, “z”);

unsortMap.put (5, “b”);

unsortMap.put (1, “d”);

unsortMap.put (7, “e”);

unsortMap.put (50, “j”);

Map treeMap = new TreeMap (new

Comparator ( ) {

@Override public int compare (Integer o1, Integer o2) {return o2.compareTo

(o1); } } );

treeMap.putAll (unsortMap);

for (Map.Entry entry : treeMap.entrySet () ) {

System.out.print (entry.getValue () + “ “);

}

}

}

What is the result?

A.

A compilation error occurs.

B.

d b e z j

C.

j z e b d

D.

z b d e j

Full Access
Question # 32

Which two are elements of a singleton class? (Choose two.)

A.

a transient reference to point to the single instance

B.

a public method to instantiate the single instance

C.

a public static method to return a copy of the singleton reference

D.

a private constructor to the class

E.

a public reference to point to the single instance

Full Access
Question # 33

Given the code fragment:

UnaryOperator uo1 = s -> s*2;line n1

List loanValues = Arrays.asList(1000.0, 2000.0);

loanValues.stream()

.filter(lv -> lv >= 1500)

.map(lv -> uo1.apply(lv))

.forEach(s -> System.out.print(s + “ “));

What is the result?

A.

4000.0

B.

4000

C.

A compilation error occurs at line n1.

D.

A compilation error occurs at line n2.

Full Access
Question # 34

Given:

1z0-809 question answer

What is the result?

A.

Bar HelloFoo Hello

B.

Bar HelloBaz Hello

C.

Baz Hello

D.

A compilation error occurs in the Daze class.

Full Access
Question # 35

Which code fragment is required to load a JDBC 3.0 driver?

A.

Connection con = Connection.getDriver(“jdbc:xyzdata://localhost:3306/EmployeeDB”);

B.

Class.forName(“org.xyzdata.jdbc.NetworkDriver”);

C.

Connection con = DriverManager.getConnection(“jdbc:xyzdata://localhost:3306/EmployeeDB”);

D.

DriverManager.loadDriver (“org.xyzdata.jdbc.NetworkDriver”);

Full Access
Question # 36

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?

A.

A compilation error occurs in IceCream.

B.

A compilation error occurs in Cake.

C.

A compilation error occurs in Shop.

D.

A compilation error occurs in Bread

E.

All classes compile successfully.

Full Access
Question # 37

Given the code fragment:

List values = Arrays.asList (1, 2, 3);

values.stream ()

.map(n -> n*2)//line n1

.peek(System.out::print)//line n2

.count();

What is the result?

A.

246

B.

The code produces no output.

C.

A compilation error occurs at line n1.

D.

A compilation error occurs at line n2.

Full Access
Question # 38

Given:

public class Canvas implements Drawable {

public void draw () { }

}

public abstract class Board extends Canvas { }

public class Paper extends Canvas {

protected void draw (int color) { }

}

public class Frame extends Canvas implements Drawable {

public void resize () { }

}

public interface Drawable {

public abstract void draw ();

}

Which statement is true?

A.

Board does not compile.

B.

Paper does not compile.

C.

Frame does not compile.

D.

Drawable does not compile.

E.

All classes compile successfully.

Full Access
Question # 39

Given:

class UserException extends Exception { }

class AgeOutOfLimitException extends UserException { }

and the code fragment:

class App {

public void doRegister(String name, int age)

throws UserException, AgeOutOfLimitException {

if (name.length () < 6) {

throw new UserException ();

} else if (age >= 60) {

throw new AgeOutOfLimitException ();

} else {

System.out.println(“User is registered.”);

}

}

public static void main(String[ ] args) throws UserException {

App t = new App ();

t.doRegister(“Mathew”, 60);

}

}

What is the result?

A.

User is registered.

B.

An AgeOutOfLimitException is thrown.

C.

A UserException is thrown.

D.

A compilation error occurs in the main method.

Full Access
Question # 40

Which two reasons should you use interfaces instead of abstract classes? (Choose two.)

A.

You expect that classes that implement your interfaces have many common methods or fields, or require access modifiers other than public.

B.

You expect that unrelated classes would implement your interfaces.

C.

You want to share code among several closely related classes.

D.

You want to declare non-static on non-final fields.

E.

You want to take advantage of multiple inheritance of type.

Full Access
Question # 41

Given:

class Book {

int id;

String name;

public Book (int id, String name) {

this.id = id;

this.name = name;

}

public boolean equals (Object obj) { //line n1

boolean output = false;

Book b = (Book) obj;

if (this.id = = b.id) {

output = true;

}

return output;

}

}

and the code fragment:

Book b1 = new Book (101, “Java Programing”);

Book b2 = new Book (102, “Java Programing”);

System.out.println (b1.equals(b2)); //line n2

Which statement is true?

A.

The program prints true.

B.

The program prints false.

C.

A compilation error occurs. To ensure successful compilation, replace line n1 with:boolean equals (Book obj) {

D.

A compilation error occurs. To ensure successful compilation, replace line n2 with:System.out.println (b1.equals((Object) b2));

Full Access
Question # 42

Given the content of /resourses/Message.properties:

welcome1=”Good day!”

and given the code fragment:

Properties prop = new Properties ();

FileInputStream fis = new FileInputStream (“/resources/Message.properties”);

prop.load(fis);

System.out.println(prop.getProperty(“welcome1”));

System.out.println(prop.getProperty(“welcome2”, “Test”));//line n1

System.out.println(prop.getProperty(“welcome3”));

What is the result?

A.

Good day!Testfollowed by an Exception stack trace

B.

Good day!followed by an Exception stack trace

C.

Good day!Testnull

D.

A compilation error occurs at line n1.

Full Access
Question # 43

Given:

class FuelNotAvailException extends Exception { }

class Vehicle {

void ride() throws FuelNotAvailException {//line n1

System.out.println(“Happy Journey!”);

}

}

class SolarVehicle extends Vehicle {

public void ride () throws Exception {//line n2

super ride ();

}

}

and the code fragment:

public static void main (String[] args) throws FuelNotAvailException, Exception {

Vehicle v = new SolarVehicle ();

v.ride();

}

Which modification enables the code fragment to print Happy Journey!?

A.

Replace line n1 with public void ride() throws FuelNotAvailException {

B.

Replace line n1 with protected void ride() throws Exception {

C.

Replace line n2 with void ride() throws Exception {

D.

Replace line n2 with private void ride() throws FuelNotAvailException {

Full Access
Question # 44

Given:

class FuelNotAvailException extends Exception { }

class Vehicle {

void ride() throws FuelNotAvailException {//line n1

System.out.println(“Happy Journey!”);

}

}

class SolarVehicle extends Vehicle {

public void ride () throws FuelNotAvailException {//line n2

super ride ();

}

}

and the code fragment:

public static void main (String[] args) throws Exception {

Vehicle v = new SolarVehicle ();

v.ride();

}

Which modification enables the code fragment to print Happy Journey!?

A.

Replace line n1 with public void ride() throws FuelNotAvailException {

B.

Replace line n1 with protected void ride() throws Exception {

C.

Replace line n2 with void ride() throws Exception {

D.

Replace line n2 with private void ride() throws FuelNotAvailException {

Full Access
Question # 45

Given:

1z0-809 question answer

Which option fails?

A.

Foo mark = new Foo (“Steve”, 100);

B.

Foo pair = Foo.twice (“Hello World!”);

C.

Foo percentage = new Foo(“Steve”, 100);

D.

Foo grade = new Foo <> (“John”, “A”);

Full Access
Question # 46

Given the code fragments:

class Employee {

Optional

address;

Employee (Optional

address) {

this.address = address;

}

public Optional

getAddress() { return address; }

}

class Address {

String city = “New York”;

public String getCity { return city: }

public String toString() {

return city;

}

}

and

Address address = new Address;

Optional

addrs1 = Optional.ofNullable (address);

Employee e1 = new Employee (addrs1);

String eAddress = (addrs1.isPresent()) ? addrs1.get().getCity() : “City Not

available”;

System.out.println(eAddress);

What is the result?

A.

New York

B.

City Not available

C.

null

D.

A NoSuchElementException is thrown at run time.

Full Access
Question # 47

Given:

public class Product {

int id; int price;

public Product (int id, int price) {

this.id = id;

this.price = price;

}

Public String toString () { return id + “:” + price;)

}

and the code fragment:

List products = new ArrayList <> (Arrays.asList(new Product(1, 10),

new Product (2, 30),

new Product (3, 20));

Product p = products.stream().reduce(new Product (4, 0), (p1, p2) -> {

p1.price+=p2.price;

return new Product (p1.id, p1.price);});

products.add(p);

products.stream().parallel()

.reduce((p1, p2) - > p1.price > p2.price ? p1 : p2)

.ifPresent(System.out: :println);

What is the result?

A.

4:60

B.

2:30

C.

4:602:303:201:10

D.

4:0

E.

The program prints nothing

Full Access
Question # 48

Given:

1z0-809 question answer

What is the result?

A.

IT:null

B.

A NullPointerException is thrown at run time.

C.

A compilation error occurs.

D.

IT:0.0

Full Access
Question # 49

Assume customers.txt is accessible and contains multiple lines.

Which code fragment prints the contents of the customers.txt file?

A.

Stream stream = Files.find (Paths.get (“customers.txt”));stream.forEach((String c) -> System.out.println(c));

B.

Stream stream = Files.find (Paths.get (“customers.txt”));stream.forEach( c) -> System.out.println(c));

C.

Stream stream = Files.list (Paths.get (“customers.txt”));stream.forEach( c) -> System.out.println(c));

D.

Stream lines = Files.lines (Paths.get (“customers.txt”));lines.forEach( c) -> System.out.println(c));

Full Access
Question # 50

Given:

class Bird {

public void fly () { System.out.print(“Can fly”); }

}

class Penguin extends Bird {

public void fly () { System.out.print(“Cannot fly”); }

}

and the code fragment:

class Birdie {

public static void main (String [ ] args) {

fly( ( ) -> new Bird ( ));

fly (Penguin : : new);

}

/* line n1 */

}

Which code fragment, when inserted at line n1, enables the Birdie class to compile?

A.

static void fly (Consumer bird) {bird :: fly ();}

B.

static void fly (Consumer bird) {bird.accept( ) fly ();}

C.

static void fly (Supplier bird) {bird.get( ) fly ();}

D.

static void fly (Supplier bird) {LOST

Full Access
Question # 51

Given:

public class Emp {

String fName;

String lName;

public Emp (String fn, String ln) {

fName = fn;

lName = ln;

}

public String getfName() { return fName; }

public String getlName() { return lName; }

}

and the code fragment:

List emp = Arrays.asList (

new Emp (“John”, “Smith”),

new Emp (“Peter”, “Sam”),

new Emp (“Thomas”, “Wale”));

emp.stream()

//line n1

.collect(Collectors.toList());

Which code fragment, when inserted at line n1, sorts the employees list in descending order of fName and then ascending order of lName?

A.

.sorted (Comparator.comparing(Emp::getfName).reserved().thenComparing(Emp::getlName))

B.

.sorted (Comparator.comparing(Emp::getfName).thenComparing(Emp::getlName))

C.

.map(Emp::getfName).sorted(Comparator.reserveOrder())

D.

.map(Emp::getfName).sorted(Comparator.reserveOrder().map(Emp::getlName).reserved

Full Access
Question # 52

Given the code fragment:

1z0-809 question answer

Which code fragment, when inserted at line n1, enables the code to print /First.txt?

A.

Path iP = new Paths (“/First.txt”);

B.

Path iP = Paths.toPath (“/First.txt”);

C.

Path iP = new Path (“/First.txt”);

D.

Path iP = Paths.get (“/”, “First.txt”);

Full Access
Question # 53

Which two statements are true about synchronization and locks? (Choose two.)

A.

A thread automatically acquires the intrinsic lock on a synchronized statement when executed.

B.

The intrinsic lock will be retained by a thread if return from a synchronized method is caused by an uncaught exception.

C.

A thread exclusively owns the intrinsic lock of an object between the time it acquires the lock and the time it releases it.

D.

A thread automatically acquires the intrinsic lock on a synchronized method’s object when entering that method.

E.

Threads cannot acquire intrinsic locks on classes.

Full Access
Question # 54

Given:

Item table

• ID, INTEGER: PK

• DESCRIP, VARCHAR(100)

• PRICE, REAL

• QUANTITY< INTEGER

And given the code fragment:

9. try {

10.Connection conn = DriveManager.getConnection(dbURL, username, password);

11. String query = “Select * FROM Item WHERE ID = 110”;

12. Statement stmt = conn.createStatement();

13. ResultSet rs = stmt.executeQuery(query);

14.while(rs.next()) {

15.System.out.println(“ID:“ + rs.getString(1));

16.System.out.println(“Description:“ + rs.getString(2));

17.System.out.println(“Price:“ + rs.getString(3));

18. System.out.println(Quantity:“ + rs.getString(4));

19.}

20. } catch (SQLException se) {

21. System.out.println(“Error”);

22. }

Assume that:

The required database driver is configured in the classpath.

The appropriate database is accessible with the dbURL, userName, and passWord exists.

The SQL query is valid.

What is the result?

A.

An exception is thrown at runtime.

B.

Compilation fails.

C.

The code prints Error.

D.

The code prints information about Item 110.

Full Access
Question # 55

Given the code fragments:

class ThreadRunner implements Runnable {

public void run () { System.out.print (“Runnable”) ; }

}

class ThreadCaller implements Callable {

Public String call () throws Exception {return “Callable”; )

}

and

ExecutorService es = Executors.newCachedThreadPool ();

Runnable r1 = new ThreadRunner ();

Callable c1 = new ThreadCaller ();

// line n1

es.shutdown();

Which code fragment can be inserted at line n1 to start r1 and c1 threads?

A.

Future f1 = (Future) es.submit (r1);es.execute (c1);

B.

es.execute (r1);Future f1 = es.execute (c1) ;

C.

Future f1 = (Future) es.execute(r1);Future f2 = (Future) es.execute(c1);

D.

es.submit(r1);Future f1 = es.submit (c1);

Full Access
Question # 56

Given the code fragment:

LocalDate valentinesDay =LocalDate.of(2015, Month.FEBRUARY, 14);

LocalDate nextYear = valentinesDay.plusYears(1);

nextYear.plusDays(15); //line n1

System.out.println(nextYear);

What is the result?

A.

2016-02-14

B.

A DateTimeException is thrown.

C.

2016-02-29

D.

A compilation error occurs at line n1.

Full Access
Question # 57

1z0-809 question answer

What is the result?

A.

A compilation error occurs at line 7.

B.

100

C.

A compilation error occurs at line 8.

D.

A compilation error occurs at line 15.

Full Access
Question # 58

Given the content:

1z0-809 question answer

and the code fragment:

1z0-809 question answer

What is the result?

A.

username = Entrez le nom d’utilisateurpassword = Entrez le mot de passe

B.

username = Enter User Namepassword = Enter Password

C.

A compilation error occurs.

D.

The program prints nothing.

Full Access