Labour Day - Special Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: dpm65

1z0-809 Java SE 8 Programmer II Questions and Answers

Questions 4

Which two statements are true about localizing an application? (Choose two.)

Options:

A.

Support for new regional languages does not require recompilation of the code.

B.

Textual elements (messages and GUI labels) are hard-coded in the code.

C.

Language and region-specific programs are created using localized data.

D.

Resource bundle files include data and currency information.

E.

Language codes use lowercase letters and region codes use uppercase letters.

Buy Now
Questions 5

Given the code fragment:

List doubles = Arrays.asList (100.12, 200.32);

DoubleFunction funD = d –> d + 100.0;

doubles.stream (). forEach (funD); // line n1

doubles.stream(). forEach(e –> System.out.println(e)); // line n2

What is the result?

Options:

A.

A compilation error occurs at line n2.

B.

200.12300.32

C.

100.12200.32

D.

A compilation error occurs at line n1.

Buy Now
Questions 6

Given the code fragment:

public void recDelete (String dirName) throws IOException {

File [ ] listOfFiles = new File (dirName) .listFiles();

if (listOfFiles ! = null && listOfFiles.length >0) {

for (File aFile : listOfFiles) {

if (aFile.isDirectory ()) {

recDelete (aFile.getAbsolutePath ());

} else {

if (aFile.getName ().endsWith (“.class”))

aFile.delete ();

}

}

}

}

Assume that Projects contains subdirectories that contain .class files and is passed as an argument to the recDelete () method when it is invoked.

What is the result?

Options:

A.

The method deletes all the .class files in the Projects directory and its subdirectories.

B.

The method deletes the .class files of the Projects directory only.

C.

The method executes and does not make any changes to the Projects directory.

D.

The method throws an IOException.

Buy Now
Questions 7

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?

Options:

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);

Buy Now
Questions 8

Given:

1z0-809 Question 8

and the command:

java Product 0

What is the result?

Options:

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.

Buy Now
Questions 9

Given the code fragment:

1z0-809 Question 9

What is the result?

Options:

A.

Java EEJava EESE

B.

Java EESE

C.

The program prints either:Java EEJava SEorJava SEJava EE

D.

Java EEJava SE

Buy Now
Questions 10

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?

Options:

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]

Buy Now
Questions 11

Given the code fragment:

BiFunction val = (t1, t2) -> t1 + t2;//line n1

System.out.println(val.apply(10, 10.5));

What is the result?

Options:

A.

20

B.

20.5

C.

A compilation error occurs at line n1.

D.

A compilation error occurs at line n2.

Buy Now
Questions 12

Which class definition compiles?

Options:

A.

B.

C.

D.

Buy Now
Questions 13

Given:

class Vehicle implements Comparable{

int vno;

String name;

public Vehicle (int vno, String name) {

this.vno = vno,;

this.name = name;

}

public String toString () {

return vno + “:” + name;

}

public int compareTo(Vehicle o) {

return this.name.compareTo(o.name);

}

and this code fragment:

Set vehicles = new TreeSet <> ();

vehicles.add(new Vehicle (10123, “Ford”));

vehicles.add(new Vehicle (10124, “BMW”));

System.out.println(vehicles);

What is the result?

Options:

A.

[10123:Ford, 10124:BMW]

B.

[10124:BMW, 10123:Ford]

C.

A compilation error occurs.

D.

A ClassCastException is thrown at run time.

Buy Now
Questions 14

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?

Options:

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.

Buy Now
Questions 15

Given the code fragment:

Path source = Paths.get (“/data/december/log.txt”);

Path destination = Paths.get(“/data”);

Files.copy (source, destination);

and assuming that the file /data/december/log.txt is accessible and contains:

10-Dec-2014 – Executed successfully

What is the result?

Options:

A.

A file with the name log.txt is created in the /data directory and the content of the /data/december/log.txt file is copied to it.

B.

The program executes successfully and does NOT change the file system.

C.

A FileNotFoundException is thrown at run time.

D.

A FileAlreadyExistsException is thrown at run time.

Buy Now
Questions 16

Given:

1z0-809 Question 16

and the code fragment:

1z0-809 Question 16

What is the result?

Options:

A.

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

B.

Java EEJava ME

C.

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

D.

A compilation error occurs.

Buy Now
Questions 17

In 2015, daylight saving time in New York, USA, begins on March 8th at 2:00 AM. As a result, 2:00 AM becomes 3:00 AM.

Given the code fragment:

1z0-809 Question 17

Which is the result?

Options:

A.

3:00 – difference: 2

B.

2:00 – difference: 1

C.

4:00 – difference: 3

D.

4:00 – difference: 2

Buy Now
Questions 18

Given the code fragment:

1z0-809 Question 18

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

Options:

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”);

Buy Now
Questions 19

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?

Options:

A.

User is registered.

B.

An AgeOutOfLimitException is thrown.

C.

A UserException is thrown.

D.

A compilation error occurs in the main method.

Buy Now
Questions 20

Given:

1. abstract class Shape {

2. Shape ( ) { System.out.println (“Shape”); }

3. protected void area ( ) { System.out.println (“Shape”); }

4. }

5.

6. class Square extends Shape {

7. int side;

8. Square int side {

9./* insert code here */

10. this.side = side;

11. }

12. public void area ( ) { System.out.println (“Square”); }

13. }

14. class Rectangle extends Square {

15. int len, br;

16. Rectangle (int x, int y) {

17. /* insert code here */

18. len = x, br = y;

19. }

20. void area ( ) { System.out.println (“Rectangle”); }

21. }

Which two modifications enable the code to compile? (Choose two.)

Options:

A.

At line 1, remove abstract

B.

At line 9, insert super ( );

C.

At line 12, remove public

D.

At line 17, insert super (x);

E.

At line 17, insert super (); super.side = x;

F.

At line 20, use public void area ( ) {

Buy Now
Questions 21

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!?

Options:

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 {

Buy Now
Questions 22

Given the code fragment:

List colors = Arrays.asList(“red”, “green”, “yellow”);

Predicate test = n - > {

System.out.println(“Searching…”);

return n.contains(“red”);

};

colors.stream()

.filter(c -> c.length() > 3)

.allMatch(test);

What is the result?

Options:

A.

Searching…

B.

Searching…Searching…

C.

Searching…Searching…Searching…

D.

A compilation error occurs.

Buy Now
Questions 23

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 = null;

Optional

addrs1 = Optional.ofNullable (address);

Employee e1 = new Employee (addrs1);

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

available”;

What is the result?

Options:

A.

New York

B.

City Not available

C.

null

D.

A NoSuchElementException is thrown at run time.

Buy Now
Questions 24

Given the content:

1z0-809 Question 24

and given the code fragment:

1z0-809 Question 24

Which two code fragments, when inserted at line 1 independently, enable the code to print “Wie geht’s?”

Options:

A.

currentLocale = new Locale (“de”, “DE”);

B.

currentLocale = new Locale.Builder ().setLanguage (“de”).setRegion (“DE”).build();

C.

currentLocale = Locale.GERMAN;

D.

currentlocale = new Locale();currentLocale.setLanguage (“de”);currentLocale.setRegion (“DE”);

E.

currentLocale = Locale.getInstance(Locale.GERMAN,Locale.GERMANY);

Buy Now
Questions 25

Given the code fragment:

BiFunction val = (t1, t2) -> t1 + t2; //line n1

//line n2

System.out.println(val.apply(10, 10.5));

What is the result?

Options:

A.

20

B.

20.5

C.

A compilation error occurs at line n1.

D.

A compilation error occurs at line n2.

Buy Now
Questions 26

Given that data.txt and alldata.txt are accessible, and the code fragment:

1z0-809 Question 26

What is required at line n1 to enable the code to overwrite alldata.txt with data.txt?

Options:

A.

br.close();

B.

bw.writeln();

C.

br.flush();

D.

bw.flush();

Buy Now
Questions 27

Given the code fragments:

1z0-809 Question 27

and

1z0-809 Question 27

What is the result?

Options:

A.

null

B.

A compilation error occurs.

C.

DogCatMouse

D.

[Dog, Cat, Mouse]

Buy Now
Questions 28

Given:

1z0-809 Question 28

and the code fragment:

1z0-809 Question 28

What is the result?

Options:

A.

An exception is thrown at line n2.

B.

100

C.

A compilation error occurs because the try block is declared without a catch or finally block.

D.

A compilation error occurs at line n1.

Buy Now
Questions 29

Given:

1z0-809 Question 29

What is the result?

Options:

A.

Hi Interface-2

B.

A compilation error occurs.

C.

Hi Interface-1

D.

Hi MyClass

Buy Now
Exam Code: 1z0-809
Exam Name: Java SE 8 Programmer II
Last Update: Apr 22, 2024
Questions: 196

PDF + Testing Engine

$56  $159.99

Testing Engine

$42  $119.99
buy now 1z0-809 testing engine

PDF (Q&A)

$35  $99.99
buy now 1z0-809 pdf
dumpsmate guaranteed to pass
24/7 Customer Support

DumpsMate's team of experts is always available to respond your queries on exam preparation. Get professional answers on any topic of the certification syllabus. Our experts will thoroughly satisfy you.

Site Secure

mcafee secure

TESTED 29 Apr 2024